PROJECTENGRAM

ADDRESSING AND FORWARDING

Addressing and Forwarding

Tags: #◇CSNETWK #◇Computer Science #◇Computer Networks #◇Networking Protocols #◇Graph Theory Basics


◇Overview

The Golden Rule of Forwarding

◇Key Concepts

IP Addresses (Network Layer) MAC Addresses (Link Layer) Sender Receiver Path

◇Details / Theory

◇1. Concept Overview: MAC vs. IP

The Golden Rule of Forwarding
IP Addresses (Network Layer): act like the "Final Destination" on a letter. They NEVER CHANGE from source to destination (ignoring NAT). MAC Addresses (Link Layer): act like the "Next Hop" ticket. They CHANGE at every router. The source MAC is always the device sending the frame onto the wire, and the destination MAC is the device receiving it on that specific wire.

The Journey

When a packet travels from Host A to Host B through a Router:

  1. Hop 1 (A →\rightarrow Router): Src=MAC_A, Dest=MAC_Router.
  2. Hop 2 (Router →\rightarrow B): Src=MAC_Router, Dest=MAC_B.
  3. IP Address: Always Src=IP_A, Dest=IP_B.

◇2. The Network Topology

Scenario Data
!◇Pasted image 20251121094215.png
Sender: Node C (128.119.156.36, MAC E3...) Receiver: Node A (128.119.184.242, MAC 35...) Path: C →\rightarrow Router (Right) →\rightarrow Router (Center) →\rightarrow Router (Left) →\rightarrow A.

◇3. Problem Analysis

Point 6 (Node C →\rightarrow First Router)

Context: The packet is leaving the source computer (C) and heading to its default gateway (the router interface).

1/2. MAC Addresses (Link Layer)
Source MAC: The device sending the frame. →\rightarrow Node C (E3-A8...) Destination MAC: The interface of the router receiving it. →\rightarrow Router Interface 6 (81-D8...)

3/4. IP Addresses (Network Layer)
Source IP: The original sender. →\rightarrow Node C (128.119.156.36) Destination IP: The final target. →\rightarrow Node A (128.119.184.242)

Point 4 (Between Routers)

5. Do the source and destination MAC addresses change at point 4?
Analysis: Point 4 represents a new physical link (wire). The router at Point 6 stripped the old Link Layer header and built a new one to send to the next router. Correct Answer: Yes (The previous MACs were for the C-Router link; the new MACs are for the Router-Router link).

Point 2 (Last Router →\rightarrow Node A)

Context: The final router is delivering the packet to the destination computer.

6. Do the source and destination MAC addresses change at point 2?
Analysis: Yes. The router is now the sender (Link Layer), and Node A is the receiver.

7/8. MAC Addresses
Source MAC: The router interface sending the frame. →\rightarrow Router Interface 2 (52-19...) Destination MAC: The final computer's NIC. →\rightarrow Node A (35-14...)

Point 1 (Node A's Network Card)

9. Do the source and destination MAC addresses change at point 1?
Analysis: Point 1 and Point 2 are on the same wire (the same subnet). A frame does not change mid-wire. Correct Answer: No

◇Summary of Logic (Cheat Sheet)

LayerAddress TypeBehavior
NetworkIP AddressConstant (Start to Finish)
LinkMAC AddressChanges Every Hop (Router to Router)

◇Common Pitfalls

Thinking IP addresses change at each hop — IP stays constant end-to-end; only MAC addresses change per hop. Confusing the source/destination MAC at a given hop with the original sender/receiver. Forgetting that routers replace MAC headers at each hop using ARP to resolve the next-hop MAC.

◇Summary

TL;DR — The "golden rule": IP addresses remain constant from source to destination, while MAC addresses change at every router hop. Routers use ARP to find the next-hop MAC and rewrite the link-layer header accordingly.

Related: - ◇Pasted image 20251121094215.png Source / Reference:

◇References & Navigation

CONFIRMATION // 理解度の確認

ACTIVE RECALL VERIFICATION

Select an answer to verify conceptual comprehension and reveal the technical rationale.

Q1

How do Layer-2 MAC (Link-Layer) addresses and Layer-3 IP (Network-Layer) addresses differ in structure, mutability, and purpose?

Q2

As an IP datagram travels from Host AA (on Subnet 1) through Router RR to Host BB (on Subnet 2), what happens to the Source/Destination IP addresses vs. the Source/Destination MAC addresses when the packet passes through Router RR (assuming no NAT)?

Q3

What is the role of the Address Resolution Protocol (ARP) when Host AA on a LAN knows the target IP address IPXIP_X on the same subnet but does not know its Layer-2 MAC address?

Q4

When Host AA (192.168.1.10/24) wants to send an IP packet to a remote server BB (8.8.8.8) located on a different subnet, which IP address does Host AA query via ARP to put in the Ethernet frame's Destination MAC field?

Q5

Why are entries in a host's ARP Cache (ARP Table) assigned a Time-To-Live (typically ~20 minutes) rather than being stored permanently?