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

Click For Summary

Discussion Overview

The discussion revolves around whether a TCP packet's source IP address changes when it passes through a router, particularly focusing on the role of network address translation (NAT) and the configuration of modem routers. The scope includes technical explanations and conceptual clarifications regarding IP addressing in networking.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant questions whether the source IP address displayed in TCP packets changes to the external IP address when passing through a router.
  • Another participant corrects that the external IP address is not included in the packet header but rather in the body, expressing uncertainty about where the header IP is modified.
  • A third participant explains that routers typically do not change IP addresses, while NAT units do, as they map multiple internal addresses to a single external address.
  • Another contribution discusses the configuration of modem routers, noting that they can assign internal local IPs and convert them to an external IP, or assign external IPs directly to connected devices, affecting how packets are processed.
  • This participant also mentions that the behavior of the modem can change based on its connection status, affecting IP assignment and network behavior.

Areas of Agreement / Disagreement

Participants express differing views on how IP addresses are handled by routers and NAT devices, indicating that there is no consensus on the specifics of IP address changes during packet transmission.

Contextual Notes

There are limitations regarding the assumptions made about router configurations and the specific behaviors of different types of modems, which remain unresolved in the discussion.

saminator910
Messages
95
Reaction score
2
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?
 
Technology news on Phys.org
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.
 
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".
 
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:

Similar threads

  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 9 ·
Replies
9
Views
6K
  • · Replies 8 ·
Replies
8
Views
12K
  • · Replies 152 ·
6
Replies
152
Views
11K
  • · Replies 23 ·
Replies
23
Views
4K
Replies
3
Views
5K
  • · Replies 29 ·
Replies
29
Views
6K
  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K