Nat – How does NAT work with incoming UDP packets from unknown IP

nat;udp

Apologies in advance for the relatively noob question and if this is off topic here ( I am not sure…)

The situation is that I have a UDP client and server bound to the same port.

My understanding of NAT is that UDP packets going out from the client to a specific endpoint will result in a temporary entry into the NAT table mapping the source port to the destination endpoint. (Is this right?)

Does this also mean that if an as-yet-unknown endpoint initiates a UDP communication with my server to that same port that the UDP packet will get through? Is there any reason why NAT would prevent this? Does NAT even figure in blocking/allowing these incoming packets?

Best Answer

The usual NAT works by creating mappings for each pair of communicating hosts as a 5-tuple of (protocol, inside address, inside port, outside address, outside port). Normally this entry is added to the table by the first outgoing packet.

If the as-yet-unknown outside host sends a UDP packet, there will be no entry in the table for it, and thus the NAT device will normally discard it, depending on its capabilities and configuration.

This kind of NAT is normally called "overload NAT" or "port address translation" to distinguish it from other varieties. A good description is http://www.ciscozine.com/nat-and-pat-a-complete-explanation/

If you want to accept incoming packets on your sever, you will need to set up a static entry on the NAT device for that server on that port. Effectively this says entries can be added to the NAT table by incoming packets.

The details are device and software dependent.

Related Topic