-4

I went to the site http://www.whatismyip.com . It showed a ip that is not my system's ip and it also showed the proxy server's ip address. So I assumed that the nat router is providing a public ip for my system.
But when I went to the same site from another pc in the same lan. It showed the same ip address again.
              So it must be overloading nat right? But overloading nat assigns a unique port number to your machine(since the ip address is the same for all the machines in that lan). But http://www.whatismyip.com does not show the port number. Why is that so?

2
  • That is the source port of the TCP connection your router makes to their web server. It won't mean anything though. The router will use a different source port each time regardless of which client initiated the connection. (And it will, of course, eventually reuse them.) May 1, 2012 at 11:45
  • @JDavidSchwartz : Still it is using that port number to identify machine and forward the reply to my machine right? A unique port is assigned for each unique connection, not per host behind the NAT.Even though the port changes for each connection but for that particular connection that port number uniquely identifies my machine right?
    – Ashwin
    May 2, 2012 at 1:03

2 Answers 2

6

But whatismyip.com does not show the port number. Why is that so?

A unique port is assigned for each unique connection, not per host behind the NAT.

A NAT must be able to figure out not only what IP address to return a packet to, but also what port.

The NAT table has to have more information to re-write packets in both directions

  • destination IP
  • destination port
  • external source IP (assigned by NAT)
  • external source port (assigned by NAT)
  • internal source IP
  • internal source port

When a reply returns from an external host, the NAT will lookup the correct internal source IP and port based on the external source IP and Port that was assigned to the connection.

The port used by the actual host behind the NAT has nothing to do with the port selected and used by the NAT.

11
  • Thanks for that(A unique port is assigned for each unique connection, not per host behind the NAT ). But still the nat router should forward the port number to the server right? Otherwise how will the server reply(the server only has the ip address and in overloading nat all the internal systems have the same ip address and are differentiated by the port number.)
    – Ashwin
    Apr 30, 2012 at 6:25
  • Sorry, but you are using the word 'server' here, what are you referring to? The external host that is accessed? The socket has to have all 4 elements IPs and ports for the external host to be able to reply.
    – Zoredache
    Apr 30, 2012 at 6:39
  • yes the external host that is accessed. The server replies to the "external source ip" and the "external source port" right? That means it has the "external source port" with it. Then why is whatismyip.com (server) not showing the that port.
    – Ashwin
    Apr 30, 2012 at 6:41
  • 2
    @Ashwin: Neither. The NAT router has a public IP and most likely, it's the only device that has a public IP. Every connection it makes uses that same IP address as its source and from the outside, there is no way to tell which machine inside the LAN it came from. The NAT router is the only device that knows that, or needs to know it. Apr 30, 2012 at 8:03
  • 1
    @Ashwin: You obviously don't understand how NAT works. Please read something about it, maybe starting with en.wikipedia.org/wiki/Network_address_translation
    – Sven
    Apr 30, 2012 at 8:04
4

So it must be overloading nat right? But overloading nat assigns a unique port number to your machine(since the ip address is the same for all the machines in that lan). But http://www.whatismyip.com does not show the port number. Why is that so?

Simple. Because the web application at http://www.whatismyip.com does not keep track of ports. It sends the communication back on the outbound port that the original communication came in on, and your firewall manages that NATing. I'm sure the http://www.whatismyip.com app could be told to display the port if the developers wanted it to, but they did not implement that as a feature.

2
  • are you sure about that. I am asking this because I have a proxy server which has a local ipaddress. So I also have a doubt that the nat router is providing a public ip address to the proxy and no to my machine. Can this happen?
    – Ashwin
    Apr 30, 2012 at 6:55
  • 5
    @Ashwin I'm sure of a few things in this life, and one of them is that you need to spend much more time learning TCP/IP networking.
    – Wesley
    Apr 30, 2012 at 7:18

Not the answer you're looking for? Browse other questions tagged .