Search

How to Configure Generic Routing Encapsulation (GRE) Tunnel in Cisco IOS Router

Generic routing encapsulation (GRE) is an IP encapsulation protocol which is used to transport IP packets over a network. Generic routing encapsulation (GRE) was initially developed by Cisco, but later become industry standard (RFC 1701, RFC 2784, RFC 2890).

GRE (Generic Routing Encapsulation) allows Routing of IP packets between private IPv4 networks which are separated over public IPv4 internet. GRE (Generic Routing Encapsulation) also supports encapsulating IPv4 broadcast and multicast traffic.

Cisco GRE tunnelling technology uses a logical interface called as "tunnel interface". A "tunnel interface" can be created by using normal interface configuration commands. IP datagram packets are encapsulated and decapsulated with a GRE header and an outer IP header as the IP Datagram packets enter or exit the GRE tunnel.

Refer previous lesson What is GRE (Generic Routing Encapsulation), to get more concepts about GRE (Generic Routing Encapsulation).

Following are the steps required to configure GRE (Generic Routing Encapsulation) Tunnel in Cisco IOS Router.

GRE Tunnel Configuration - Lab Topology

GRE tunnel topology

Step 01: Use following commands to create a tunnel interface, configure an IPv4 Address for the new tunnel interface and to configure a source and destination for the tunnel interface in OmniSecuR1.

OmniSecuR1#configure terminal
OmniSecuR1(config)#interface tunnel 0
OmniSecuR1(config-if)#ip address 10.10.10.1 255.255.255.252
OmniSecuR1(config-if)#ip mtu 1400
OmniSecuR1(config-if)#ip tcp adjust-mss 1360
OmniSecuR1(config-if)#tunnel source 202.133.63.10
OmniSecuR1(config-if)#tunnel destination 182.19.17.10
OmniSecuR1(config-if)#exit
OmniSecuR1(config)#exit
*Feb 27 20:34:41.399: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to up
OmniSecuR1#

Step 02: Use following commands to create a tunnel interface, configure an IPv4 Address for the new tunnel interface and to configure a source and destination for the tunnel interface in OmniSecuR2.

OmniSecuR2#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
OmniSecuR2(config)#interface tunnel 0
OmniSecuR2(config-if)#ip address 10.10.10.2 255.255.255.252
OmniSecuR2(config-if)#ip mtu 1400
OmniSecuR2(config-if)#ip tcp adjust-mss 1360
OmniSecuR2(config-if)#tunnel source  182.19.17.10
OmniSecuR2(config-if)#tunnel destination 202.133.63.10
OmniSecuR2(config-if)#exit
OmniSecuR2(config)#exit
*Feb 27 20:36:01.315: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to up
OmniSecuR2#

Step 03: Use the following commands to configure OSPF for inter-site routing in OmniSecuR1.

OmniSecuR1#configure terminal
OmniSecuR1(config)#router ospf 1
OmniSecuR1(config-router)#network 172.16.0.0 0.0.255.255 area 0
OmniSecuR1(config-router)#network 10.10.10.0 0.0.0.3 area 0
OmniSecuR1(config-router)#exit
OmniSecuR1(config)#exit
OmniSecuR1#

Step 04: Use the following commands to configure OSPF for inter-site routing in OmniSecuR2.

OmniSecuR2#configure terminal
OmniSecuR2(config)#router ospf 1
OmniSecuR2(config-router)#network 172.17.0.0 0.0.255.255 area 0
OmniSecuR2(config-router)#network 10.10.10.0 0.0.0.3 area 0
OmniSecuR2(config-router)#exit
OmniSecuR2(config)#exit
*Feb 27 20:45:25.299: %OSPF-5-ADJCHG: Process 1, Nbr 202.133.63.10 on Tunnel0 from LOADING to FULL, Loading Done
OmniSecuR2#

GRE encapsulation structure is shown below. Refer What is GRE (Generic Routing Encapsulation) for more details.

GRE IPv4 Encapsulation

 

Following image shows a capture of ICMP message encapsulated with GRE.

GRE Encapsulation Packet Capture 2

 

Related Tutorials