How Does Encapsulation Work?
Data travels from one place to another in the form of packets, and a packet has two parts, the first one is the header which consists of the destination address and the working protocol and the second thing is its contents.
In simple terminology, Encapsulation is the process of adding a new packet within the existing packet or a packet inside a packet. In an encapsulated packet, the header part of the first packet is remain surrounded by the payload section of the surrounding packet, which has actual contents.
Tunneling
A technique of inter-networking called Tunneling is used when source and destination networks of the same type are to be connected through a network of different types. Tunneling uses a layered protocol model such as those of the OSI or TCP/IP protocol suite.
So, in other words, when data moves from host A to B it covers all the different levels of the specified protocol (OSI, TCP/IP, etc.) while moving between different levels, data conversion (Encapsulation) to suit different interfaces of the particular layer is called tunneling.
For example, let us consider an Ethernet to be connected to another Ethernet through a WAN as:
The task is sent on an IP packet from host A of Ethernet-1 to host B of Ethernet-2 via a WAN.