4

Recently I realized that ICMP does not contain any ports, so I tried to Ping from my wireless connected laptop to public IPs(of course it worked!).

In a typical configuration, a local network uses one of the designated "private" IP address subnets (RFC 1918). A router on that network has a private address in that address space. The router is also connected to the Internet with a "public" address assigned by an Internet service provider. As traffic passes from the local network to the Internet, the source address in each packet is translated on the fly from a private address to the public address. The router tracks basic data about each active connection (particularly the destination address and port).

Does my router have a special space for the ICMP packets?

ICMP HEADER

It only has 4 fields: "type", "code", "checksum" and "data". Only adding extra data seems a feasible solution. Please provide sources when answering as I couldn't find them. Thank you for your time:)

2 Answers 2

1

The missing piece of information here is the Identifier (aka. query ID) which lives in the 8-byte ICMP header - see https://en.wikipedia.org/wiki/Ping_(networking_utility)#Echo_request. When multiple inside hosts ping the same outside host simultaneously they will most likely do so with different query IDs.

This is used in place of a TCP/UDP port number in the NAT table of the router so that replies coming back can be matched to the initial request and sent back to the correct inside host (as well as the usual matching based on the outside global address).

See also https://www.rfc-editor.org/rfc/rfc5508#section-3.1

0

Your router translates your internal address into its outside address. The packet is sent into the Internet with the outside address as the source address in the ICMP packet.

Responses are sent from the other system back to the outside address of the router. The packet is again rewritten to get it forwarded in into the internal address.

Depending on your router, especially personal/home vs business/enterprise it can use several ways to keep track of which internal system sent the original ICMP ping. It can just keep a list of outbound ICMP packets and match, it can use multiple outside addresses, one for each internal address, etc.

Look into "stateful NAT" for your router to get more details.

1
  • So what happens when two different IP behind the same NAT send Ping requests to the same dst about the same time? I understand that it is still possible to keep track of them, but is there a widely used method? Dec 19, 2015 at 20:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .