GRE Tunnels
The tunnel.gre plugin implements point-to-point GRE tunnels over IPv4 and IPv6, including the transport (front-door) VRF functionality.
Supported Platforms
The plugin includes Jinja2 templates for the following platforms:
Device |
GRE over IPv4 |
GRE over IPv6 |
Transport VRF |
|---|---|---|---|
Arista EOS |
✅ |
❌ |
✅ |
Cisco IOL layer-2 image |
✅ |
❌ |
✅ |
Cisco IOS[*1] |
✅ |
✅ |
✅ |
FRRouting |
✅ |
✅ |
✅ |
Juniper vJunos-router |
✅ |
❌ |
✅ |
Juniper vSRX 3.0 |
✅ |
❌ |
✅ |
Mikrotik RouterOS 7 |
✅ |
✅ |
✅ |
OpenBSD |
✅ |
❌ |
❌ |
VyOS |
✅ |
✅ |
✅ |
Specifying Tunnel Parameters
The GRE tunnels are configured as links with tunnel.mode attribute set to gre[1].
The other link/interface parameters supported by this plugin include:
tunnel.af (
ipv4oripv6) – the transport address family (default:ipv4)tunnel.vrf (VRF name) – the transport VRF (default: global routing table)
tunnel.source – the source interface for the tunnel.
Specifying Tunnel Source and Destination
The source interface/IP address for a tunnel is specified with the tunnel.source link/interface attribute. This attribute can have these components:
linkid – matches the transport interface link identifier
type – specifies source interface type (valid value: loopback)
link.name – matches link/interface name attribute
link.role – matches link/interface role attribute
ifindex – matches the source interface based on its ifindex (useful only when you specify ifindex on interfaces)
The source interface selection algorithm evaluates all interfaces in the VRF specified with the tunnel.vrf parameter or global interfaces when the tunnel link/interface has no tunnel.vrf parameter. The selected interface must match the optional tunnel.source parameters and must have an IP address in the tunnel.af address family.
The loopback interface(s) are skipped unless you set the tunnel.type attribute to loopback. The tunnel interfaces are always skipped[2].
The tunnel destination does not have to be specified; it’s taken from the source interface information of the peer device attached to the same tunnel.
Example
The following topology builds a two-router network with a GRE tunnel in the global routing table using the transport VRF as the tunnel underlay:
module: [ ospf, vrf ]
vrfs:
transport:
nodes:
r1:
r2:
links:
- r1:
r2:
ospf: False
vrf: transport
- r1:
r2:
tunnel.mode: gre
tunnel.vrf: transport
tunnel.mode attribute on a link automatically sets link type to tunnel.
netlab does not support recursive tunnels. If you have a good use case, open an issue or a discussion.