Encapsulation and tunneling
Encapsulation is a general mechanism in data communications in which one protocol datagram is carried by another. Although this is the standard way in which packets are carried, one over the other, for example, TP over IP, HTTP over TCP, and more, there are cases in which packets in one layer are carried over packets in the same layer or packets are encapsulated for encryption. Using encapsulation to hide the internal header inside an external header can also be used for bypassing network defenses, as we will see in Chapter 6, Finding Network-Based Attacks.
In Figure 2.30, we can view a simple example of encapsulation. Here, we have two LANs connected via a tunnel that is configured between R1 and R3. The PCs on the two sides have the addresses of 172.12.1.10/24
and 172.16.2.10/24
. The tunnel interface on R1 is configured with the address of 20.1.1.1/24
, and the end of the tunnel is configured on R3 with the address of 172.21.1.1/24
: