Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to figure out how packets work on a network to better understand networking. I've read a few introductions so far.

I'm trying to understand what happens to a packet when it passes through a router. Is the Source Host changed to the Router IP before it gets forwarded on to the next hop? Is there anything else that changes in the packet?

share|improve this question

3 Answers 3

Per default, the IP source stays the same from source till target. Otherwise, the target would now know how (where) to reply.

"A packet" of information consist of several layers of protocols.
The typical jobs of a router are (in this order):

  • strip the outer physical and link layers of "a packet"
  • examine the network layer information
  • determine which NIF is associated with the IP address of "the packet"
  • modify (or re-apply) link and physical layer info so it fits the next hop
  • send the packet forward.
share|improve this answer

Routers forward packets between subnets.

Forwarding means accepting a packet from one interface, and shipping out the same exact packet from a different interface. Both interfaces must be within different subnets. Corollary: a router by definition has two network interfaces.

In the plain vanilla case nothing changes in the packet except the TTL (ipv4) or Hop Limit (ipv6) is decremented, and the router tosses the packet if 0.

Obviously the router is well positioned for a packet filter, firewall, etc. to modify outgoing or incoming traffic but such functions are not forwarding/routing per se.

The source IP is not changed unless network address translation is being used, as is the case with most consumer and many business network routers. With NAT, the source IP becomes the router's IP, and router needs to remember that anything coming back from that packet's destination address is really meant for the original system that sent it.

share|improve this answer

In general the source IP address doesn't change, only the data link layer addresses change (e.g. the source MAC address). However there are some situations when the source IP address is "changed" and those are:

In all of the above the IP address (source, destination or both) are physically changed, but the router tracks the connection and changes the pre-changed IP address back when the traffic comes back into the traffic source.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.