Routelearn.net
Course menu

Unit 6: ARP and Local CommunicationLesson 6.2 (2 of 3 in this unit)32 of 84 in the Network Fundamentals course

ARP for Local and Remote Destinations

A correctly configured PC never sends an ARP request for a server on another network. It uses ARP to find the next hop: the destination itself when it is local, or the default gateway when it is remote. This lesson walks through both cases with the exact frames, the ARP cache before and after, and what goes wrong when the gateway setting or ARP fails.

Beginner · 15 min read · Before this: ARP fundamentals, Subnet mask basics, The default gateway

ARP (Address Resolution Protocol) is the protocol an IPv4 host uses to learn the MAC address of its next hop on the local network. For a destination in the same subnet, it resolves the destination’s own IP address. For a destination on another network, it resolves the IP address of its default gateway.

In simple terms: Your PC only needs the MAC address of the device it hands the frame to. That is the server itself when the server is on your network, or your router when the server is somewhere else.

The one rule to remember

A device uses ARP to find its next hop, not the final destination.
Destination on my subnet → the next hop is the destination, so ARP for the destination.
Destination on another subnet → the next hop is my default gateway, so ARP for the gateway.

You learned how a single ARP request and reply work in ARP fundamentals. This lesson answers a question that confuses many beginners: when PC-A talks to a server on the internet, whose MAC address does it ask for?

💡 In simple terms: to post a letter to another country, you don't need to know the foreign postman's name. You only need to know where your local post box is. ARP finds the post box (the gateway), and the address on the envelope (the destination IP address) does the rest.

Why this matters

  • ARP requests are broadcasts, and routers do not forward broadcasts. A request for a remote server could never reach it.
  • A MAC address is only useful on one local link. Even if PC-A knew the server's MAC address, no switch on PC-A's network could deliver a frame to it.
  • Once you understand this, you can read arp -a output correctly and quickly spot a wrong gateway or a wrong subnet mask.

The example network

DeviceIP addressMAC addressRole
PC-A192.168.10.10/2402:00:00:00:00:aaThe sender in every example
PC-B192.168.10.20/2402:00:00:00:00:bbSame subnet as PC-A
R1 inside (G0/0)192.168.10.1/2402:00:00:00:00:01PC-A's default gateway
R1 outside (G0/1)198.51.100.2/2402:00:00:00:00:02Towards the provider
Provider router198.51.100.1/2402:00:00:00:00:feR1's next hop
Remote server203.0.113.20Never learned by PC-AOn the internet

Step 0: local or remote?

Before it sends any ARP request, PC-A uses its subnet mask to decide what the next hop is:

Compare the network parts using my mask (/24)
My network: 192.168.10.0. The destination's network, using my mask: ?
Same → next hop = the destination
Look up the destination IP in the ARP cache; send an ARP request if it is missing.
Different → next hop = the default gateway
Look up 192.168.10.1 in the ARP cache; send an ARP request if it is missing.
Build the frame to the next hop's MAC
The IP header always carries the real destination IP address.
ARP always resolves the next-hop address chosen in this step.
PC-A
192
168
10
10
PC-B
192
168
10
20
Subnet mask 255.255.255.0 (/24)
255
255
255
0
Network part (24 bits) Host part (8 bits)
192.168.10.0 vs. 192.168.10.0: same network, so same subnet (deliver directly)
Case 1: local.
PC-A
192
168
10
10
Remote server
203
0
113
20
Subnet mask 255.255.255.0 (/24)
255
255
255
0
Network part (24 bits) Host part (8 bits)
192.168.10.0 vs. 203.0.113.0: different networks (send to the default gateway)
Case 2: remote.

Case 1: same subnet (PC-A → PC-B)

PC-B (192.168.10.20) is on PC-A's own subnet. PC-A sends an ARP request for PC-B's IP address, learns PC-B's MAC address and sends the frame straight to it. The router is not involved at all.

SwitchPC-A192.168.10.10 · …:aaPC-B192.168.10.20 · …:bbR1 (gateway)192.168.10.1 · …:01
  1. 1. ARP request for PC-B. PC-A has no cache entry for 192.168.10.20, so it broadcasts: who has 192.168.10.20? Tell 192.168.10.10.
  2. 2. Everyone on the subnet hears it. R1 receives it too, but the target IP address isn't R1's, so R1 does not reply. It also does not forward the broadcast to other networks.
  3. 3. PC-B replies (unicast). PC-B replies directly to PC-A with its MAC address, 02:00:00:00:00:bb.
  4. 4. The data frame goes straight to PC-B. Destination MAC = PC-B, destination IP = PC-B. The router is not involved.
Same subnet: the next hop is the destination, so the ARP target is PC-B.
Step 1 of 3 · ARP request
PC-A
192.168.10.10
Switch
192.168.10.0/24
PC-B
192.168.10.20
Case 1 as a message flow. Tap a message for its addresses.

Case 2: remote destination (PC-A → 203.0.113.20)

The server 203.0.113.20 is on another network. PC-A does not send an ARP request for 203.0.113.20. It sends one for its default gateway, 192.168.10.1, and then sends the frame to the gateway's MAC address. The packet inside is still addressed to 203.0.113.20.

198.51.100.0/24PC-A192.168.10.10 · …:aaPC-B192.168.10.20SwitchR1.10.1 · …:01Provider198.51.100.1Server203.0.113.20
  1. 1. ARP request for the gateway. 203.0.113.20 is remote, so PC-A asks: who has 192.168.10.1? It never asks for 203.0.113.20.
  2. 2. The broadcast stays on the subnet. PC-B ignores it, and R1 recognises its own address. R1 does not forward the broadcast any further.
  3. 3. R1 replies (unicast). R1 tells PC-A: 192.168.10.1 is at 02:00:00:00:00:01. PC-A caches it.
  4. 4. Frame to the gateway, packet to the server. Destination MAC = R1, destination IP = the server.
  5. 5. R1 forwards in a new frame. R1 removes the old frame, uses its own ARP table to find its next hop (198.51.100.1) and sends the same packet on.
Remote: the ARP target is the gateway. Each router uses ARP again on its own outgoing link.
Step 1 of 4 · ARP request for 192.168.10.1
PC-A
192.168.10.10
R1 (gateway)
192.168.10.1
Server
203.0.113.20
Case 2 as a message flow.

The frames side by side

Here are the two data frames PC-A sends after ARP has done its job. Compare the highlighted fields.

Case 1 · Local: PC-A → PC-B

ARP target was 192.168.10.20

Layer 2 · Ethernet header (this hop)
Destination MAC
02:00:00:00:00:bb
PC-B
Source MAC
02:00:00:00:00:aa
PC-A
EtherType
0x0800
IPv4
Layer 3 · IP header (end to end)
Source IP
192.168.10.10
PC-A
Destination IP
192.168.10.20
PC-B
Data (for example TCP/UDP + application data)

Case 2 · Remote: PC-A → server

ARP target was 192.168.10.1 (the gateway)

Layer 2 · Ethernet header (this hop)
Destination MAC
02:00:00:00:00:01
R1, the gateway
Source MAC
02:00:00:00:00:aa
PC-A
EtherType
0x0800
IPv4
Layer 3 · IP header (end to end)
Source IP
192.168.10.10
PC-A
Destination IP
203.0.113.20
the server
Data (for example TCP/UDP + application data)
Case 1: localCase 2: remote
Next hopPC-B itselfDefault gateway R1
ARP target IP192.168.10.20192.168.10.1
Frame destination MAC02:00:00:00:00:bb (PC-B)02:00:00:00:00:01 (R1)
Packet destination IP192.168.10.20 (PC-B)203.0.113.20 (server)
MAC and IP point at…The same deviceDifferent devices
Router involved?NoYes

What happens at each hop

A new frame is built for every link, while the packet inside travels on unchanged. On each link, the sender uses ARP to find its own next hop.

LinkWho sends ARP, for which IPSrc MAC → Dst MACSrc IP → Dst IP
PC-A → R1PC-A for 192.168.10.1…:aa → …:01192.168.10.10 → 203.0.113.20
R1 → providerR1 for 198.51.100.1…:02 → …:fe192.168.10.10 → 203.0.113.20*
Last router → serverThat router for 203.0.113.20its MAC → server's MAC192.168.10.10 → 203.0.113.20*

* If R1 is a home or edge router running NAT, it also replaces the private source IP address with its public address (here 198.51.100.2). The destination IP address still does not change. Only the last router, the one on the server's own subnet, ever sends an ARP request for the server's IP address.

The ARP cache before and after

Before PC-A sends anything:

Example output from a Windows PC (PC-A), written for this lesson
C:\> arp -a
Interface: 192.168.10.10 --- 0xb
  Internet Address      Physical Address      Type
  192.168.10.255        ff-ff-ff-ff-ff-ff     static
  224.0.0.22            01-00-5e-00-00-16     static
  255.255.255.255       ff-ff-ff-ff-ff-ff     static
What to look for: there are no dynamic entries yet. The only lines are built-in static entries for broadcast and multicast addresses, which Windows always shows.

After ping 192.168.10.20 (Case 1):

Example output from a Windows PC (PC-A), written for this lesson
C:\> arp -a
Interface: 192.168.10.10 --- 0xb
  Internet Address      Physical Address      Type
  192.168.10.20         02-00-00-00-00-bb     dynamic
  192.168.10.255        ff-ff-ff-ff-ff-ff     static
  224.0.0.22            01-00-5e-00-00-16     static
  255.255.255.255       ff-ff-ff-ff-ff-ff     static
What to look for: a new dynamic entry, 192.168.10.20 → 02-00-00-00-00-bb. PC-A learned PC-B's MAC address with ARP. (Windows writes MAC addresses with hyphens.)

After ping 203.0.113.20 (Case 2), and browsing a few websites:

Example output from a Windows PC (PC-A), written for this lesson
C:\> arp -a
Interface: 192.168.10.10 --- 0xb
  Internet Address      Physical Address      Type
  192.168.10.1          02-00-00-00-00-01     dynamic
  192.168.10.20         02-00-00-00-00-bb     dynamic
  192.168.10.255        ff-ff-ff-ff-ff-ff     static
  224.0.0.22            01-00-5e-00-00-16     static
  255.255.255.255       ff-ff-ff-ff-ff-ff     static
What to look for: the gateway 192.168.10.1 now appears, but 203.0.113.20 is not in the cache, and neither is any website. All remote traffic uses the single gateway entry. This proves that PC-A used ARP to find the gateway, not the server.
Example output from a Linux PC with the same settings, written for this lesson
$ ip neigh
192.168.10.1 dev eth0 lladdr 02:00:00:00:00:01 REACHABLE
192.168.10.20 dev eth0 lladdr 02:00:00:00:00:bb STALE
What to look for: Linux shows the same thing. Only local neighbours appear (the gateway and PC-B), never remote servers. REACHABLE means the entry was confirmed recently; STALE means it is still cached but will be checked again before it is trusted.

What goes wrong

1. The gateway address is wrong

PC-A's gateway is set to 192.168.10.99, which no device uses. Local traffic still works. For remote traffic, PC-A sends an ARP request for .99, nobody answers, and the packet is never sent.

SwitchPC-Agateway = .99 ✗PC-B192.168.10.20R1192.168.10.1
  1. 1. PC-A sends ARP for the wrong gateway. To reach 203.0.113.20, PC-A needs its gateway's MAC address, so it broadcasts an ARP request for 192.168.10.99.
  2. 2. Nobody owns .99. PC-B and R1 both ignore it. R1 is the real gateway, but it only answers for its own address, 192.168.10.1.
  3. 3. No MAC, no frame. PC-A retries, then gives up. ping shows “Destination host unreachable” from PC-A's own address.
The router is working correctly; PC-A is simply asking for the wrong address.
Example output from a Windows PC with a wrong gateway, written for this lesson
C:\> ping 203.0.113.20
Pinging 203.0.113.20 with 32 bytes of data:
Reply from 192.168.10.10: Destination host unreachable.
Reply from 192.168.10.10: Destination host unreachable.
Reply from 192.168.10.10: Destination host unreachable.
Reply from 192.168.10.10: Destination host unreachable.
What to look for: the replies come from 192.168.10.10, PC-A's own address, not from a router. PC-A is reporting that it could not get a MAC address for its next hop, so the packets never left the PC.

If the gateway is set to another PC (for example, PC-B), ARP succeeds. But PC-B is not a router, so it normally drops the packets and the ping simply times out. If the gateway address is in a different subnet, PC-A can't use ARP to reach it at all.

Learn more: The Default Gateway

2. The subnet mask is wrong

Suppose PC-A is set to /8 (255.0.0.0) instead of /24, and tries to reach a company server at 192.168.20.5 on another subnet behind R1. With /8, PC-A compares only the first octet: 192 = 192, so it believes the server is local. It sends an ARP request for 192.168.20.5 directly. That host is behind the router, so the broadcast never reaches it and nobody answers.

PC-A's mask192.168.20.5 looks…ARP targetResult
/24 (correct)Remote192.168.10.1 (gateway)Works
/8 (wrong)Local192.168.20.5 (the server itself)No ARP reply; fails

Some routers run proxy ARP and answer such a request on the server's behalf, which can hide this mistake.

Learn more: Gratuitous ARP, Probes and Proxy ARP

3. ARP for a local host fails

If PC-B is switched off, unplugged, in a different VLAN or has a different IP address than you think, PC-A's ARP request gets no reply. The symptom is the same "Destination host unreachable" message, and ip neigh on Linux shows the entry as FAILED or INCOMPLETE.

Example output from a Linux PC whose ARP request went unanswered, written for this lesson
$ ip neigh show 192.168.10.20
192.168.10.20 dev eth0 FAILED
What to look for: there is no lladdr (MAC address) on the line, and the state is FAILED. Linux sent ARP requests for 192.168.10.20 and got no reply.

Troubleshooting checklist

  1. Decide local or remote yourself from the PC's IP address and subnet mask. Is the next hop the destination or the gateway?
  2. Check the gateway setting with ipconfig or ip route. On Linux, ip route get 203.0.113.20 shows the next hop it will use.
  3. Ping the next hop (PC-B, or the gateway).
  4. Look at the ARP cache with arp -a or ip neigh. The next hop should be listed with the correct MAC address.
  5. Missing or FAILED entry: the next hop isn't answering ARP. Check the address, the cable and the VLAN, and check that the device is switched on.
  6. Want to see it happen? Start a Wireshark capture with the display filter arp, then run the ping.

Common mistakes

  • Expecting to see a server's MAC address in arp -a after visiting it. Remote hosts never appear; only the gateway does.
  • Thinking the destination IP of remote traffic is the gateway's IP. The packet is still addressed to the server. The gateway's IP address is only the ARP target.
  • Blaming the router when PC-A's gateway setting is wrong. With an unused gateway address, the router never even receives the packet.
  • Forgetting that every router uses ARP too. Each router resolves its own next hop on each of its own links.
✅ Key takeaways
  • ARP always resolves the next hop, which the PC chooses by comparing network parts using its subnet mask.
  • Local destination: ARP for the destination itself; the destination MAC and IP point at the same device.
  • Remote destination: ARP for the default gateway, never for the remote IP; destination MAC = gateway, destination IP = remote host.
  • arp -a on a PC shows local neighbours and the gateway, never internet servers.
  • Wrong gateway: the ARP request fails or reaches a device that isn't a router. Wrong mask: the PC sends ARP for remote hosts directly and gets no answer.

Check yourself

Predict · scenario 1

PC-A (192.168.10.10/24, gateway 192.168.10.1) pings 203.0.113.20 with an empty ARP cache. What is the target IP in its ARP request?

Predict · scenario 2

PC-A pings PC-B (192.168.10.20). What is the destination MAC address of the frame that carries the ping?

Predict · scenario 3

After browsing ten websites, how many entries for those websites appear in PC-A's ARP cache?

Predict · scenario 4

PC-A's gateway is set to 192.168.10.99 (unused). It pings PC-B and then 203.0.113.20. What happens?

Predict · scenario 5

PC-A has mask /8 by mistake and tries to reach 192.168.20.5 on another subnet. What does it ARP for?

Later lessons cover special ARP messages and put the whole journey together, step by step.

Learn more: Gratuitous ARP, Probes and Proxy ARPSame-Subnet CommunicationDifferent-Subnet Communication

FAQ

Why doesn't my PC's ARP cache contain the websites I visit?
Because websites are on remote networks. When the destination is remote, your PC uses ARP only to find the default gateway. All your internet traffic is sent to that one MAC address, so the gateway is the only entry it needs.
Can a PC ever ARP for a remote IP address?
Only if it wrongly thinks the address is local, usually because of a wrong subnet mask. It then sends an ARP request that nobody answers, unless a router is running proxy ARP and replies on the remote host's behalf.
Does the router also use ARP?
Yes. For every link it forwards a packet out of, the router needs the MAC address of its own next hop (the next router or the final host). It uses ARP on that link and keeps its own ARP table.
Do the IP addresses change at each hop?
Normally, no. The source and destination IP addresses stay the same end to end; only the Ethernet MAC addresses are replaced at each router. The exception is NAT, which a home or edge router uses to change the private source address to a public one.