GRE Tunnel - Detail and Configuration

GRE (Generic Routing Encapsulation) Tunnel

GRE Tunnel (Generic Routing Encapsulation) is process which allows transfer of packets within same protocol using another protocol. Protocol which is used to carry packets is called passenger protocol and the protocol which is used to carry passenger protocol is know as transfer protocol. GRE Tunnel (Generic Routing Encapsulation) uses IP Protocol as transfer protocol and also used it to carry different type of protocols. Tunnel which is created works as Virtual Point-to-Point link having two identified end points having source and destination IP Address.

GRE Tunnel (Generic Routing Encapsulation) encapsulate the packet into IP packet and sends it to neutral or intermediate host which de-encapsulate that packet and send it to its destination.
Routes which are established with the help of GRE Tunnel (Generic Routing Encapsulation) can be configured both statically and dynamically in the router using different protocols such as RIPOSPFEIGRP.

Data which is traveled through GRE Tunnel (Generic Routing Encapsulation) is routed twice because when packet is recived by GRE endpoint it is de-encapsulated and send to the destination.

Encapsulation and De-encapsulation of GRE Tunnel

Encapsulation of GRE Tunnel Packet

Router is the main source of tunnel and router is used to encapsulate the packet and forward that packet using GRE with following process
  • Router receives a packet which has to travel through tunnel and is sent to the source interface of tunnel.
  • Source interface of tunnel encapsulated the packet into GRE packet format.
  • Then router encapsulated that GRE packet into IP packet so that it can be sent over the tunnel.
  • Then that IP packet is traveled over the tunnel with the help of destination address and the routing process used.

De-encapsulation of GRE Tunnel Packet

Remote router which is connected at the other end of GRE Tunnel is used to de-encapsulate the IP packet which is received with the help of following process
  • When packet which is received for the tunnel, router checks the destination ip address on that packet.
  • Header which is know as IP header is removed form that packet and packet is sent towards the GRE protocol.
  • GRE Protocol removed the header which is GRE header and send that packet to routing protocol for routing towards the destination.

Configuration


GRE Tunnel IP Address

ISP Router

Router>enable
Router#configure terminal
Router(config)#hostname ISP
ISP(config)#enable secret class
ISP(config)#line console 0
ISP(config-line)#password cisco
ISP(config-line)#login
ISP(config-line)#exit
ISP(config)#line vty 0 4
ISP(config-line)#password cisco
ISP(config-line)#login
ISP(config-line)#exit
ISP(config)# interface serial 0/0/0
ISP(config-if)# ip address 10.1.1.2 255.255.255.252
ISP(config-if)# no shutdown
ISP(config-if)# exit
ISP(config)# interface serial 0/0/1
ISP(config-if)# ip address 10.2.2.2 255.255.255.252
ISP(config-if)# no shutdown
ISP(config-if)# exit
ISP(config)# exit
ISP# wr

West Router

Router>enable
Router#configure terminal
Router(config)#hostname West
West(config)#enable secret class
West(config)#line console 0
West(config-line)#password cisco
West(config-line)#login
West(config-line)#exit
West(config)#line vty 0 4
West(config-line)#password cisco
West(config-line)#login
West(config-line)#exit
West(config)# interface serial 0/0/0
West(config-if)# ip address 10.1.1.1 255.255.255.252
West(config-if)# no shutdown
West(config-if)# exit
West(config)# interface tunnel 0
West(config-if)# ip address 172.16.12.1 255.255.255.252
West(config-if)# tunnel source s0/0/0
West(config-if)# tunnel destination 10.2.2.1
West(config-if)# no shutdown
West(config-if)# exit

West(config)# interface gigabitEthernet 0/1
West(config-if)# ip address 172.16.1.1 255.255.255.0
West(config-if)# no shutdown
West(config-if)# exit
West(config)# ip route 0.0.0.0 0.0.0.0 10.1.1.2
West(config)# router ospf 1
West(config-router)# network 172.16.1.0 0.0.0.255 area 0
West(config-router)# network 172.16.12.0 0.0.0.3 area 0
West(config-router)# exit

West(config)# exit
West# wr

East Router

Router>enable
Router#configure terminal
Router(config)#hostname East
East(config)#enable secret class
East(config)#line console 0
East(config-line)#password cisco
East(config-line)#login
East(config-line)#exit
East(config)#line vty 0 4
East(config-line)#password cisco
East(config-line)#login
East(config-line)#exit
East(config)# interface serial 0/0/1
East(config-if)# ip address 10.2.2.1 255.255.255.252
East(config-if)# no shutdown
East(config-if)# exit
East(config)# interface tunnel 0
East(config-if)# ip address 172.16.12.2 255.255.255.252
East(config-if)# tunnel source 10.2.2.1
East(config-if)# tunnel destination 10.1.1.1
East(config-if)# no shutdown
East(config-if)# exit

East(config)# interface gigabitEthernet 0/1
East(config-if)# ip address 172.16.2.1 255.255.255.0
East(config-if)# no shutdown
East(config-if)# exit
East(config)# ip route 0.0.0.0 0.0.0.0 10.2.2.2
East(config)# router ospf 1
East(config-router)# network 172.16.2.0 0.0.0.255 area 0
East(config-router)# network 172.16.12.0 0.0.0.3 area 0
East(config-router)# exit

East(config)# exit
East# wr

No comments:

Post a Comment