From 43688c87028697dce7beb6dd05e126bf6a822868 Mon Sep 17 00:00:00 2001 From: hwr Date: Sun, 13 Sep 1998 20:39:35 +0000 Subject: [PATCH] Manpage for gre network interface. --- share/man/man4/Makefile | 4 +- share/man/man4/gre.4 | 177 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 179 insertions(+), 2 deletions(-) create mode 100644 share/man/man4/gre.4 diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index a88e9b918aa7..02d7708fb57a 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.73 1998/08/18 08:16:56 augustss Exp $ +# $NetBSD: Makefile,v 1.74 1998/09/13 20:39:35 hwr Exp $ # @(#)Makefile 8.1 (Berkeley) 6/18/93 MAN= ahb.4 ahc.4 aria.4 atalk.4 audio.4 bha.4 bpf.4 ccd.4 cd.4 ch.4 clnp.4 \ - cltp.4 ddb.4 drum.4 eap.4 eisa.4 en.4 ep.4 esh.4 esis.4 fd.4 fpa.4 \ + cltp.4 ddb.4 drum.4 eap.4 eisa.4 en.4 ep.4 esh.4 esis.4 fd.4 fpa.4 gre.4 \ icmp.4 idp.4 ifmedia.4 inet.4 ip.4 iso.4 isp.4 lc.4 lkm.4 lo.4 md.4 \ midi.4 ncr.4 ne.4 netintro.4 ns.4 nsip.4 null.4 opl.4 options.4 ppp.4 \ pty.4 puc.4 rnd.4 route.4 scsi.4 sd.4 sl.4 sm.4 spp.4 ss.4 st.4 \ diff --git a/share/man/man4/gre.4 b/share/man/man4/gre.4 new file mode 100644 index 000000000000..05359c6d1914 --- /dev/null +++ b/share/man/man4/gre.4 @@ -0,0 +1,177 @@ +.\" $NetBSD: gre.4,v 1.1 1998/09/13 20:39:36 hwr Exp $ +.\" +.\" Copyright 1998 (c) The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Heiko W.Rupp +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the NetBSD +.\" Foundation, Inc. and its contributors. +.\" 4. Neither the name of the The NetBSD Foundation nor the names of its +.\" contributors may be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd 13 September 1998 +.Dt GRE 4 +.Os NetBSD +.Sh NAME +.Nm gre +.Nd encapsulating network device +.Sh SYNOPSIS +.Cd pseudo-device gre Op Ar count +.Sh DESCRIPTION +The +.Nm tun +network interface is a pseudo device that allows to encapsulate datagrams +into IP. These encapsulated datagrams are routed to a destination host, +where they are decapsulated and further routed to their final destination. +The so called ``tunnel'' appears to the inner datagrams like one hop. +.Pp +This driver currently supports two modes of operation: +.Bl -tag -width abc +.It IPIP encapsulation (IP protocol number 4). Here packets are +directly encapsulated into IP packets +and sent to the tunnel destionation. This mode allows only for IP in IP +tunneling. +.It GRE encapsulation (IP protocol number 47). Encapsulated datagrams are +prepended by a outer datagram and a GRE header. The GRE header specifies +the type of the encapsulated datagram and thus allows for tunneling other +protocols than IP like e.g. AppleTalk (not yet supported). GRE mode is +also the default tunnel mode on Cisco routers. +.El +.Pp +GRE mode is the default mode of operation. +.Pp +The network interfaces are named +.Sy gre Ns Ar 0 , +.Sy gre Ns Ar 1 +and so on, as many as have given on the +.Sy pseudo-device +line in the system config file. Each interface supports a number of +.Xr ioctl 2 Ns s, +such as: +.Bl -tag -width aaa +.It GRESADDRS: +Set the IP address of the local tunnel end. +.It GRESADDRD: +Set the IP address of the remote tunnel end. +.It GREGADDRS: +Query the the IP address that is set for the local tunnel end. +.It GREGADDRD: +Query the the IP address that is set for the remote tunnel end. +.It GRESPROTO: +Set the operation mode. The operation mode can (in a limited manner) also +be given as ``-link0'' (gre) or ``link0'' (ipip) flag on the command line +of +.Xr ifconfig . +.It GREGPROTO: +Query operation mode. +.El +.Pp +Note that the IP adresses of the tunnel endpoints may be the same as the +ones defined with +.Xr ifconfig +for the interface (as if IP is encapsulated), but need not be, as e.g. when +encapsulating AppleTalk. +.Pp +.Sh EXAMPLE +Configuration example: + + +Host X-- Host A ----------------tunnel---------- cisco D------Host E + \\ | + \\ / + +------Host B----------Host C----------+ + + On host A (NetBSD): + + # route add default B + # ifconfig greN A D + # greconfig -i greN -s A -d D + # route add E D + + On Host D (Cisco): + + Interface TunnelX + ip unnumbered D ! e.g. address from ethernet interface + tunnel source D ! e.g. address from ethernet interface + tunnel destination A + ip route C + ip route A mask C + ip route X mask tunnelX + + OR + + On Host D (NetBSD): + + # route add default C + # ifconfig greN D A +.Pp +If all goes well, you should see packets flowing ;-) +.Pp +If you want to reach Host A over the tunnel (from the Cisco D), then +you have to have an alias on Host A for e.g. the ethernet interface like: + ifconfig alias Y + and on the cisco + ip route Y mask tunnelX +.Sh NOTE +For correct operation, the +.Nm +device needs a route to the destination, that is less specific than the +one over the tunnel. +(Basically, there needs to be a route to the decapsulating host that +does not run over the tunnel, as this would be a loop ..) +.Sh SEE ALSO +.Xr netintro 4 , +.Xr ip 4 , +.Xr atalk 4 , +.Xr inet 4 , +.Xr ifconfig 8 , +.Xr greconfig 8 , +.Xr protocols 5 +.Pp +A description of GRE encapsulation can be found in RFC 1701, RFC 1702. +.Pp +A description of IPIP encapsulation can be found in RFC 2003. +.Sh BUGS +The compute_route() code in if_gre.c toggles the last bit of the +IP-address to provoke the search for a less specific route than the +one directly over the tunnel to prevent loops. This is possibly not +the best solution. +.Pp +GRE RFC not yet fully implemented (no GRE options), no other protocols +yet than IP over IP. +RFC 2003 also not yet fully supportet wrt. options etc. +.Pp +Code quality is surely not best and possibly not near anything like KNF +.Pp +Traceroute does not work yet over the tunnel :( +.Pp +BPF does probably not yet work (it might, but last time I looked, +it bombed, so I #if 0'd it out). +.Pp +.Sh AUTHOR +Heiko W.Rupp