*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> gre (4)              



NAME    [Toc]    [Back]

     gre - encapsulating network device

SYNOPSIS    [Toc]    [Back]

     pseudo-device gre [count]

NOTE    [Toc]    [Back]

     GRE, WCCPv1, and MobileIP are  enabled  with  the  following
sysctl(3) variables
 respectively in /etc/sysctl.conf:

     net.inet.gre.allow       Allow GRE packets in and out of the

     net.inet.gre.wccp        Allow WCCPv1-style GRE packets into
the system
                              (depends on the above).

     net.inet.mobileip.allow   Allow  MobileIP packets in and out
of the system.

DESCRIPTION    [Toc]    [Back]

     The gre network interface allows tunnel  construction  using
the Cisco GRE
     or the Mobile-IP (RFC 2004) encapsulation protocols.

     A gre interface can be created at runtime using the ifconfig
greN create
     command or by setting up a hostname.if(5) configuration file

     This driver currently supports the following modes of operation:

     GRE encapsulation (IP protocol number 47).
          Encapsulated datagrams are prepended by an 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.  GRE mode is the default tunnel mode on Cisco routers.
          This is also the default mode of operation of  the  gre

     MOBILE encapsulation (IP protocol number 55).
          Datagrams  are  encapsulated  into  IP, but with a much
smaller encapsulation
 header.  This protocol only supports  IP  in  IP
          and is intended for use with mobile IP.

     The  network interfaces are named gre0, gre1, etc.  The number of interfaces
 is given by the corresponding  pseudo-device  line  in
the system configuration
  file.   gre  interfaces  support  the  following

     GRESADDRS struct ifreq *
             Set the IP address of the local tunnel end.

     GRESADDRD struct ifreq *
             Set the IP address of the remote tunnel end.

     GREGADDRS struct ifreq *
             Query the IP address that is set for the local  tunnel end.

     GREGADDRD struct ifreq *
             Query the IP address that is set for the remote tunnel end.

     GRESPROTO struct ifreq *
             Set the operation mode to the specified IP  protocol
value.  The
             protocol is passed to the interface in the ifr_flags
field of the
             ifreq structure.  The operation mode can also be set
with the
             following modifiers to ifconfig(8):

                   link0   IPPROTO_GRE
                   -link0  IPPROTO_MOBILE

     GREGPROTO struct ifreq *
             Query operation mode.

     Note  that  the  IP addresses of the tunnel endpoints may be
the same as the
     ones defined with ifconfig(8) for the interface (as if IP is
  but need not be, as e.g. when encapsulating AppleTalk.

EXAMPLES    [Toc]    [Back]

     Configuration example:

     Host X ---- Host A ------------ tunnel ------------ Cisco  D
---- Host E
                      +------ Host B ------ Host C ------+

     On Host A (OpenBSD):

           # route add default B
           # ifconfig greN create
           # ifconfig greN A D netmask 0xffffffff linkX up
           # ifconfig greN tunnel A 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 <some interface and mask>
           ip route A mask C
           ip route X mask tunnelX


     On Host D (OpenBSD):

           # route add default C
           # ifconfig greN create
           # ifconfig greN D A
           # ifconfig greN tunnel D A

     To  reach Host A over the tunnel (from Host D), there has to
be an alias
     on Host A for the Ethernet interface:

           # ifconfig <etherif> alias Y

     and on the Cisco:

           ip route Y mask tunnelX

NOTE    [Toc]    [Back]

     For correct operation, the gre device needs a route  to  the
     that  is less specific than the one over the tunnel.  (There
needs to be a
     route to the decapsulating host that does not run  over  the
tunnel, as
     this would create a loop.)

     In  order  for ifconfig(8) to actually mark the interface as
up, the keyword
 up must be given last on its command line.

     The kernel must be set to forward datagrams by  issuing  the
     option to sysctl(8).

     The  GRE interface will accept WCCPv1-style GRE encapsulated
packets from
     a Cisco router.  Some magic with the packet filter  configuration and a
     caching  proxy  like  squid are needed to do anything useful
with these

SEE ALSO    [Toc]    [Back]

     atalk(4), inet(4),  ip(4),  netintro(4),  options(4),  hostname.if(5),
     protocols(5), ifconfig(8), netstart(8), sysctl(8)

     Generic Routing Encapsulation, RFC 1701.

     Generic  Routing Encapsulation over IPv4 networks, RFC 1702.

     Minimal Encapsulation within IP, RFC 2004.

     Web      Cache       Coordination       Protocol       V1.0,

     Web       Cache       Coordination       Protocol      V2.0,

AUTHORS    [Toc]    [Back]

     Heiko W.Rupp <hwr@pilhuhn.de>

BUGS    [Toc]    [Back]

     The compute_route() code  in  sys/net/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

     To  avoid  the  address munging described above, turn on the
link1 flag on
     the ifconfig(8) command line.  This  implies  that  the  GRE
packet destination
  and the remote host are not the same IP addresses, and
that the GRE
     destination does not route over the greX interface itself.

     GRE RFC not yet fully implemented (no GRE options).

     For the WCCP GRE encapsulated packets we can  only  reliably
accept WCCPv1
     format;  WCCPv2  formatted  packets add another header which
will skew the
     decode, and results are not defined (i.e. don't do  WCCPv2).

OpenBSD      3.6                       September     13,     1998
[ Back ]
 Similar pages
Name OS Title
nsip OpenBSD software network interface encapsulating NS packets in IP packets
enc OpenBSD Encapsulating Interface
tun OpenBSD network tunnel pseudo-device
rln OpenBSD device driver for RangeLAN2-based wireless network cards
pfctl OpenBSD control the packet filter (PF) and network address translation (NAT) device
autochanger HP-UX SCSI interfaces for medium changer device and magnetooptical autochanger surface device
devctl FreeBSD device event reporting and device control interface
device_add_child_ordered FreeBSD add a new device as a child of an existing device
device_add_child FreeBSD add a new device as a child of an existing device
filename_to_drivername IRIX determine the device name for the device file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service