0

Imagine an IPv4 packet routed like this:

A -> Router1 -> Router2 -> B

When constructing a packet per the structure, it seems A will have to include both source address (A) and destination address (B). I understand that when traveling between the middlemen Router1 and Router2, the packet must contain both source and destination address to preserve context.

However, I see two possible assumptions that can be made here:

  1. When Router1 receives a packet from A, it knows it's from A without having to look at the source IP address because there is an exclusive network interface between Router1 and A (such as a physical ethernet cable). Therefore, A can send packets without the source address to Router1 and Router1 can insert that context before routing further along.

  2. When B receives a packet from Router2, B knows the final destination is itself without having to look at the destination address to confirm because B is not a router. Therefore, Router2 can send packets without the destination address to B.

Is my understanding correct about these assumptions? If so, it seems like we could save 4 bytes of overhead per packet on each side of the trip by omitting the redundant address. Are there any downsides to doing that?

1 Answer 1

1

A source IP address is always required in a transmitted packet, by specification.

When Router1 receives a packet from A, it knows it's from A without having to look at the source IP address because there is an exclusive network interface between Router1 and A.

Router1 can make no such assumption, even on a point-to-point network link (with Ethernet generally isn't), since A could just as well be another router forwarding packets from elsewhere.

When B receives a packet from Router2, B knows the final destination is itself without having to look at the destination address to confirm because B is not a router.

B could use multiple bound IP addresses on the interface facing Router2, have a loopback interface, or the packet could be addressed with a multicast address, so B always needs to read the destination address in any case. Router2 cannot make the assumption that packets destined for B don't require destination addresses either, as it doesn't know the nature of B.

Also, removing destination addresses or adding source addresses along the path would require additional, non-trivial processing by the routers. By design, IP very much simplifies the constructive requirements for its infrastructure. Routers are expressly stateless to make them simple and efficient, which wouldn't be possible if they'd needed to 'optimize' addressing like you describe - for a mere four octets (or even 16 for IPv6).

Changing packet format would also require support for different packet types, further complicating things.

3
  • Thank you for the answer. Re. "since A could just as well be another router forwarding packets from elsewhere", is there any way A indicates to Router1 that A is a router prior to this? Otherwise, I imagine A routing a packet from source address C would be indistinguishable from A attempting to spoof as source address C. Is that correct? May 14 at 2:31
  • Indistinguishable by the router / router's egress filter at the IP level I mean, since TCP of course includes the ACK flow to prevent IP spoofing. May 14 at 2:33
  • 1
    is there any way A indicates to Router1 that A is a router prior to this? - no, there isn't. Spoofing is always possible with IP, whether a source address is implied or included. You might argue that omitted and implied is more secure but with the same logic an expressly included source could be checked as well (without the absolute need to do so, which an implied address would always require).
    – Zac67
    May 14 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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