š Routers ā Part 2
How ARP + Routing Work Together
Series: Networking Fundamentals for Cloud & DevOps ā Part 5 of 6
This part mainly explains how ARP + routing work together when Host A sends data to Host C through R1 and R2.
Before following the journey, keep these two tables separate:
| Table | Layer | Main Question |
|---|---|---|
| Routing Table | L3 | Where should I send the packet next? |
| ARP Table | L2 | What MAC address do I need for the next hop? |
Routing Table: destination IP/network ā where to send next.
ARP Table: IP address ā MAC address.
This distinction is extremely important.
Example: A ā C
Consider this network:
10.0.44.0/24 10.0.55.0/24 10.0.66.0/24
A R1 R2 C
10.0.44.9 .1 .2 10.0.66.7
MAC a9a9 eee1 eee2 c7c7
āāāāāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāā
ā ā
More simply: A āā R1 āā R2 āā C, with:
-
A ā IP
10.0.44.9, MACa9a9 -
R1 ā IP
10.0.44.1, MACeee1 -
R2 ā IP
10.0.55.2, MACeee2 -
C ā IP
10.0.66.7, MACc7c7
A wants to send data to C, at destination 10.0.66.7.
Step 1 ā A Creates the L3 Packet
The destination IP remains C's IP: SRC IP = 10.0.44.9, DST IP = 10.0.66.7.
A checks its routing information and realizes 10.0.66.7 is outside its local network. So A needs to send the packet to its default gateway, R1.
The important point is:
The final destination IP is C, but the next hop is R1.
Step 2 ā A Needs R1's MAC
A knows R1's IP (10.0.44.1) but doesn't know R1's MAC yet. So A sends an ARP Request:
"Who has 10.0.44.1?"
R1 replies 10.0.44.1 ā eee1, and A stores this mapping in its ARP table (10.0.44.1 ā eee1). Now A knows the Layer 2 destination needed for the first hop.
Step 3 ā A Sends the Frame to R1
A can now construct the Layer 2 frame:
L2: SRC MAC = a9a9 DST MAC = eee1
L3: SRC IP = 10.0.44.9 DST IP = 10.0.66.7
Notice the important thing:
MAC destination = R1
IP destination = C
So the frame goes A āāāāāāāāāāāāāāāāāā R1, while the IP packet still says 10.0.44.9 ā 10.0.66.7.
Step 4 ā R1 Receives It
R1 receives the frame because DST MAC = eee1, which is R1's MAC address. R1 removes/discards the old Layer 2 header. The IP information is still SRC IP = 10.0.44.9, DST IP = 10.0.66.7.
R1 checks its routing table: 10.0.66.0/24 ā 10.0.55.2.
To reach C's network, send the packet to R2 at 10.0.55.2.
This is the Layer 3 routing decision.
Step 5 ā R1 Needs R2's MAC
R1 knows R2's IP (10.0.55.2) but needs R2's MAC. So R1 sends ARP:
"Who has 10.0.55.2?"
R2 replies 10.0.55.2 ā eee2. R1 stores this in its ARP table (10.0.55.2 ā eee2). Now R1 knows the Layer 2 destination for the next hop.
Step 6 ā R1 Sends a NEW Layer 2 Frame
This is the most important concept in this entire example. R1 creates a new Layer 2 header, while the Layer 3 addresses remain unchanged:
L2: SRC MAC = eee1 DST MAC = eee2
L3: SRC IP = 10.0.44.9 DST IP = 10.0.66.7 (unchanged)
MAC addresses ā changed. IP addresses (
10.0.44.9 ā 10.0.66.7) ā stay the same.
The frame is now R1 āāāāāāāāāāāāāāāāāā R2. The IP packet is still ultimately going to C.
Step 7 ā R2 Receives It
R2 receives the frame because DST MAC = eee2, which is R2's MAC address. R2 removes the Layer 2 header and checks the destination IP (DST IP = 10.0.66.7).
R2's routing table says 10.0.66.0/24 ā Left interface ā C is directly connected to R2. So R2 now needs C's MAC address. It sends ARP:
"Who has 10.0.66.7?"
C replies 10.0.66.7 ā c7c7. R2 stores this in its ARP table (10.0.66.7 ā c7c7).
Step 8 ā R2 Sends the Frame to C
R2 creates another new Layer 2 header, while the Layer 3 information remains the same:
L2: SRC MAC = eee4 DST MAC = c7c7
L3: SRC IP = 10.0.44.9 DST IP = 10.0.66.7
So R2 āāāāāāāāāāāāāāāāāā C. C receives the frame because DST MAC = c7c7, and checks the destination IP (DST IP = 10.0.66.7) ā that's C's own IP.
C accepts the packet.
The Entire Journey
The complete journey can be visualized as:
A R1 R2 C
ā ā ā ā
āāā ARP R1 āāāāāāāāāāāāāāāā ā ā
āāā 10.0.44.1 / eee1 āāāāā ā ā
ā ā ā ā
āāā a9a9 ā eee1 āāāāāāāāāāā ā ā
ā IP: A ā C ā ā ā
ā ā ā ā
ā āāā ARP R2 āāāāāāāāāāāāāāāā ā
ā āāā 10.0.55.2 / eee2 āāāāāā ā
ā ā ā ā
ā āāā eee1 ā eee2 āāāāāāāāāāā ā
ā ā IP: A ā C ā ā
ā ā ā ā
ā ā āāā ARP C āāāāāāāāāāāāāāāāā
ā ā āāā 10.0.66.7 / c7c7 āāāāā
ā ā ā ā
ā ā āāā eee4 ā c7c7 āāāāāāāāāāā
ā ā ā IP: A ā C ā
At every router hop: L2/MAC header ā changes. L3/IP header ā stays the same.
Routing Table vs ARP Table
This is one of the most important distinctions to remember.
Routing Table answers: "Where should I send this packet next?" ā e.g. 10.0.66.0/24 ā 10.0.55.2. The router uses this information to select the next hop/interface.
ARP Table answers: "What MAC address do I need for that next hop?" ā e.g. 10.0.55.2 ā eee2.
So the relationship is:
Destination network
ā
Routing Table
ā
Next-hop IP
ā
ARP Table
ā
Next-hop MAC
ā
Build Layer 2 frame
ā
Send
The One Thing to Remember
At every router hop: L2/MAC header ā changes. L3/IP header ā stays the same.
For this example:
| Hop | Source MAC | Destination MAC | Source IP | Destination IP |
|---|---|---|---|---|
| A ā R1 | a9a9 | eee1 | 10.0.44.9 | 10.0.66.7 |
| R1 ā R2 | eee1 | eee2 | 10.0.44.9 | 10.0.66.7 |
| R2 ā C | eee4 | c7c7 | 10.0.44.9 | 10.0.66.7 |
This table captures the whole concept:
Routing table tells the router WHERE to send the packet.
ARP table tells the router WHICH MAC address is needed for the next hop.
Final Mental Model
ROUTER
ā
āāā Routing Table
ā āāā Destination network ā Next hop / Interface
ā
āāā ARP Table
ā āāā Next-hop IP ā MAC address
ā
āāā Forwarding process
ā
āāā Check destination IP
ā
āāā Routing table decides next hop
ā
āāā ARP resolves next-hop MAC
ā
āāā Build a NEW L2 frame
ā
āāā Forward to next hop
And the simplest possible memory rule:
- Routing Table ā Where should the packet go?
- ARP Table ā What MAC gets me to the next hop?
- IP ā Final destination
- MAC ā Current hop
This is the connection between everything we've learned so far:
IP + Routing ā which network should the packet reach? ARP ā which MAC address gets the frame to the next hop? Ethernet / Layer 2 ā move the frame across the current hop.
For Cloud + DevOps, this mental model becomes especially useful when understanding VPC route tables, subnets, gateways, next hops, and connectivity troubleshooting.
Part 5 of 6 ā Networking Fundamentals for Cloud & DevOps
Next: deeper router behavior and how routing decisions are made.
Top comments (0)