Skip to contentSkip to conversation

NAT question

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

lore
Share & tools
lore
#0 lore raw

Regards,
Kiran Kumar Immidi

On Wed, 30 Jun 2004 17:56 , Vijaya Chandra Vupputuri <[email protected]> sent:

Quoted 5 lines

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.

  Oh yes, this answers my question. But how about ICMP which does not have a concept of port? I have asked this in another mail.

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

#1 lore raw

I have just grepped for icmp in /proc/net/ip_conntrack while pinging the same box from two systems

icmp 1 29 src=192.168.1.80 dst=172.16.0.102 type=8 code=0 id=62829
src=172.16.0.102 dst=172.16.0.100 type=0 code=0 id=62829 use=1
icmp 1 29 src=192.168.1.180 dst=172.16.0.102 type=8 code=0 id=38527
src=172.16.0.102 dst=172.16.0.100 type=0 code=0 id=38527 use=1

The 'identifier' of the ICMP msg seems to be the key that is being used for guessing the actual source while handling the response. No idea as to what would happen if both the systems decide to use the same identifier though.

The ICMP RFC says
The identifier and sequence number may be used by the echo sender to aid in matching the replies with the echo requests. For example, the identifier might be used like a port in TCP or UDP to identify a session, and the sequence number might be incremented on each echo request sent. The echoer returns these same values in the echo reply.

I guess conntrack would change the id just like it does with the tcp/udp ports in case of a clash to identify the correct destination while handling the response.

Regards,
Vijay.

Quoted 24 lines · Kiran Kumar Immidi

Regards,
Kiran Kumar Immidi

On Wed, 30 Jun 2004 17:56 , Vijaya Chandra Vupputuri <[email protected]> sent:

Quoted 1 line

If A and B send packets to a server, say google.com:80 using the

local

Quoted 2 lines

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

Quoted 1 line

sends back the packets to those new port numbers, conntrack would

change

Quoted 1 line

the dst-port numbers to 10000 along with the dst-ip address.

Oh yes, this answers my question. But how about ICMP which does not
have a concept of port?
I have asked this in another mail.

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