Generic Routing Encapsulation (GRE)
ccnp-routing
Notes on GRE tunneling covering the header overhead, common use cases such as GRE over IPsec and IPv6 transport, and a working two router lab.
- GRE tunnels allow us to tunnel one protocol with another
- The protocol being tunneled is the passenger protocol
- The protocol tunneling the passenger is the transport protocol
- Defined in RFC 2784
- Encapsulates IPv4 or IPv6 packet inside an IPv4 packet
- Uses IP protocol 47
- Uses a 4-byte header
- We will have 20-byte Transport IP + 4-byte GRE + 20-byte Passenger IP (LAN) + Payload
- Show up in the IP routing table as a connected network
- Can be configured like a normal physical interface
- In configuration keep in mind that you must NEVER learn the destination of the tunnel through the tunnel.
%TUN-5-RECURDOWN: Tunnel0 temporarily disabled due to recursive routing
Common GRE use cases
- Tunneling private IP traffic over a public IP network
- GRE over IPsec is very commonly used for LAN-to-LAN VPN tunnels
- Tunnel encrypted private traffic through the public internet
- Now the question is why not use IPsec by itself?
- Because IPsec can only protect unicast packets but GRE can encapsulate multicast traffic
- Carrying a protocol not routed in your environment over IP network
- Tunneling IPv6 over IPv4 networks
- Tunneling IPX, Appletalk, NetBIOS, whatever through your IP network
- Joining two similar networks together that are separated by a dissimilar network
- Disjointed OSPF areas or IGP domains
- Allows you to easily run a routing protocol between two routers that are not physically connected

hostname R1 ! interface Tunnel0 ip address 172.16.10.1 255.255.255.0 ip mtu 1400 ip tcp adjust-mss 1360 tunnel source GigabitEthernet0/1 tunnel destination 2.2.2.2 ! interface GigabitEthernet0/0 ip address 192.168.1.1 255.255.255.0 ! interface GigabitEthernet0/1 ip address 1.1.1.1 255.255.255.252 ! ip route 2.2.2.2 255.255.255.255 GigabitEthernet0/1 ip route 192.168.2.0 255.255.255.0 172.16.10.2R2
hostname R2 ! interface Tunnel0 ip address 172.16.10.2 255.255.255.0 ip mtu 1400 ip tcp adjust-mss 1360 tunnel source GigabitEthernet0/1 tunnel destination 1.1.1.1 ! interface GigabitEthernet0/0 ip address 192.168.2.1 255.255.255.252 ! interface GigabitEthernet0/1 ip address 2.2.2.2 255.255.255.252 ! ip route 1.1.1.1 255.255.255.255 GigabitEthernet0/1 ip route 192.168.1.0 255.255.255.0 172.16.10.1Internet
hostname Internet ! interface GigabitEthernet0/1 ip address 1.1.1.2 255.255.255.252 ! interface GigabitEthernet0/2 ip address 2.2.2.1 255.255.255.0