Sub topic 2
Why static configuration does not scale
This chapter assumes you know what an IPv4 address, a subnet mask, a default gateway and a DNS server are, and that you have a rough picture of a LAN with a router. You do not need to know anything about DHCP yet. The goal here is to see exactly what goes wrong when every device is configured by hand, so that the design of DHCP in the later chapters makes sense.
What static configuration means
Static configuration means a person (or a script) writes the network settings onto each device and they stay there until someone changes them. A host needs at least four values before it can talk beyond its own subnet:
- An IPv4 address that is unique on the subnet.
- A subnet mask that tells the host which addresses are local.
- A default gateway, which is the router used for every destination outside the subnet.
- One or more DNS servers, which are used to turn names into addresses.
On a Linux host using the ip tool, a static setup looks like this:
sudo ip addr add 192.168.1.50/24 dev eth0
sudo ip link set eth0 up
sudo ip route add default via 192.168.1.1
echo "nameserver 192.168.1.1" | sudo tee /etc/resolv.confThese four lines are easy for one machine. The trouble starts when you multiply them by hundreds of machines, over years, with people moving around.
Problem 1: Duplicate addresses
Nothing in IPv4 stops two devices from being given the same address. When that happens, both devices answer ARP requests for the address. Other hosts cache whichever reply arrived last, so traffic goes to one device, then the other, and connections break at random.
Typical symptoms are:
- A server that is reachable for a few minutes and then not.
- TCP sessions that reset without explanation.
- Operating system warnings such as "Another device on the network has the same IP address".
Duplicates are hard to diagnose because the fault is intermittent and depends on the ARP caches of the other hosts. To prevent them, administrators keep a record of every assigned address. That record is a spreadsheet or a document that must be kept correct by hand, and it is often out of date.
Problem 2: Typing errors
Each value has to be entered correctly on every device. Common mistakes include:
- A wrong subnet mask, such as
255.255.0.0instead of255.255.255.0. The host then believes distant addresses are local and tries to reach them with ARP instead of sending them to the gateway. - A wrong gateway address, so the host works inside its subnet but cannot reach anything beyond it.
- A mistyped DNS server, so pinging an IP address works but names do not resolve.
- An address outside the subnet's range, or the network or broadcast address itself.
Each of these produces a partial failure, which is harder to troubleshoot than a complete one. The user can reach some things and not others, and the cause sits in a setting that looks fine at a glance.
Problem 3: Changes touch every device
Network settings are not permanent. Suppose you replace the router, so the gateway changes from 192.168.1.1 to 192.168.1.254. With static configuration you must visit or script every device. The same applies to:
- Moving the DNS server to a new address.
- Renumbering a subnet, for example when merging with another company.
- Splitting a subnet that has grown too large.
The cost of a change grows with the number of devices. During the change, devices that were missed or were switched off keep the old values and fail later, sometimes weeks afterwards when someone turns them on.
Problem 4: Mobile and transient devices
A laptop or phone moves between networks. A static address that is valid in the office is wrong at home, in a hotel or at a customer site. A user would have to change the settings by hand each time, and know the correct values for each place.
Guests make this worse. A visitor who brings a laptop into a meeting room needs an address, a gateway and a DNS server from somewhere. With static configuration, someone from IT must hand out a free address and explain the settings. Most users cannot do this on their own, and many devices, such as phones, make it awkward to do at all.
Problem 5: Address space is wasted or exhausted
With static assignment, an address belongs to a device whether or not the device is in use. A desktop that was removed from the network a year ago still holds its address in the spreadsheet. Administrators are cautious about reusing addresses that might still be configured somewhere, so the pool of free addresses shrinks.
Consider an office with a /24 subnet, which has 254 usable host addresses. If 200 devices are on the network and you have a policy of never reusing addresses, a stream of temporary devices will exhaust the range quickly. A dynamic scheme can instead lend an address only while a device is present, and take it back afterwards.
The table below summarizes how the problems compare.
| Problem | Cause | Typical symptom |
|---|---|---|
| Duplicate address | Two devices configured with the same IP | Intermittent connection loss |
| Typing error | Wrong mask, gateway or DNS entered by hand | Partial connectivity |
| Mass change | Every device must be edited | Stale settings on missed devices |
| Mobility | Settings valid only on one network | No connectivity after moving |
| Wasted space | Addresses held by absent devices | Pool appears full |
How the cost grows
The effort of static configuration grows roughly in proportion to the number of devices, and each manual step carries some chance of error. If each device has a small probability of a mistake, the probability that at least one of many devices is wrong rises quickly. You can see this with a short calculation:
error_rate = 0.01 # 1% chance of a typing mistake per device
for devices in (1, 10, 50, 200, 1000):
p_at_least_one = 1 - (1 - error_rate) ** devices
print(f"{devices:5d} devices -> {p_at_least_one:6.1%} chance of at least one mistake")With a 1% error rate, 50 devices already give about a 40% chance of at least one mistake, and 200 devices give about an 87% chance. The 1% figure is an illustration, not a measurement, but the shape of the curve is real. Large networks cannot depend on every manual entry being right.
When static configuration is still the right choice
Static addresses are not wrong, and real networks use them where stability matters. Typical cases are:
- Routers, switches and firewalls, whose addresses other devices depend on.
- Servers and printers that users reach by a fixed address.
- The DHCP server itself, which cannot ask for an address from a server that does not exist yet.
- Devices used to troubleshoot a network that has lost its DHCP service.
The point is that static configuration should be a deliberate exception for a small number of important devices. It should not be the default for every client. A DHCP server can also give a device the same address every time without any manual configuration on the device, which is called a reservation. Later chapters cover reservations.
What an automatic scheme must provide
The problems above tell us what a better design needs. Before you read about DHCP, note the requirements it has to meet:
- A central place for settings, so a change is made once and not on every device.
- Automatic assignment of addresses from a pool, so no two devices receive the same one.
- Delivery of the mask, gateway and DNS server together with the address, so users do not type them.
- Temporary assignment, so an address returns to the pool when a device leaves.
- A way for a device with no address at all to ask for one.
Requirement 5 is the awkward one. A device that has no address cannot send a normal unicast packet, and it does not know the server's address either. The next chapters explain how DHCP solves this with broadcast messages over UDP, and how leases handle requirement 4.
Common mistakes when avoiding static configuration
- Leaving one device on an old static address inside the range that a server hands out. The server may give the same address to another client.
- Assuming that a working ping to an IP address means the settings are correct. DNS and gateway problems can still be present.
- Forgetting to record static assignments, so they are later mistaken for free addresses.
- Using static addresses on laptops "just to be safe". They fail as soon as the laptop moves.
A practical rule is to keep static addresses in a separate part of the subnet, outside any range used for automatic assignment. A /24 might use .1 to .99 for static devices and .100 to .200 for automatic ones. The example configuration in a later chapter uses exactly this split.
Exercise
A company has 300 laptops and a spreadsheet of static IP addresses. The administrator replaces the DNS server, which has a new IP address. Name two problems this causes with static configuration, and one thing that a central scheme would let the administrator do instead.
Show answer
First, every laptop must be edited by hand, which is slow and error-prone, and laptops that are off or away keep the old DNS server and lose name resolution later. Second, the spreadsheet must also be updated, and a typing mistake in any entry gives a laptop a wrong DNS address, so names fail to resolve while pings to IP addresses still work. With a central scheme, the administrator changes the DNS setting once on the server, and clients receive the new value automatically.
Exercise
A host is configured statically as 192.168.1.20 with mask 255.255.0.0 and gateway 192.168.1.1. It can reach 192.168.1.30 but not 192.168.50.10, which is on another router-connected network. Why might this happen, and what should the mask be?
Show answer
With mask 255.255.0.0 the host thinks 192.168.50.10 is on its own local network, because the first 16 bits match. It sends an ARP request for that address instead of sending the packet to the gateway, and nobody answers. If the subnet is a /24, the mask should be 255.255.255.0, so that 192.168.50.10 is recognized as remote and is sent to the gateway.