Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Does a TCP packet change source ip when it goes through your router?

  1. Feb 26, 2014 #1
    I was wondering, every time I send or receive a TCP packet with an IP header, my local ip, ie. 192.168.1.x is displayed as the source or destination, respectively. Does this get changed as soon as the packet passes through my router, so the source/destination is listed as my external IP address?
  2. jcsd
  3. Feb 27, 2014 #2
    Small correction: Your external IP address is on the body, never on the header. IPs on the header are to communicate between local applications. Whether that header IP gets dropped in the computer or on the router, I don't know (which is basically what you asked). :( Maybe someone could provide some more insight.
  4. Feb 28, 2014 #3
    Your "router" is not just a "router" in the original meaning of the word. It is also a "network address translation" (NAT) unit.

    Pure routers do not change IP addresses. They just pass the IP packet to whatever physical network is likely to transport it to its destination.

    NATs do change addresses. That is why they exist. They map multiple "internal network addresses" to a single (sometimes also multiple) "external network address".
  5. Feb 28, 2014 #4


    User Avatar
    Homework Helper

    This depends on how your modem router function is configured. Typically the devices connected to a modem get an internal local IP and the router funcion of the modem converts these to an external IP with port numbers that vary depending on the local IP's so that it knows which external packets belong to which internal local IP. The alternative is the router function of the modem assigns an external IP to the devices connected to the modem, essentially converting the in home lan into an extension of the internet. From what I've read, all cable modems can do this for at least 16 external ips, but the internet service providers limit this, for example my ISP only allows 3 external ips for a home account. The home dsl modems that do this typically provide 8 static external ip's but use 3 of these, allowing up to 5 connected devices to have independent external ip's. Note that one or more of those connected devices could be standard routers, which would be assigned external ip's and in turn assign local ip's to the devices connnected to the router.

    Getting back to the original question, if the modem assigns external ips to devices connected to the modem, then the modem acts like a bridge and does not change packet ip information.

    Side note, in the case of a cable modem, if it's disconnected from the coax cable (or the cable service isn't working), it then assigns local ip's, and the home network will behave as a lan. I don't know if a dsl modem does the same thing if disconnected from the phone line.
    Last edited: Feb 28, 2014
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook