DHCP - How Your Device Gets an IP Address

The automatic address-assignment system built into your router

What Is DHCP?

DHCP stands for Dynamic Host Configuration Protocol. In plain English, it's a service that automatically gives each device on your network a unique IP address and other settings it needs to get online.

Think of it like a reception desk at a hotel. When you check in (connect to the network), the receptionist (DHCP server) gives you a room number (IP address) and tells you where the exit is (gateway) and where to find the phone directory (DNS).

Why Does DHCP Exist?

Without DHCP, you would have to manually go into each device's network settings and type in an IP address, subnet mask, gateway, and DNS server. For every single device. On every network you connect to.

Worse, if two devices accidentally used the same IP address, both would stop working. That's called an IP conflict. DHCP prevents this by keeping track of which addresses have already been handed out.

Where Is the DHCP Server?

In a home network, the DHCP server is built into your router. You don't need to install anything - it's running by default. When you buy a new router and plug it in, it's already ready to hand out IP addresses to your phone, laptop, TV, and anything else that connects.

In offices and large networks, there might be a dedicated DHCP server (a separate computer), but the concept is the same.

What Exactly Does DHCP Give Your Device?

When your device connects, DHCP provides four key pieces of information:

  1. IP AddressYour device's unique address on the network, like 192.168.1.15. More Info… - Your unique address on the network
  2. Subnet Mask - Defines which addresses are on your local network
  3. Default GatewayYour router's address on the local network, like 192.168.1.1. All internet traffic goes through it. More Info… - The exit door to the internet (your router)
  4. DNS ServerTranslates website names into IP addresses. More Info… - The internet's phone book

DHCP Leases - Your IP Isn't Permanent

DHCP doesn't give your device an IP address forever. It leases it - like renting a parking spot. Each lease has a time limit (often 24 hours on home networks).

When the lease is about halfway through, your device quietly asks the router: "Can I keep this address?" The router usually says yes and renews the lease. You never notice this happening.

If a device disconnects and doesn't renew, its address goes back into the pool and can be given to a new device. This is why your phone might get a different local IP address if you reconnect to WiFi after being away for a while.

The DHCP Process (4 Steps)

Network engineers call this the DORA process:

  1. Discover - Your device broadcasts: "Is there a DHCP server here?"
  2. Offer - The router responds: "Here's an IP address you can use"
  3. Request - Your device replies: "I'll take that one, please"
  4. Acknowledge - The router confirms: "It's yours. Enjoy!"

This whole process uses UDPA fast messaging protocol used when speed matters more than guaranteed delivery. More Info… broadcasts and happens in milliseconds.

Fun fact: DHCP has to use UDP broadcasts because at the start of this process, your device doesn't have an IP address yet - so it can't establish a direct connection with anyone. Broadcasting is the only option.