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.

Given a NAT where multiple PCs are sharing one IP address, how is NAT able to know where to send the incoming data to. Does it translate th SYN-ACK ids?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

When a device connects to a server on the other side of the router, it uses a source port in its ephemeral port range. This is typically a port between 49152 and 65535 and it is randomly assigned. The NAT router records this port number as well as the destination IP address in a NAT translation table. When data starts coming back in from the server, it looks up where it goes from this table.

share|improve this answer
    
So it translates the source port.. and later looks up the translation to get back to the correct private IP and source port. Is this correct? –  George Bailey Dec 29 '10 at 16:57
    
It translates the IP address. Some devices might translate the source port as well. The important thing to note is that it has a table of these source ports that it uses to reverse translation on return packets. –  Jason Berg Dec 29 '10 at 16:59

Given a NAT where multiple PCs are sharing one IP address, how is NAT able to know where to send the incoming data.

By not being programmed with alheimer as model. Basically it has a memory - about which internal ports / ip addresses map to whiche external target port / ip, so it can do the translation. For TCP that is simple, for UDP the internal program better regularly sends packets outside (so that NAT refreshes the routing table).

Does it translate th SYN-ACK ids?

No, proper NAT is not following the TCP protocol. THis is to make sure that TCP does not work.

Joke aside - NATURALLY it has to do translations when needed, otherwise it would break the implementation. NAT has to be trnasparent, so it has to make all translations necessary.

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.