Configuring Generic Routing Encapsulation (GRE) tunnel

Posted: January 17, 2016 in CISCO

Generic routing encapsulation tunnel encapsulates data within a packet that needs to be delivered to destination.It can carry almost any layer 3 protocol.GRE creates point-to-point tunnel interface between endpoints, which is,in fact, a logical interface.With GRE it’s possible to transfer data which wouldn’t be transfered  over public network.

GRE doesn’t provide any security for data being transfered,but GRE can be passed over IPsec VPN.

So,what’s the point of GRE tunnels then ?.

Well,GRE can be used to enable multicast traffic across the links.(Routing protocols use multicast traffic).We can also leverage GRE tunnels for creating VPN connections.

In this example,we’ll create GRE tunnel between R1 and R3 endpoints.We’ll use GRE tunnels to deploy OSPF routing protocol so host1 (10.30.10.0 network) can reach host2  network (10.40.10.0)

 

Untitled.png
R1 config:

!
interface FastEthernet0/0
ip address 10.30.10.1 255.255.255.252
!
interface Serial1/0
ip address 10.10.10.2 255.255.255.252
!I used static route to create connection between R1 and R3

ip route 0.0.0.0 0.0.0.0 10.10.10.1

 

ISP config:

!
interface Serial1/0
ip address 10.10.10.1 255.255.255.252
serial restart-delay 0
!
interface Serial1/1
ip address 10.20.10.1 255.255.255.0

!static route
ip route 0.0.0.0 0.0.0.0 10.10.10.2
!static route to 10.40.10.0 network
ip route 10.40.10.0 255.255.255.252 10.20.10.2

 

R3 config:

!
interface FastEthernet0/0
ip address 10.40.10.1 255.255.255.252

!
interface Serial1/0
ip address 10.20.10.2 255.255.255.252

!static route
ip route 0.0.0.0 0.0.0.0 10.20.10.1

 

Create GRE tunnel on R1:

R1(config)#interface Tunnel 0
!ip address of R1
R1(config-if)#tunnel source 10.10.10.2
!ip address of R3
R1(config-if)#tunnel destination 10.20.10.2
!ip address of tunnel 0 interface
R1(config-if)#ip address 192.168.0.1 255.255.255.0

 

Create GRE tunnel on R3:

R3(config)#interface Tunnel 0
!ip address of R3
R3(config-if)#tunnel source 10.20.10.2
!ip address of R1
R3(config-if)#tunnel destination 10.10.10.2
!ip address of tunnel 0 interface
R1(config-if)#ip address 192.168.0.2 255.255.255.0

 

Configure routing protocols on R1 and R3 (i used OSPF)

R1:

R1(config)#router ospf 1
!physical interface S1/0
R1(config-router)#network 10.30.10.0 0.0.0.255 area 0
!Tunnel 0 interface
R1(config-router)#network 192.168.0.0 0.0.0.255 area

R3: 

<pre>R3(config)#router ospf 1
!physical interface S1/0
R3(config-router)#network 10.40.10.0 0.0.0.255 area 0
!Tunnel 0 interface
R3(config-router)#network 192.168.0.0 0.0.0.255 area 0

 

Host1 and host3 are routers simulate client computers:

Host1 config:

interface FastEthernet0/0
 ip address 10.30.10.2 255.255.255.252
!remove routing capabilities
host1(config)#no ip routing
host1(config)#ip default-gateway 10.30.10.1

 

Host2 config:

interface FastEthernet0/0
 ip address 10.40.10.2 255.255.255.252
!remove routing capabilities
host2(config)#no ip routing
host2(config)#ip default-gateway 10.40.10.1

 

Routing table on R1:

Untitled

We can see that OSPF route (O) to 10.40.10.0 network is advertised via Tunnel 0 interface

 

 

Ping from R1 to host2:

We can see OSPF hello packet was sent using GRE protocol

Untitled.png

Ping from host1 (10.30.10.2) to host2 (10.40.10.2)

Untitled

Again,GRE protocol is used

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s