Skip to content

03-01: Exercises

Question

A small office LAN (192.168.1.0/24) has the following devices:

Host IP Address MAC Address
Host A 192.168.1.10 AA:AA:AA:AA:AA:AA
Host B 192.168.1.20 BB:BB:BB:BB:BB:BB
Host C 192.168.1.30 CC:CC:CC:CC:CC:CC
Gateway 192.168.1.1 GG:GG:GG:GG:GG:GG

Host A's current ARP cache contains only one entry:

IP Address MAC Address
192.168.1.1 GG:GG:GG:GG:GG:GG

Host A now wants to send a packet to Host B (192.168.1.20) for the very first time.

  1. What does Host A check first, and why?
  2. What ARP traffic (request/reply) is generated, and who sends/receives it?
  3. What does Host A's ARP cache look like immediately afterward?

Solution

Step 1: Determine whether ARP is even needed, and for which IP

Host A wants to reach 192.168.1.20. Since both Host A (192.168.1.10) and Host B (192.168.1.20) are on the same subnet (192.168.1.0/24), Host A will send the frame directly to Host B on the local network — no gateway is involved. (If B were on a different subnet, A would instead need the gateway's MAC, not B's.)

Host A checks its ARP cache to see if it already knows the MAC address mapped to 192.168.1.20.

Looking at the given cache:

IP Address MAC Address
192.168.1.1 GG:GG:GG:GG:GG:GG

There is no entry for 192.168.1.20. Host A cannot build an Ethernet frame without a destination MAC address, so it must resolve it using ARP.

👉 (1) Host A checks its ARP cache first because it needs Host B's MAC address to build the Ethernet frame; the cache has no entry for 192.168.1.20, so ARP resolution is required.


Step 2: The ARP request/reply exchange

ARP Request (broadcast):

Host A broadcasts an ARP request to the entire local network (destination MAC = FF:FF:FF:FF:FF:FF), asking "Who has 192.168.1.20? Tell 192.168.1.10."

Field Value
Sender IP 192.168.1.10
Sender MAC AA:AA:AA:AA:AA:AA
Target IP 192.168.1.20
Target MAC (unknown — being requested)
Dest. (Ethernet) FF:FF:FF:FF:FF:FF (broadcast)

This frame is received by every device on the LAN (Host B, Host C, and the Gateway), because it's a broadcast. However, only Host B recognizes 192.168.1.20 as its own IP.

  • Host C and the Gateway simply ignore the request (it isn't addressed to their IP), though they may still cache A's IP/MAC mapping as a side effect of seeing the broadcast.

ARP Reply (unicast):

Host B replies directly to Host A (unicast, not broadcast), saying "192.168.1.20 is at BB:BB:BB:BB:BB:BB."

Field Value
Sender IP 192.168.1.20
Sender MAC BB:BB:BB:BB:BB:BB
Target IP 192.168.1.10
Target MAC AA:AA:AA:AA:AA:AA
Dest. (Ethernet) AA:AA:AA:AA:AA:AA (unicast)

👉 (2) Host A broadcasts an ARP request for 192.168.1.20; all hosts receive it but only Host B replies, sending a unicast ARP reply back to Host A with its MAC address.


Step 3: Host A's ARP cache afterward

Upon receiving the reply, Host A stores the new mapping in its ARP cache (in addition to the existing gateway entry):

IP Address MAC Address
192.168.1.1 GG:GG:GG:GG:GG:GG
192.168.1.20 BB:BB:BB:BB:BB:BB

Host A can now address Ethernet frames directly to Host B without repeating the ARP lookup (until the entry expires from the cache after its timeout).

👉 (3) Host A's ARP cache gains a new entry: 192.168.1.20 → BB:BB:BB:BB:BB:BB, alongside the pre-existing gateway entry.


Final Answer

  1. Host A checks its ARP cache because it needs Host B's MAC address to build a frame; no entry exists for 192.168.1.20, so ARP is triggered.
  2. Host A broadcasts an ARP request ("Who has 192.168.1.20?") to the whole LAN; Host B alone replies with a unicast ARP reply containing its MAC address (BB:BB:BB:BB:BB:BB).
  3. Host A's resulting ARP cache:
IP Address MAC Address
192.168.1.1 GG:GG:GG:GG:GG:GG
192.168.1.20 BB:BB:BB:BB:BB:BB