Generic Routing Encapsulation
Generic Routing Encapsulation
Tunneling is a concept where we put ‘packets into packets’ so that they can be
transported over certain networks. We also call this encapsulation.
A good example is when you have two sites with IPv6 addresses on their LAN but they
are only connected to the Internet with IPv4 addresses. Normally it would be impossible
for the two IPv6 LANs to reach each other but by using tunneling the two routers will put
IPv6 packets into IPv4 packets so that our IPv6 traffic can be routed on the Internet.
Another example is where we have an HQ and a branch site and you want to run a
routing protocol like RIP, OSPF or EIGRP between them. We can tunnel these routing
protocols so that the HQ and branch router can exchange routing information.
Basically when you configure a tunnel, it’s like you create a point-to-point
connection between the two devices. GRE (Generic Routing Encapsulation) is a
simple tunneling technique that can do this for us. Let me show you a topology that we
will use to demonstrate GRE:
Above we have 3 routers connected to each other. On the left side we have the “HQ”
router which is our headquarters. On the right side there is a “Branch” router that is
supposed to be a branch office. Both routers are connected to the Internet, in the middle
on top there is an ISP router. We can use this topology to simulate two routers that are
connected to the Internet. The HQ and Branch router each have a loopback interface
that represents the LAN.
Let me show you the basic configuration of these routers so that you can recreate it if
you want:
I created a static route on the HQ and Branch router so that they can reach each other
through the ISP router. They will be unable to reach the networks on each others
loopback interfaces however. Now let’s create a tunnel:
HQ(config)#interface tunnel 1
HQ(config-if)#tunnel source fastEthernet 0/0
HQ(config-if)#tunnel destination 192.168.23.3
HQ(config-if)#ip address 192.168.13.1 255.255.255.0
Branch(config)#interface tunnel 1
Branch(config-if)#tunnel source fastEthernet 0/0
Branch(config-if)#tunnel destination 192.168.12.1
Branch(config-if)#ip address 192.168.13.3 255.255.255.0
You can pick any number for the tunnel interface that you like. We need to specify a
source and destination IP address to build the tunnel and we’ll use the 192.168.13.0 /24
subnet on the tunnel interface. Let’s verify that our tunnel is working:
Above you can see that the tunnel interface is up/up on both routers. The default
tunneling mode is GRE. Let’s see if both routers can reach each other:
Branch#ping 192.168.13.1
HQ(config)#router eigrp 13
HQ(config-router)#no auto-summary
HQ(config-router)#network 192.168.13.0
HQ(config-router)#network 172.16.1.0
Branch(config)#router eigrp 13
Branch(config-router)#no auto-summary
Branch(config-router)#network 192.168.13.0
Branch(config-router)#network 172.16.3.0