Packet Lifecycle and Forwarding Process
Core Forwarding Principles
- Concept: The process of encapsulating, routing, and de-encapsulating data as it travels from a source device to a remote destination across multiple Layer 3 devices (routers).
- Details:
- Layer 3 (IP Addresses): The Source and Destination IP addresses never change from the original sender to the final receiver. They provide end-to-end delivery.
- Layer 2 (MAC Addresses): The Source and Destination MAC addresses change at every router hop. They provide hop-by-hop delivery.
- TTL (Time to Live): The IP header’s TTL decreases by 1 at each router hop.
- Checksum: The IP header checksum is recalculated at each router because the TTL changes.
Things to note: A router’s primary job is to strip the incoming Layer 2 header, evaluate the Layer 3 destination IP against its routing table, and attach a new Layer 2 header appropriate for the outgoing interface.
The ARP (Address Resolution Protocol) Process
- Concept: ARP is used to discover the Layer 2 MAC address of a known Layer 3 IPv4 address on the same local broadcast domain.
- Details:
- ARP Request: Sent as a Broadcast (Destination MAC:
FFFF.FFFF.FFFF). Asks “Who has [Target IP]? Tell [Sender IP]”. - ARP Reply: Sent as a Unicast directly back to the requester. Says “I am [Target IP], my MAC is [Target MAC]”.
- Devices cache ARP replies in their ARP table to avoid broadcasting for every packet.
- ARP Request: Sent as a Broadcast (Destination MAC:
! ARP Request Frame Structure
Destination MAC: FFFF.FFFF.FFFF (Broadcast)
Source MAC: [Sender MAC]
Destination IP: [Target IP]
Source IP: [Sender IP]
Message: "Who has [Target IP]? Tell [Sender IP]"
! ARP Reply Frame Structure
Destination MAC: [Original Sender MAC] (Unicast)
Source MAC: [Target MAC]
Destination IP: [Original Sender IP]
Source IP: [Target IP]
Message: "I am [Target IP], my MAC is [Target MAC]"
Things to note: When a host needs to send traffic to a remote network, it sends the frame to its Default Gateway’s MAC address, NOT the final destination’s MAC address. The IP destination remains the final remote host.
Router vs. Switch Processing
- Concept: Layer 2 switches and Layer 3 routers handle frames and packets fundamentally differently.
| Feature | Layer 2 Switch | Layer 3 Router |
|---|---|---|
| Primary Operation | Forwards frames based on Destination MAC | Routes packets based on Destination IP |
| Header Modification | Never modifies Source/Dest MAC or IP | Strips incoming L2 header, adds new L2 header |
| Broadcast Handling | Floods broadcasts out all ports (except receiving) | Blocks broadcasts by default (does not forward) |
| ARP Handling | Learns MAC addresses from incoming frames | Generates ARP requests/replies to find next-hop MACs |
| Domain Boundary | Separates Collision Domains | Separates Broadcast Domains |
Hop-by-Hop Packet Evolution
- Concept: Tracking the exact Source/Destination IP and MAC addresses as a packet traverses from PC1 to PC4.
- Details:
- PC1: 192.168.1.1 (MAC: 1111)
- R1: G0/2: 192.168.1.254 (MAC: AAAA) | G0/0: 192.168.12.1 (MAC: BBBB)
- R2: G0/0: 192.168.12.2 (MAC: CCCC) | G0/1: 192.168.24.2 (MAC: DDDD)
- R4: G0/1: 192.168.24.4 (MAC: EEEE) | G0/2: 192.168.4.254 (MAC: FFFE)
- PC4: 192.168.4.1 (MAC: 4444)
sequenceDiagram
participant PC1
participant SW1
participant R1
participant R2
participant R4
participant SW4
participant PC4
PC1->>SW1: ARP Request (Who has 192.168.1.254?)
SW1->>R1: Floods ARP Request
R1->>SW1: ARP Reply (I am 192.168.1.254, MAC AAAA)
SW1->>PC1: Forwards ARP Reply
PC1->>SW1: Data Packet (Src IP: 1.1, Dst IP: 4.1 | Src MAC: 1111, Dst MAC: AAAA)
SW1->>R1: Forwards Frame to R1
R1->>R1: De-encapsulates L2, Checks Routing Table
R1->>R2: ARP Request (Who has 192.168.12.2?)
R2->>R1: ARP Reply (I am 192.168.12.2, MAC CCCC)
R1->>R2: Data Packet (Src IP: 1.1, Dst IP: 4.1 | Src MAC: BBBB, Dst MAC: CCCC)
R2->>R2: De-encapsulates L2, Checks Routing Table
R2->>R4: ARP Request (Who has 192.168.24.4?)
R4->>R2: ARP Reply (I am 192.168.24.4, MAC EEEE)
R2->>R4: Data Packet (Src IP: 1.1, Dst IP: 4.1 | Src MAC: DDDD, Dst MAC: EEEE)
R4->>R4: De-encapsulates L2, Checks Routing Table
R4->>SW4: ARP Request (Who has 192.168.4.1?)
PC4->>R4: ARP Reply (I am 192.168.4.1, MAC 4444)
R4->>SW4: Data Packet (Src IP: 1.1, Dst IP: 4.1 | Src MAC: FFFE, Dst MAC: 4444)
SW4->>PC4: Forwards Frame to PC4
| Hop | Outgoing Interface | Source IP | Dest IP | Source MAC | Dest MAC |
|---|---|---|---|---|---|
| PC1 to R1 | PC1 NIC | 192.168.1.1 | 192.168.4.1 | 1111 | AAAA (R1 G0/2) |
| R1 to R2 | R1 G0/0 | 192.168.1.1 | 192.168.4.1 | BBBB (R1 G0/0) | CCCC (R2 G0/0) |
| R2 to R4 | R2 G0/1 | 192.168.1.1 | 192.168.4.1 | DDDD (R2 G0/1) | EEEE (R4 G0/1) |
| R4 to PC4 | R4 G0/2 | 192.168.1.1 | 192.168.4.1 | FFFE (R4 G0/2) | 4444 (PC4 NIC) |
Things to note: When PC4 replies to PC1, the process reverses. Because the ARP caches are already populated, the routers will not generate new ARP requests; they will simply de-encapsulate and re-encapsulate the frames using the cached MAC addresses.
Common Exam Misconceptions
- Concept: Exam questions frequently test your ability to identify specific MAC/IP addresses at a specific point in the network topology.
- Details:
- Misconception 1: “The destination MAC address is always the final destination device.”
- Correction: The destination MAC is always the MAC address of the next-hop device (e.g., the Default Gateway). It only equals the final destination’s MAC if they are on the same local subnet.
- Misconception 2: “Switches change the MAC addresses in the frame.”
- Correction: Switches are transparent to the payload. They forward the frame exactly as received, only reading the destination MAC to make a forwarding decision. They do not alter the Source or Destination MAC addresses.
- Misconception 3: “Routers forward broadcasts.”
- Correction: Routers drop Layer 2 broadcasts (like ARP requests). A broadcast from PC1 will never reach R2.
- Misconception 1: “The destination MAC address is always the final destination device.”
Relevant Commands
! View the ARP table (IP to MAC mappings)
Router# show arp
Router# show ip arp
! View the MAC address table on a switch (Learned MACs per port)
Switch# show mac address-table
! View the routing table (Used to determine the next-hop IP)
Router# show ip route
! View interface details including IP and burned-in MAC address
Router# show ip interface brief
Router# show interfaces gigabitEthernet 0/0
! Clear the ARP cache to force a new ARP request
Router# clear arp-cache