Skip to content
Related Articles

Related Articles

Improve Article
Generic Routing Encapsulation (GRE) Tunnel
  • Last Updated : 12 Aug, 2020

Generic Routing Encapsulation is a method of encapsulation of IP packet in a GRE header which hides the original IP packet. Also a new header named delivery header is added above GRE header which contains new source and destination address.

GRE header act as new IP header with Delivery header containing new source and destination address. Only routers between which GRE is configured can decrypt and encrypt the GRE header. The original IP packet enters a router, travels in encrypted form and emerges out of another GRE configured router as original IP packet like they have travelled through a tunnel. Hence, this process is called GRE tunneling.

Routing Over GRE Tunnel :
The figure shown below is a part of any enterprise network. PC1 want to communicate with server. PC1 will send packets to server. Router R1 will forward the IP packet out of its Gi0/1 interface to R2’s Gi0/2 interface and packet will reach to its destination server(10.20.2.2). But When GRE is configured on the routers, then they use virtual interfaces called tunnel interfaces instead of normal router’s interface. This virtual interfaces uses new IP address other than originally configured router interface IP address. These new addresses are from company’s IP address pool list.


Figure – GRE Tunneling


After the GRE configuration on routers, when PC1 sends packet to server in subnet 10.20.2.0/24. The router R1 receive this IP packet, encapsulate the original IP packet in a GRE header, adds new tunnel interface IP address 10.40.20.1 as source address & 10.40.20.2 as destination address in Delivery header and sends it out of the tunnel interface (tunnel0).



GRE packet now travel through path in network defined by various routing protocols and reaches R2’s tunnel interface(tunnel 1). R2 upon receiving the GRE packet, decrypt the packet i.e, removes delivery and GRE header. R2 now forwards the IP packet according to original destination address to the server. Also IP routing table of GRE enabled router get changed and contains information as shown in figure.


Figure – GRE Tunneling


Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

 

My Personal Notes arrow_drop_up
Recommended Articles
Page :