|GRE(4)||Device Drivers Manual||GRE(4)|
— encapsulating network device
gre driver allows tunnel construction
using the Cisco GRE or the Mobile IP (RFC 2004) encapsulation protocols.
GRE, WCCPv1, and Mobile IP are enabled with the following sysctl(3) variables respectively in /etc/sysctl.conf:
This driver currently supports the following modes of operation:
interface can be created at runtime using the
create command or
by setting up a
configuration file for
netstart(8). The MTU is set
to 1476 by default to match the value used by Cisco routers. This may not be
an optimal value, depending on the link between the two tunnel endpoints,
but it can be adjusted via
For correct operation, there needs to be a route to the destination 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).
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 encapsulated) but need not be as, for example, when encapsulating AppleTalk.
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
Keepalive packets may optionally be sent to the remote endpoint, which decapsulates and returns them, allowing tunnel failure to be detected. Enable them like this:
# ifconfig greN keepalive period count
This will send a keepalive packet every period seconds. If no response is received in count * period seconds, the link is considered down. To return keepalives, the remote host must be configured to forward packets:
# sysctl net.inet.ip.forwarding=1
If pf(4) is enabled
then it is necessary to add a pass rule specific for the keepalive packets.
The rule must use
no state because the keepalive
packet is entering the network stack multiple times. In most cases the
following should work:
pass quick on gre proto gre no state
S. Hanks, T. Li, D. Farinacci, and P. Traina, Generic Routing Encapsulation (GRE), RFC 1701, October 1994.
S. Hanks, T. Li, D. Farinacci, and P. Traina, Generic Routing Encapsulation over IPv4 networks, RFC 1702, October 1994.
C. Perkins, Minimal Encapsulation within IP, RFC 2004, October 1996.
Web Cache Coordination Protocol V1.0, http://www.wrec.org/Drafts/draft-ietf-wrec-web-pro-00.txt.
Web Cache Coordination Protocol V2.0, http://www.wrec.org/Drafts/draft-wilson-wrec-wccp-v2-00.txt.
Heiko W. Rupp <email@example.com>
The GRE RFC is not yet fully implemented (no GRE options).
The redirect header for WCCPv2 GRE encapsulated packets is skipped.
|August 31, 2016||OpenBSD-6.1|