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
- Create a VRF, put interfaces in it, and explain why the interface loses its address.
- Read and test a VRF's own table with
show ip route vrfandping vrf. - Configure a GRE tunnel and say when it comes up, what it adds to each packet and why it needs a lower MTU.
- Avoid recursive routing on a tunnel.
- Compare ESP and AH, tunnel and transport mode, and protect a GRE tunnel with an IPsec profile.
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 0Every 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 0A 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-PROTA 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 vrf | Each VRF with its route distinguisher (if any) and interfaces. |
show ip route vrf CUST-A | The VRF's own routing table. |
ping vrf CUST-A 10.1.2.10 | A ping that uses the VRF's table and interfaces. |
show interfaces Tunnel0 | Tunnel state, source, destination, protocol (GRE/IP) and MTU. |
show crypto isakmp sa | IKE phase 1 state (QM_IDLE means up). |
show crypto ipsec sa | IPsec SAs with encrypted and decrypted packet counters. |
Exam traps
- Moving an interface into a VRF deletes its IP address.
- A plain
pingorshow ip routelooks at the global table, not the VRF. - A GRE tunnel shows up/up with nothing on the far end unless keepalives are on.
- Learning the tunnel destination through the tunnel causes recursive routing and flapping.
- GRE adds 24 bytes; GRE over IPsec more. Lower
ip mtuandip tcp adjust-msson the tunnel. - IPsec alone (without GRE or a VTI) does not carry multicast, so OSPF cannot run over a crypto map.
Check yourself
- You add
vrf forwarding CUST-Ato 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-Aandping 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.