Sub topic 2
Why static configuration does not scale
This chapter assumes you know IPv4 addresses and subnet masks, what a default gateway and a DNS server do, and what a LAN and a broadcast are. It explains why typing settings into each device stops working as a network grows. That problem is what DHCP solves.
What static configuration means
With static configuration, an administrator enters every setting by hand on each device. A host needs four values before it can talk beyond its own segment:
- An IP address, unique on the network.
- A subnet mask, which tells the host which addresses are local.
- A default gateway, the router used for everything non-local.
- One or more DNS servers, used to turn names into addresses.
On a Linux host the manual 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.confThat is four commands for one host. Static configuration is fine for a handful of devices. Servers, routers, and printers often keep static addresses on purpose, because other devices need to find them at a known address.
Where it breaks down
The problems grow with the number of devices and with how often they change.
| Problem | What happens |
|---|---|
| Duplicate addresses | Two hosts get the same IP. Both lose connectivity at random, and ARP tables flip between the two MAC addresses. |
| Typing errors | A wrong mask or gateway gives a host that reaches some devices but not others. These faults are hard to spot. |
| Mobile devices | A laptop moved to another network or subnet needs new settings every time. Phones would need this daily. |
| Bookkeeping | Someone must record which address belongs to which device, and keep the record current. |
| Network changes | If the gateway or DNS server changes, every device must be edited again. |
| Reclaiming addresses | A retired device keeps its address reserved until someone remembers to free it. |
Consider a network of 300 devices on a /23 subnet. Changing the DNS server means 300 manual edits. If one is missed, that device fails in ways that look unrelated to DNS.
Tracking addresses by hand
Some administrators keep a spreadsheet of assigned addresses. A short script can at least check a proposed address against that record.
assigned = {
"192.168.1.50": "printer-2f",
"192.168.1.51": "camera-lobby",
"192.168.1.52": "nas-01",
}
def request_address(ip, device):
if ip in assigned:
print(f"Conflict: {ip} is already used by {assigned[ip]}")
return False
assigned[ip] = device
print(f"Assigned {ip} to {device}")
return True
request_address("192.168.1.52", "laptop-anna")
request_address("192.168.1.60", "laptop-anna")This catches conflicts only if the record is correct. It cannot detect a device someone configured without updating the list. The record is also a second thing to maintain, and it goes stale.
What a better approach needs
The failures above point to what an automatic system must do:
- Hand out addresses from a central pool, so no two devices receive the same one.
- Deliver the mask, gateway, and DNS server together with the address, so settings are never typed per device.
- Take addresses back when a device leaves, so the pool does not run out.
- Let an administrator change a setting once and have every device pick it up.
- Still allow fixed addresses for devices that need them.
The Dynamic Host Configuration Protocol (DHCP) does all five. A server holds the pool and the settings. A client asks for them when it joins the network and receives them on loan, for a limited time.
The next chapters follow this exchange in detail, starting with the overview of clients, servers, and leases.
Exercise
A network has 200 laptops that move between offices. The administrator replaces the DNS server with a new one at a different address. Name two problems static configuration causes here, and one DHCP feature that removes each.
Show answer
First, every laptop must be edited by hand to use the new DNS server, and any missed laptop fails to resolve names. With DHCP, the administrator changes the DNS option once on the server and clients pick it up when they get or renew a lease. Second, laptops moving between offices need new addresses and gateways for each subnet. With DHCP, each laptop receives suitable settings from the pool automatically when it joins the network. Duplicate addresses and stale records are also acceptable answers, because the central pool prevents duplicates and expired leases return addresses to it.