2.2 Configure and verify VRFs and GRE/IPsec tunnels

ENCOR 350-401 v1.2 · 2.0 Virtualization

A VRF gives one router several separate routing tables, so customers or departments can share hardware, and even overlap addresses, without seeing each other. A GRE tunnel carries any traffic, multicast included, across a network that does not know those addresses; IPsec encrypts it. For ENCOR you build VRF-Lite, run a VRF across a GRE tunnel, and protect a tunnel with IPsec.

What you must know

VRF

VRF-Lite is VRFs without MPLS: each VRF has its own routing table, its own interfaces and its own routing protocol instances. A packet that arrives on an interface in VRF CUST-A is only routed with CUST-A's table, so CUST-A and CUST-B can both use 10.1.1.0/24.

vrf definition CUST-A
 address-family ipv4
 exit-address-family
!
interface GigabitEthernet0/1
 vrf forwarding CUST-A
 ip address 10.1.1.1 255.255.255.0
!
router ospf 10 vrf CUST-A
 network 10.1.1.0 0.0.0.255 area 0

Every command that looks at a table needs the VRF: show ip route vrf CUST-A, ping vrf CUST-A 10.1.2.1, traceroute vrf CUST-A …. A plain ping uses the global table and fails even when the VRF is fine. The older ip vrf / ip vrf forwarding syntax does the same for IPv4 only.

GRE and IPsec tunnels

GRE (IP protocol 47) wraps the original packet in a new IP header between two tunnel endpoints. It adds 24 bytes (20 for the new IP header, 4 for GRE), carries multicast and broadcast, so OSPF and EIGRP run over it, and encrypts nothing. In the drawing CUST-A's traffic crosses the shared underlay inside the tunnel (1).

interface Tunnel0
 vrf forwarding CUST-A
 ip address 172.16.0.1 255.255.255.252
 ip mtu 1400
 ip tcp adjust-mss 1360
 tunnel source GigabitEthernet0/0
 tunnel destination 198.51.100.2
!
router ospf 10 vrf CUST-A
 network 172.16.0.0 0.0.0.3 area 0

A GRE tunnel is up/up as soon as its source interface is up and the router has a route to the destination; without keepalive it does not check the far end. If the router learns the route to the tunnel destination through the tunnel itself, the tunnel flaps with %TUN-5-RECURDOWN (recursive routing). Keep the underlay prefixes out of the protocol that runs inside the tunnel.

IPsec adds security. ESP (IP protocol 50) encrypts and authenticates; AH (51) only authenticates and breaks with NAT. Tunnel mode adds a new IP header; transport mode protects the payload of an existing one, which is enough for GRE over IPsec. IKE (v1 or v2) authenticates the peers and negotiates the security associations.

crypto isakmp policy 10
 encryption aes 256
 hash sha256
 authentication pre-share
 group 14
crypto isakmp key N7path-key address 198.51.100.2
!
crypto ipsec transform-set TS esp-aes 256 esp-sha256-hmac
 mode transport
crypto ipsec profile GRE-PROT
 set transform-set TS
!
interface Tunnel0
 tunnel protection ipsec profile GRE-PROT

A VTI (tunnel mode ipsec ipv4) is a pure IPsec tunnel interface without GRE: routing protocols run over it too, with a smaller header, but it carries only IP unicast and multicast of one address family.

Commands

show vrfEach VRF with its route distinguisher (if any) and interfaces.
show ip route vrf CUST-AThe VRF's own routing table.
ping vrf CUST-A 10.1.2.10A ping that uses the VRF's table and interfaces.
show interfaces Tunnel0Tunnel state, source, destination, protocol (GRE/IP) and MTU.
show crypto isakmp saIKE phase 1 state (QM_IDLE means up).
show crypto ipsec saIPsec SAs with encrypted and decrypted packet counters.

Exam traps

Check yourself

You add vrf forwarding CUST-A to Gi0/1 and the site goes down. Why?
The command removed Gi0/1's IP address. Configure the address again.
Which commands prove CUST-A's routes and reachability?
show ip route vrf CUST-A and ping vrf CUST-A <address>.
Why can OSPF run over GRE but not over a plain IPsec crypto map?
GRE carries multicast, which OSPF hellos use. A crypto map protects unicast IP only.
A tunnel keeps going down with RECURDOWN. What is happening?
The router learned the route to the tunnel destination through the tunnel itself. Stop advertising the underlay into the tunnel's routing protocol.
ESP or AH: which encrypts?
ESP. AH only authenticates and integrity-protects.

Labs

Try it live: VRF-Lite over a GRE tunnel