GRE Tunnels
Synchronized Transcript
50 cues indexed • Click dialogue or words to jumpWelcome to Jeremy’s IT Lab. This is a free, complete course for the CCNA. If you like these videos, please subscribe to follow along with the series.
Also, please like and leave a comment, and share the video to help spread this free series of videos. Thanks for your help. If you want more labs like this, I highly recommend Boson Software’s NetSim for CCNA.
NetSim is a network simulator like Packet Tracer, but it’s far more powerful and contains over 100 detailed guided labs covering the CCNA exam topics.
If you want to get NetSim, follow the link in the description. In this lab we will configure a GRE tunnel between R1 and R2.
Both routers are connected to a service provider network, but the GRE tunnel will create a virtual direct connection between them. Now, all traffic between R1 and R2 will still have to physically pass through the service provider network.
However all packets will be encapsulated in additional headers to create a virtual tunnel that the original packets pass through. Now, as I mentioned in the lecture video GRE doesn’t encrypt packets, so it’s not secure on its own.
However the purpose of this video is just to demonstrate how tunnels work, so I picked GRE because it’s quite simple to configure. So let’s get right into configuring GRE, on R1 first.
ENABLE. CONF T. To configure a GRE tunnel, we have to make a tunnel interface. This is not a physical interface, of course, but a virtual interface like a loopback interface.
INTERFACE TUNNEL 0. Okay, I have created the tunnel interface. Now I just need a few commands to complete the GRE configuration.
First, TUNNEL SOURCE, and now we have to specify which physical interface on R1 will be used for the tunnel. Well, we should use the interface connected to the service provider, so G0/0/0.
Next, TUNNEL DESTINATION, and then we have to specify the IP address of the other end of the tunnel, of R2. So, I’ll enter R2’s WAN interface’s IP, 200.0.0.2.
And finally, the virtual tunnel interface itself needs an IP address. IP ADDRESS 192.168.1.1 255.255.255.252.
Okay, that’s all the configuration needed. TUNNEL SOURCE, TUNNEL DESTINATION, and then IP ADDRESS.
Let’s check the status. DO SHOW IP INTERFACE BRIEF. Okay, the Tunnel0 interface is up/down. Why down?
We’ll investigate that after configuring R2. So let’s do the same thing on R2. ENABLE.
CONF T. INTERFACE TUNNEL 0. TUNNEL SOURCE, and just like on R1 it will be G0/0/0.
TUNNEL DESTINATION, this time it will be the IP address of R1’s WAN interface, 100.0.0.2. And finally the IP address.
IP ADDRESS 192.168.1.2 255.255.255.252. Okay, that’s all, let’s check the status.
DO SHOW IP INTERFACE BRIEF. Okay, there’s the tunnel interface, but it’s still down. Why is that, even though we’ve configured both sides?
Let me show you. DO SHOW IP ROUTE. So, R2 doesn’t have a connected route for its tunnel interface of course, because the interface is still down.
It has connected routes for its physical interfaces, but we’re missing a critical route. R2 doesn’t know how to reach the IP address we specified as the tunnel destination, 100.0.0.2.
If R2 doesn’t know how to get to 100.0.0.2, it can’t build a GRE tunnel to 100.0.0.2. So, let’s fix that. EXIT.
I’ll just configure a default route. IP ROUTE 0.0.0.0 0.0.0.0 200.0.0.1.
Okay, after we have the route to 100.0.0.2, the tunnel interface comes up. Let’s check. DO SHOW IP ROUTE. Now we have the connected route for the tunnel.
Let’s try to ping R1’s side. DO PING 192.168.1.1. Hmm, the ping still isn’t working, even though the interface is up and we
have a route. Actually the reason for that is that we also have to configure a route on R1 to 200.0.0.2. Let’s check the routing table on R1.
DO SHOW IP ROUTE. Only connected routes for its physical interfaces, so it doesn’t know how to get to the tunnel destination, 200.0.0.2.
I’ll configure a default route here, too. EXIT. IP ROUTE 0.0.0.0 0.0.0.0 100.0.0.1.
Okay, now the tunnel interface comes up, and this time a ping from R1 to R2’s tunnel interface should work. DO PING 192.168.1.2.
As usual the first few pings might fail because the ARP process is a bit slow in packet tracer, but after ARP completes they will succeed. So, although R1 and R2 aren’t directly connected, they will behave as if they are directly connected through the GRE tunnel, and soon
you will see what happens when we activate OSPF. But first, let me show you a ping in simulation mode. Okay, I’ll do that ping again.
PING 192.168.1.2. Okay let’s check the contents of this message that R1 sends. Click on outbound PDU details, and let’s scroll down to the bottom.
So, there’s the ICMP message, the ping. It’s encapsulated with an IP header, source 192.168.1.1 and destination 192.168.1.2, so the addresses of the tunnel interfaces.
But then on top of that there is a GRE header, and on top of that there is another IP header. In this outer IP header, the source IP is 100.0.0.2, R1’s G0/0/0 interface, and the destination IP is 200.0.0.2, R2’s
G0/0/0 interface. So, we call this a tunnel. The original packet from R1’s tunnel interface to R2’s tunnel interface is encapsulated within an additional IP header which is used to transport the original packet over the service provider network to reach R2.
Now, something you can do when R1 and R2 are virtually directly connected like this is make them OSPF neighbors to share routes.
First let me demonstrate that a ping from PC1 to PC2 doesn’t work. PING 10.0.2.100. Let’s wait a bit for all the pings to go through, they should fail.
But when R1 and R2 become OSPF neighbors they will learn each other’s routes, and PC1 and PC2 will be able to communicate over the GRE tunnel.
So let’s enable OSPF on R1 first. ROUTER OSPF 1. I’ll enable it on the tunnel interface, but also the G0/0 interface so that it tells R2 about its connected LAN.
NETWORK 192.168.1.1 0.0.0.0 AREA 0. That enables OSPF on the tunnel 0 interface, next G0/0.
NETWORK 10.0.1.1 0.0.0.0 AREA 0. And I’ll make G0/0 a passive interface since there are no neighbors connected to it.
PASSIVE-INTERFACE G0/0. Okay now I’ll do the same on R2. ROUTER OSPF 1.
NETWORK 192.168.1.2 0.0.0.0 AREA 0. NETWORK 10.0.2.1 0.0.0.0 AREA 0.
And again I’ll make G0/0 a passive interface here, because there are no OSPF neighbors connected to it. PASSIVE-INTERFACE G0/0.
Okay, and as you can see R1 and R2 have become OSPF neighbors. Let’s check the routes. DO SHOW IP ROUTE.
Okay, it learned a route to 10.0.1.0/24, R1’s LAN, via the tunnel0 interface. And I’ll go back to check on R1 also.
DO SHOW IP ROUTE. Okay, it learned a route to 10.0.2.0/24 via the tunnel0 interface. Okay, let’s try that ping from PC1 to PC2 again, and this time it should work.
PING 10.0.2.100. One or two pings might fail, but after that they will work. R1 will encapsulate the packet from PC1 using GRE and send it over the tunnel to R2.
Okay, in this video I introduced GRE tunnels. You don’t need to know this for the CCNA exam, but it’s simple to configure and hopefully helped you understand a little about how tunnels work.
That’s all for this lab. Now let’s take a look at a bonus lab in Boson Software’s NetSim for CCNA.