Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

NAT uses an IP address port number combination to hash the outgoing requests. Since ping requests consist of ICMP echo request packets, they do not have any associated port number. How does a NAT server forward the replies to the hosts inside the network?

share|improve this question
RFC 5508 – dbasnett May 9 '10 at 23:46
up vote 20 down vote accepted

For ICMP query/reply type messages like Echoes (pings), NAPT uses the ICMP Query ID (sometimes just called the ICMP ID) the same way it would use a TCP or UDP port number.

For ICMP error messages such as Destination Unreachable, it uses the ICMP packet's internal copy of the headers of the frame that caused the error to figure out which mapping in the NAT table to use to translate it.

These procedures are referenced briefly in several NAT-related RFCs, but I had a hard time finding one that explicitly spelled out the procedure. See "Traditional NAT", RFC3022, section 4.1.

This doesn't conflict with any TCP or UDP mapping because in a good NAPT implementation, the protocol is one of the pieces of information held in the NAT table entry to make it unique.

share|improve this answer
can you cite it from somewhere. – Rohit Banga Apr 27 '10 at 9:33
what if ICMP id clashes with a port number that my process is using. – Rohit Banga Apr 27 '10 at 9:34
@iamrohitbanga OK I expanded my answer to cover your further questions. – Spiff Apr 27 '10 at 15:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.