How does Linux NAT a ping?

In this web content, the author explores how Network Address Translation (NAT) works for Internet Control Message Protocol (ICMP) packets in private networks. The author conducts experiments using network namespaces and captures packets to understand the process. They provide a step-by-step experiment setup, including creating network namespaces, configuring routing and NAT, and capturing packet data. The author also delves into the source code for the ping command to understand how ICMP IDs are chosen. In one experiment, they test for ID conflicts and find that the Linux kernel chooses a free port at random when ping does not specify a source port.

To top