From Transistor to Browser

The Network · Chapter 10.b
Who has this address?

Updated Oct 12, 2026
Summarize
Transcript

Who has this address? One wire, now shared by many machines. A frame sent on it reaches all of them.

I figured you'd just put the name, B, on the frame. But the wire's hardware only knows hardware addresses, not names.

Every machine has a hardware address, fixed at the factory: its MAC. So machine A shouts to everyone on the wire: who has B? Every machine hears it. Machine C checks, and stays quiet. Only B answers, with its MAC. The shout is a broadcast, and the answer comes back to A alone. Machine A writes that down in a cache, and addresses the frame to B's MAC. Ask again, and the cache answers. No shouting.

Only the owner answers! A shout, one answer, and a cache turn a name into a hardware address.

Resolve a name twice in the widget below. Why is the wire silent the second time?

The hosts' voices are synthetic, made with Breeze TTS 2 by BreezeBlue.

The preceding chapters carried bytes between two endpoints. On a shared local link, an addressed frame must also say which interface should receive it. Each interface has a link address, commonly called a MAC address on Ethernet. A packet’s destination network address answers a different question: where should the packet eventually arrive? Routing chooses the next neighbour toward that destination; address resolution finds that neighbour’s MAC for the local hop.

Here, and in the routing chapter, A through F are readable stand-ins for network-layer addresses such as IPv4 addresses. They are not the host names, such as example.com, that DNS will resolve later. Before sending to neighbour B, we ask everyone on the local link which MAC corresponds to network address B.

This model represents the addressed result as a (mac, payload) pair; it does not extend or transmit the encoded frames of Chapter 10. Its four-octet MAC strings are abbreviated teaching labels; Ethernet MAC addresses contain six octets. Real interfaces can use assigned or locally configured MAC addresses, so they are not necessarily fixed in hardware.

10.b.1 Who has this address?

The question goes to everyone on the link: who has B? Every machine hears it, but only the one that owns that network address answers, with its MAC. Figure 10.b.2 shows the exchange.

arp-exchangearp-exchange
Figure 10.b.2: Resolving a network address. The question who has B? is broadcast to every machine on the wire; only B answers, with its hardware address. The asker remembers it.

The interactive version needs the in-browser runtime.

Example 10.b-1. Resolving a network address to a link address

class Link:
    """A fixed local inventory and a cache from network to link addresses."""

    def __init__(self, machines: list) -> None:
        self._machines = machines
        self.cache = {}        # Network address -> MAC; fixed inventory only.
        self.queries = []      # Addresses queried by broadcast, in order.

    def resolve(self, name: str) -> str:
        """Resolve a network-address label, broadcasting if it is not cached."""
        if name in self.cache:1
            return self.cache[name]
        self.queries.append(name)                 # Broadcast: who has this address?2
        for machine in self._machines:
            if machine.name == name:
                self.cache[name] = machine.mac     # the owner answers3
                return machine.mac
        raise KeyError(f"no machine on this link has address {name}")

The model’s inventory and addresses never change, so its cache does not expire. On a real network a machine can move, an interface can change, or a cached answer can become stale. Implementations must revalidate or discard old mappings and resolve them again.1

This is the question-and-cache idea of the Address Resolution Protocol (ARP), a bridge between two kinds of address. A routing table selects a next-hop network address; ARP maps it to a local link address, as Figure 10.b.3 shows. For a distant destination, that local address belongs to the next router, not to the final recipient.2

bridgebridge
Figure 10.b.3: ARP between the layers. A route selects a next-hop address (Chapter 11); the wire needs a hardware address (Chapter 10); the cache translates the one into the other.

10.b.3 Address resolution, run

Running ftb.arp resolves a couple of network addresses on a small link, asks for one of them again to show the cache answer it, and asks for a stranger.

output · ftb.arp
resolve B: 02:00:00:0b
resolve C: 02:00:00:0c
resolve B again: 02:00:00:0b  (from the cache)

who-has broadcasts went out for: ['B', 'C']
the cache now holds: {'B': '02:00:00:0b', 'C': '02:00:00:0c'}

resolve Z: 'no machine on this link has address Z'

The first time B is needed, a question goes out on the wire and B answers; the second time, the cache answers and the wire stays quiet, which is why B and C each appear just once in the record of broadcasts. The stranger Z is broadcast for too, but an address no machine owns gets no answer and cannot be resolved. We now know how to address the local hop. The next chapter decides which neighbour that hop should reach.

Exercises

1See RFC 1122, Section 2.3.2.1, on ARP cache validation.

2RFC 826 describes the next-hop protocol-address to Ethernet-address mapping.