Skip to contentSkip to conversation

NAT question

DISCUSSION Kiran Kumar Immidi 3 participants 3 messages Jun 30, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,
When packets are being masqueraded from multiple machines through a NAT box,
how would the response be identified as part of a particular connection. So, if we have (identical, as regards port numbers and dest ip address) packets from A and B snatted at C, how is the reply (to C) identified as belonging to either A or B? There does not seem to be any information in the packet to distinguish it. Regards,
Kiran Kumar Immidi

---- Cool Things Happen When Mac Users Meet! Join the community in Boston this July: www.macworldexpo.com

#1 lore raw
Quoted 2 lines · Kiran Kumar Immidi

When packets are being masqueraded from multiple machines through a NAT box, how would the response be identified as part of a particular connection.

By it's ip:port tuple (both source and destination).

Quoted 3 lines

So, if we have (identical, as regards port numbers and dest ip address) packets from A and B snatted at C, how is the reply (to C) identified as belonging to either A or B?

By which port on C the reply traffic is addressed to.

The NAT engine always guarantees that at least one field in the address tuple (source ip,port destination ip,port) is different as required to correctly identify individual connections for all involved.

Regards
Henrk

#2 lore raw
In reply to Kiran Kumar Immidi

If A and B send packets to a server, say google.com:80 using the local port 10000, when the pkts get SNATed on C, the source ports would be different from 10000 (21000 and 32000 for example) and when google.com sends back the packets to those new port numbers, conntrack would change the dst-port numbers to 10000 along with the dst-ip address.

Regards,
Vijaya Chandra Vupputuri,
Tachyon Technologies.

Quoted 12 lines · Kiran Kumar Immidi

Hi,
When packets are being masqueraded from multiple machines through a NAT box,
how would the response be identified as part of a particular connection. So, if we have (identical, as regards port numbers and dest ip address) packets from A and B snatted at C, how is the reply (to C) identified as belonging to either A or B? There does not seem to be any information in the packet to distinguish it. Regards,
Kiran Kumar Immidi

---- Cool Things Happen When Mac Users Meet! Join the community in Boston this July: www.macworldexpo.com