Generic Routing Encapsulation (GRE) is a routing protocol developed by Cisco Systems in 1994 that allows a wide range of network-layer protocols to be contained inside virtual point-to-point or point-tomultipoint links over an Internet Protocol network. Protocol encapsulation, not GRE specifically, breaks the layering sequence, according to the OSI principles of protocol layering.
GRE can be thought of as a barrier between two protocol stacks, one of which serves as a carrier for the other. IP protocol type 47 is used for GRE packets enclosed within IP. It is a tunnelling protocol and is defined by RFC 2784. GRE provides both stateless and private connection.
GRE establishes a secure, stateless connection. The protocol establishes a connection that is comparable to that of a Virtual Private Network (VPN). Over an IP network, it can carry any OSI layer three protocol.
GRE establishes a tunnel between two routers over the Internet to allow communication between two hosts of different private networks. With the help of Virtual Tunnel Interface, the GRE connection endpoints can be terminated.
GRE creates a private way for packets to travel through an otherwise public network by encapsulating or tunnelling the packets. Tunnel endpoints that encapsulate or de-encapsulate the traffic are used in GRE tunnelling.
Encapsulating packets within other packets is known as tunnelling. GRE tunnels are often set up between two routers, with each router acting as the tunnel's end. The routers are configured to send and receive GRE packets directly.
Within an outer IP packet, GRE encapsulates a payload, an inner packet that must be transferred to a target network. GRE tunnel endpoints route encapsulated packets via intervening IP networks to convey payloads across GRE tunnels. GRE tunnels are used to connect different subnetworks.
Some of the advantages of using GRE are listed below −
IPv4 broadcast and multicast traffic can be encapsulated using the GRE protocol.
IPv6 is also supported.
It's a straightforward and adaptable protocol.
Numerous protocols are encapsulated in a single GRE tunnel.
It can connect multiple discontinuous sub-networks and is easy to debug.
The drawbacks of using GRE are as follows −
It does not provide a data encryption facility, and it needs to be integrated with other security protocols to provide network security.
Defining GRE tunnels is a laborious process, hence it is less scalable.
There are quite a few protocols available for data transfer via a secure network. Protocols were created for a reason, and they're getting better all the time. Whether it's greater security or ease of use and configuration, we always have various aspects to consider when picking the optimal protocol for a network.