How to configure a GRE Tunnel on a Cisco router

A GRE tunnel is used to connect remote sites via the Internet, an alternative to L2L or MPLS.

In this tutorial, you will learn what is and how to configure a GRE tunnel as well as how it works.

I’ll leave technical details (configuration) for the last.

What is a GRE tunnel?

A GRE tunnel (Generic Routing Encapsulation) is a logical interface in a Cisco router that encapsulates all packets that go through it.

GRE tunnels are independent from each other at each router, the interface activates itself as soon as configuration is done. This means that a GRE tunnel does not keep status information about the other end tunnel.

For example, if a tunnel end shuts down, the other end will never know and will keep its own tunnel up and active.

If there are static routes, these would not be removed from the routing table, meaning all traffic would still try to go through the tunnel and will be dropped.

In some cases, it’s better to use a dynamic routing protocol.

How do GRE tunnels work?

The function of a GRE tunnel is to establish a point-to-point connection between two remote locations as if you had both routers connected locally.

It is established through an Internet connection at both ends, but it is not limited to it, it could be even established through MPLS or even a L2L link, but it’s not that common.

What establishing this tunnels through the Internet benefits from is that you will have LAN to LAN network connectivity as if you had both ends (routers) at the same place.

So, communication will be possible without NAT in between.

The GRE tunnel encapsulates all packets that pass through it so that the exterior (Internet) sees them with a public IP address until it gets to the other end and then they are “put back” with the private IP addresses.

CONFIGURATION

This is the network topology that will be used for this example.

IP addressing has veen assigned to each network interface.

Routing has been configured on both routers.

USA router configuration.

The command tunnel source will be followed by the own public IP address that you will use to reach the other end.

Similarly, the command tunnel destination will have the other end public IP address.

You will most likely run ICMP tests to confirm you have network connectivity between both ends.

Once this configuration is set, the interface will turn on (up/up).

I’ll do the same in the other router, but now reverting IP addresses in the tunnel configuration.

MEXICO router configuration.

Configuration is very similar to the other router, but the IP addresses are switched.

Now, the tunnel is ready to go.

The only thing left to be configured now are the static routes through the tunnels to reach each LAN at both ends.

USA

MEXICO

Remember…

A GRE tunnel provides a “local” type of connection between two remote sites through the Internet.

Keep in mind that this method does not have data encryption mechanism, thus.

That’s why it is recommended to use IPSec over GRE to accomplish this, but it is not mandatory.

NETWORK CONNECTIVITY TESTS

Successful network connectivity between the tunnels at each end.

USA

MEXICO

From USA PC 1 to MEXICO PC 1.

From MEXICO PC 1 to USA PC 1.

This is how you configure a GRE tunnel and have it ready to work and connect your remote sites together through the Internet.

A YouTube video on how to configure a GRE tunnel.

Feel free to leave a comment down below if you still have doubts.