Tunnel/transport

IPSec (Internet Protocol Security) supports two modes of operation: Tunnel Mode and Transport Mode. These modes determine how IPSec secures the data and apply to different scenarios based on the level of protection required.

Tunnel Mode

In Tunnel Mode, the entire original IP packet, including its header and payload, is encapsulated within a new IP packet. The new packet contains an additional IPSec header and trailer, which provide the necessary security services for the original packet.

Tunnel Mode is often used to create a secure virtual private network (VPN) between two gateways or routers. It is commonly employed in site-to-site VPNs, where multiple networks need to communicate securely over an untrusted network, such as the internet.

When using Tunnel Mode, the original source and destination IP addresses remain unchanged, but the new outer IP header will have different source and destination addresses corresponding to the IPSec gateways. This way, the original data is protected from eavesdropping and tampering while it traverses the untrusted network.

Transport Mode

In Transport Mode, only the data payload of the original IP packet is secured with IPSec. The original IP header is left intact, and the IPSec header is added after the IP header but before the data payload.

Transport Mode is often used for securing communication between individual hosts, rather than entire networks. It is commonly employed in end-to-end communication, such as securing data between a client and a server.

When using Transport Mode, the original IP addresses remain unchanged, and only the data payload is encrypted and authenticated. This mode is suitable for scenarios where individual hosts need secure communication without the complexity of creating a full VPN.

Comparison

Tunnel Mode Transport Mode
Scope Secures entire IP packet, including header and payload. Secures only the data payload of the IP packet.
Use Case Site-to-site VPNs, securing communication between networks. End-to-end communication between individual hosts.
IP Header Original IP header is encapsulated in a new IP packet. Original IP header remains intact.
Addressing New source and destination IP addresses in outer IP header. Original IP addresses remain unchanged.

Conclusion

Tunnel Mode and Transport Mode are two important modes of operation in IPSec, each serving specific use cases for securing data in different scenarios. While Tunnel Mode is suitable for securing communication between networks, Transport Mode is more appropriate for end-to-end communication between individual hosts. The choice between the two modes depends on the level of protection required and the specific networking requirements of the application.