The Address a Device Borrows

Getting onto a wireless network and getting an address are separate jobs. A DHCP lease explains why a connected device usually needs no setup, and why the same phone may get a different address next week.

A close-up photograph of a home internet router
In this story 5 sections

A phone shows three curved bars at the top of the screen. It has joined the wireless network, but a page refuses to load. A computer beside it may be working perfectly. One possible explanation sits between the radio connection and the browser: the phone hasn't been given the network settings it needs. A device can have a good connection to the access point without knowing which address to use on the local internet protocol network, or where to send packets headed out of it. The wireless icon compresses several different events into a small shape. Diagnosing a problem starts by separating them again.

On many local networks, a service called DHCP hands out those settings. The abbreviation stands for Dynamic Host Configuration Protocol. Its most obvious job is supplying an address; the server usually tells the client how long it may use that address and can supply other settings in the same exchange. This article follows the ordinary IPv4 case specified in RFC 2131. Devices can also have IPv6 connectivity, which has its own ways of obtaining addresses and finding routers. A laptop can be doing both at once even though its interface shows a single Wi-Fi connection.

How a newcomer asks

Imagine a meeting room with a handful of laptops already connected and another arriving during a break. The new laptop cannot address its first DHCP message directly to the server using an address it learned on this network. It has learned none yet. The usual starting message, a DHCP discovery, therefore goes out as a broadcast on the local network. This is a request for whoever is responsible for configuration to identify itself. On larger installations a relay may carry such messages to a server elsewhere. A home router commonly runs the server itself, so the distinction is harder to see from the outside.

The server looks for an address it can offer and replies with a proposal. Think of the proposal as a reply containing terms, before the laptop takes up residence at that address. A client may see more than one offer in an installation designed with several servers. It requests the one it selects, and the chosen server sends an acknowledgment if the request still works. The discovery, offer, request and acknowledgment are recognizable landmarks. There are other paths through the protocol; a computer returning to a familiar network can ask whether it may reuse the address it had before. The four messages are a useful account of how a new device can get started without knowing the network's numbering plan ahead of time.

Why the clock is part of it

Suppose the meeting room is booked twice a day, with different visitors every time. The available pool of addresses need only accommodate the devices that may be using them around the same time. Assigning every visitor an address forever would eventually leave the pool empty even on a quiet afternoon. The lease gives the server a way to let unused addresses become available again. If a laptop vanishes at lunchtime without saying goodbye, its entry can still expire. The server recorded a time limit when it made the assignment.

A client doesn't normally wait for the last moment. It first tries to renew with the server that gave it the lease. If it cannot reach that server and enough time passes, it can broaden the request so that another suitable server can respond. These are the renewal and rebinding phases. The chance to renew early is why a lease can turn over repeatedly while a person is reading a book, editing a file or watching a long video. The time changes in the record and the address usually stays the same. If the device reaches the expiry without renewing, the agreement is over and it must stop relying on that address.

The duration is an operating choice. Rapid turnover makes sense in some places; a longer term reduces pressure to check back and can make sense where the devices are mostly stationary. It is possible to imagine a hall with twenty occupied seats and forty devices because people have phones and laptops. It is equally possible for a device unused since yesterday to have a valid lease today. A seat count and a lease count measure different things.

An address, a boundary and a way out

Even with an address, the laptop needs to know which destinations it considers local. The IPv4 subnet mask supplies that boundary. For destinations inside it, the device can try to reach the other local device directly through the link. For an ordinary outside destination, a routing table typically points it at a default gateway. That gateway is a next step, not the final destination of an internet request. A large installation may put its gateway and its DHCP server on different equipment. Seeing the same appliance both issue leases and forward packets at home reflects how the hardware has been packaged.

A DNS resolver is another distinguishable item. Its work concerns names, such as the name a browser gets from a link. A device can already have a legitimate local address and a usable route yet still be unable to turn a name into the address it needs. DHCP can tell it what resolver to use, although operating systems, browsers and managed configurations can use other settings. A broken name lookup should not be mistaken for a failed lease just because both can make a page seem unreachable. Conversely, having a resolver listed in settings is not proof the device can get to it.

The address reported in the phone's network screen may also look nothing like the address a remote service sees for a connection. For example, several devices can share a public IPv4 address through address translation at the network edge. A DHCP assignment inside the network is a statement about one attachment to that network. It is not a permanent identifier for the person with the phone.

What if a printer needs to stay put?

In a small workshop, people might occasionally send a label to a printer by its address. They expect the setting to survive a weekend when the printer has been unplugged. A server can be set to keep a particular address available for a client it recognizes. This is commonly called a reservation. The printer can still request its address dynamically and receive the appropriate gateway and other settings. The arrangement depends on matching the client identifier used by that service. An address remembered for a replaced network interface, for example, may no longer match the new one.

Another possibility is to configure the address on the printer itself. That changes who is keeping the record. The printer need not ask DHCP for the address at all, so the reservation table will not tell the full story about everything using the network. If that address is also in the server's freely available pool, another client could be offered it while the printer is switched off. When the printer reappears, two devices may then contend for the same number. Keeping a small inventory of deliberately fixed addresses is useful for the person who maintains the network; the convenience comes from knowing which tool claims which number, not from the fact the numbers stay still.

If the network's addressing plan changes, the difference becomes obvious. A dynamically configured device can learn the new plan from the service when it gets new settings. Every piece of equipment set by hand may require an individual check. A workshop with six devices may manage that with an ordinary notebook. A building with many rooms and dozens of devices that rarely have a screen attached benefits from a more complete inventory.

What the lease can tell you

Return to the phone and the laptop in the same room. Start with the fact that one works. It shows at least one device has a usable path, but says little yet about the other device's settings. At the ordinary user level it is enough to check the connection details on the device with the problem. Does it display an IPv4 address and a router for that connection? Does it have any working access at all, or only trouble with the name of a particular site? A device may show an automatically assigned local address when it fails to get an expected address, and some operating systems show an explicit warning. Neither message identifies the precise fault by itself.

There may also be a login page at a public venue. A captive portal can deliberately restrict internet use until the visitor sees a page or accepts its conditions. The device could already have working DHCP settings while the venue limits its traffic. In that case the settings are more like a ticket into the lobby than a pass to the rooms beyond it. At a workplace or shared venue, a short description of symptoms, including the time, which network was selected and whether others were affected, gives the people operating it far more to go on than a claim that the internet is broken.

A lease is ordinary enough that a person can use a phone for years without inspecting one. It is also precise enough to interrupt the idea of a single all-purpose connection. The handset joined a link. It obtained permission to use an address for a while. It learned where outside traffic should go and may have learned where to look up names. Each event leaves a different clue when things go wrong. Most days the events finish quietly, and the only visible movement is a page opening within a second of a tap.

Further reading