Life of a Packet

Review

Network Topology

PC1 wants to send some data to PC4 and is encapsulated in the IP header.

Each interface on a network device has a unique MAC address (including switches).

PC1 -> R1

  • PC1 recognizes that PC4's IP address is in a different network and it knows that it needs to send the packet to its default gateway, R1 (pre-configured the default gateway).

  • PC1 has not sent any traffic yet, so it needs to use ARP.

  • ARP request packet is sent, which SW1 receives and broadcasts out of all its interfaces, except the one it received from.

  • The ARP Request frame: Source IP - PC1's IP Destination IP - Default gateway's IP Destination MAC - broadcast MAC (because it doesn't know the MAC address of R1). Source MAC - PC1's MAC (In IPv4 header, Source IP comes first, but in Ethernet header, Destination MAC address comes first)

  • (extra) SW1 learns PC1's MAC address on its g0/1 interface when the ARP Request frame arrives on it.

  • When the broadcast frame arrives on R1, it notices that the destination IP is its own IP, so it creates the ARP reply frame to send back to PC1, which is unicast.

  • The ARP reply frame: Source IP - R1's IP Destination IP - PC1's IP Destination MAC - PC1's MAC Source MAC - R1's MAC

  • (extra) SW1 learns R1's MAC address on its g0/0 interface when the ARP Reply frame arrives on it.

  • Now the PC1 knows the MAC address of its Default Gateway, so it encapsulates this packet (the original data to be sent) with a Ethernet header.

  • NOTE: The destination IP of the original packet is still PC4's IP (not R1's IP). Only at Layer2 is the destination MAC is set to R1's MAC address.

R1 -> R2

  • R1 receives the frame and removes the Ethernet header.

  • It looks up the destination IP in its routing table. The most specific match would be the entry which has the destinaiton IP of PC4's network and the Next hop IP as R2's IP.

  • So R1 would have to encapsulate the packet with an Ethernet frame with appropriate MAC address for R2.

  • Since R1 doesn't know R2's MAC address yet, it uses ARP.

  • The ARP Request frame: Source IP - R1's IP Destination IP - R2's IP Destination MAC - broadcast MAC (all Fs) Source MAC - R1 g0/0's MAC.

  • R2 receives the ARP request and since the destination IP address matches its own, it sends the ARP reply (unicast).

  • The ARP reply frame: Source IP - R2's IP Destination IP - R1's IP Destination MAC - R1's MAC Source MAC - R2's MAC

  • Now R1 knows R2's MAC address, so it can encapsulate the PC1's packet with an Ethernet header, inserting R2's MAC address in the destination field and R1 g0/0's MAC address in the source field and sends it to R2.

R2 -> R4

  • After receiving the frame, R2 removes the Ethernet header.

  • R2 then looks up destination IP address in its routing table. The most specific is the one with destination IP as PC4's network and next hop as R3's IP.

  • Although R2 and R4 are connected through a network, R2 doesn't know the MAC address of R4.

  • R2 uses ARP to discover R4's MAC address.

  • The ARP Request frame: Source IP - R2's IP Destination IP - R4's IP Destination MAC - broadcast MAC (all Fs) Source MAC - R2 g0/1's MAC.

  • R4 receives the ARP broadcast and since the destination IP address is its own, it creates this ARP reply frame (unicast) to send back to R2.

  • The ARP reply frame: Source IP - R4's IP Destination IP - R2's IP Destination MAC - R2's MAC Source MAC - R4's MAC

  • Now that R2 knows R4's MAC address, it encapsulates PC1's packet with an Ethernet header, with destination MAC address of R4's (g0/1 interface) and a source MAC address of R2's (g0/1 interface).

R4 to PC4

  • R4 receives the frame and removes the Ethernet header.

  • It looks for the destination IP in its routing table and the most specific match is PC4's network, directly connected via the g0/2 interface.

  • R4 does not know PC4's MAC address yet, so it uses ARP to learn PC4's MAC address.

  • The ARP Request frame: Source IP - R4's IP Destination IP - PC4's IP Destination MAC - broadcast MAC (all Fs) Source MAC - R4 g0/2's MAC.

  • (extra) SW4 will learn R4's MAC address on its g0/0 interface from the source MAC address field of this ethernet frame (ARP request).

  • After PC4 receives the frame, it checks the destination IP address. SInce it is its own IP, it will send an ARP reply.

  • The ARP reply frame: Source IP - PC4's IP Destination IP - R4's IP Destination MAC - R4's MAC Source MAC - PC4's MAC

  • (extra) SW4 will learn PC4's MAC address when ARP reply arrives on its g0/1 interface.

  • Now that R4 knows PC4's MAC address, it adds an ethernet header to the packet, using its own MAC address on the g0/2 interface as the source address and PC4's MAC address as the destination.

  • R4 sends the frame to PC4 and it finally reached its destination.

NOTE:

  • The original packet hasn't changed throughout the process. It always used the same IP header with a Source IP of PC1's and a Destination IP of PC4's.

  • The switches didn't modify the frames at any point. The switches forward the frames and learn the MAC addresses, but they don't de-encapsulate and re-encapsulate the packet with a new ethernet header.

PC4 to PC1

  • Say PC4 sends a reply back to PC1 (assume we've configured the static routes on the router so that it follows the same path back).

  • The major difference : Since these devices have already gone through the ARP process, there won't be any need for ARP requests and replies.

  • The packet will simply be forwarded from device to device, being de-encapsulated and re-encapsulated as it is received by and then forwarded by each router.

Quiz

  • When PC4 sends a message to PC1, it encapsulates the packet with an ethernet header, with its default gateway's MAC address as the destination.

  • When R2 sends the packet to R1 en route to its destination PC1, it encapsulates the packet with an ethernet header using its own MAC address as the source MAC address.

  • The source MAC address of the packet when it sent from SW1s g0/1's interface is R1 g0/2's MAC address, as SW1 doesn't alter the frame. It simply forwards it.

  • The source and destination IP of the original packet remains the same in every part of the journey. Although each router modifies the source and destination MAC address in the ethernet header as it forwards the packet, they don't modify the original packet itself.

Last updated