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:

Operating system

GRE over
IPv4

GRE over
IPv6

Transport
VRF

Cisco IOS/XE[1]

FRR

Juniper vJunos-switch

Juniper vSRX

VyOS

Specifying Tunnel Parameters

The GRE tunnels are configured as links with tunnel.mode attribute set to gre[2].

The other link/interface parameters supported by this plugin include:

  • tunnel.af (ipv4 or ipv6) – 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:

  • ifindex – matches the source interface based on its ifindex (useful only when you specify ifindex on interfaces)

  • name – matches link/interface name attribute

  • role – matches link/interface role attribute

  • type – specifies source interface type (valid value: loopback)

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 ifindex, name, or role 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[3].

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