Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Host A (10.0.0.1) is connecting to 2 servers (TCP and UDP) on host B (130.129.123.2) both running on port 53. How does a traditional NAT handle this?

share|improve this question
    
You mean 10.x is the server and the external is coming into it? And is this an actual issue you're trying to understand or is it a hypothetical homework-type question? –  Bart Silverstrim May 22 '12 at 17:28

3 Answers 3

A NAT rule mapping 10.0.0.1 tcp/53 to 192.0.2.1 tcp/53 is unrelated to a rule mapping 10.0.0.1 udp/53 to 192.0.2.1 udp/53.

So you can have the same numerical value for a port using different IP protocols result in two different translations, if you want.

share|improve this answer

Static NAT – Mapping an unregistered IP address to a registered IP address on a one-to-one basis. Particularly useful when a device needs to be accessible from outside the network.

ex: In static NAT, the computer with the IP address of 192.168.32.10 will always translate to 213.18.123.110

Dynamic NAT – Maps an unregistered IP address to a registered IP address from a group of registered IP addresses. Dynamic NAT also establishes a one-to-one mapping between unregistered and registered IP address, but the mapping could vary depending on the registered address available in the pool, at the time of communication.

ex: In dynamic NAT, the computer with the IP address of 192.168.32.10 will translate to the first available address in the range from 213.18.123.100 to 213.18.123.150

Is that what you are asking?

share|improve this answer

Host A will select some random high (<1024) port, and connect to B. NAT box (usually a router) will change the source IP(of box A) to a public IP it owns (and if the outgoing port is used, it will also change the port number), and remember the change. When B recieves packet, it answers back with a packet to a public IP assigned to the router (where the packet seems to have come from because of the NAT). The router will then check the NAT table, and notice the translation it has done before, and reverse it (change the destination IP to IP(of box A), and also the port, if it has done this before), and send it to box A.

With tcp, it can forget the nat table entry after TCP FIN/RST/..., or it waits for a timeout. With UDP it just waits for a timeout (after no packets come either way on this IP/port combo).

share|improve this answer

Your Answer

 
discard

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.