[OpenBSD]

Manual Page Search Parameters

GRE(4) Device Drivers Manual GRE(4)

NAME

gre, egreGeneric Routing Encapsulation network device

SYNOPSIS

pseudo-device gre

DESCRIPTION

The gre pseudo-device provides interfaces for tunnelling protocols across IPv4 and IPv6 networks using the Generic Routing Encapsulation (GRE) encapsulation protocol.
GRE datagrams (IP protocol number 47) consist of a GRE header and an outer IP header for encapsulating another protocol's datagram. The GRE header specifies the type of the encapsulated datagram, allowing for the tunnelling of multiple protocols. Different tunnels between the same endpoints may be distinguised by an optional Key field in the GRE header.
This pseudo driver provides the clonable network interfaces:
 
 
gre
Layer 3 protocols, specifically IPv4, IPv6, and MPLS, are encapsulated by GRE and IP headers. The MTU is set to 1476 by default to match the value used by Cisco routers. gre also supports reception of WCCP encapsulated IPv4 packets.
 
 
egre
Layer 2 Ethernet packets are encapsulated by GRE and IP headers. Transparent Ethernet (0x6558) is used as the protocol identifier in the GRE header as per RFC 1701. The MTU is set to 1500 by default.
GRE and WCCP are enabled with the following sysctl(2) variables respectively in /etc/sysctl.conf:
 
 
net.inet.gre.allow
Allow GRE packets in and out of the system.
 
 
net.inet.gre.wccp
Set to 1 to allow WCCPv1-style GRE packets into the system; set to 2 to handle the packets as WCCPv2-style GRE, truncating the redirect header. Some magic with the packet filter configuration and a caching proxy like squid are needed to do anything useful with these packets. This sysctl requires gre.allow to be set.
gre and egre interfaces can be created at runtime using the ifconfig ifaceN create command or by setting up a hostname.if(5) configuration file for netstart(8).
The default MTU may not be an optimal value depending on the link between the tunnel endpoints, but can be adjusted.
For correct operation, the route to the tunnel destination must not go over the interface itself. This can be implemented by adding a distinct or a more specific route to the tunnel destination than the hosts or networks routed via the tunnel interface. Alternatively, the tunnel traffic may be configured in a separate routing table to the encapsulated traffic.
Each interface supports use of the optional GRE Key field as a virtual network idenfitier.
gre optionally supports sending keepalive packets to the remote endpoint, which allows tunnel failure to be detected. gre interfaces can be individually configured to receive WCCP packets by setting the link-level flag link0.

EXAMPLES

gre 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 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
OR
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 be enabled 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

SEE ALSO

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

STANDARDS

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.
D. Farinacci, T. Li, S. Hanks, D. Meyer, and P. Traina, Generic Routing Encapsulation (GRE), RFC 2784, March 2000.
G. Dommety, Key and Sequence Number Extensions to GRE, RFC 2890, September 2000.
Web Cache Coordination Protocol V1.0, https://tools.ietf.org/html/draft-ietf-wrec-web-pro-00.txt.
Web Cache Coordination Protocol V2.0, https://tools.ietf.org/html/draft-wilson-wrec-wccp-v2-00.txt.

AUTHORS

Heiko W. Rupp <hwr@pilhuhn.de>

CAVEATS

RFC 1701 and RFC 2890 describe a variety of optional GRE header fields in the protocol that are not implemented in the gre driver. The only optional field the driver implements support for is the Key header.
The redirect header for WCCPv2 GRE encapsulated packets is skipped.
February 22, 2018 OpenBSD-current