Network security

What Is DHCP? How Your Devices Get an IP Address

Every phone, laptop and printer on your network gets its address from DHCP in under a second. Here is how the protocol works, why leases expire, and where it can be attacked.

Cysoro Security TeamPublished · 9 min read
192.168.1.1 LAPTOP192.168.1.24lease: 24 hours PHONE192.168.1.37lease: 24 hours PRINTER192.168.1.50reserved NETWORK SECURITY DHCP Your address, delivered. How every device gets online in under a second
Quick answer

DHCP, the Dynamic Host Configuration Protocol, automatically assigns IP addresses and network settings to devices when they join a network. Defined in RFC 2131, it replaces manual configuration: a device broadcasts a request, a server offers an address with a subnet mask, gateway and DNS servers, and the device accepts it on a time-limited lease. Without DHCP, every phone, laptop and printer would need its settings typed in by hand.

Key takeaways

  • DHCP assigns IP addresses, subnet masks, gateways and DNS servers automatically, using the four-step DORA exchange over UDP ports 67 and 68.
  • Addresses are loans called leases, renewed at 50 percent and 87.5 percent of their lifetime, so addresses are reused when devices leave.
  • DHCP trusts any server that answers, so rogue servers and starvation attacks are real risks — DHCP snooping on managed switches stops both.

You connect a new phone to Wi-Fi and it just works — no typing in addresses, no setup. The reason is a quiet protocol that has run every network since the 1990s: DHCP hands each device its address and settings in under a second, then takes the address back when the device leaves.

What is DHCP?

DHCP, the Dynamic Host Configuration Protocol, is the network protocol that automatically assigns IP addresses and essential configuration to devices the moment they connect to a network. It is defined in RFC 2131, published in March 1997, and built on the older BOOTP protocol.

A device cannot use a network until it has four pieces of information: its own address, the subnet mask that says how big the local network is, the address of the router that leads out, and the address of a DNS server that turns names into numbers. DHCP delivers all four at once, along with extras such as the local domain name and the length of time the address may be kept.

Without DHCP, someone would have to type those settings into every phone, laptop, television and printer by hand — and fix the mistakes when two devices ended up with the same address. DHCP removes that work entirely.

It runs on home routers, office networks and data centers alike, and it is the reason a network with hundreds of devices can be managed from one place. You can see your own current address with our free what-is-my-IP tool.

How does DHCP work?

DHCP works through a four-step exchange remembered by its initials: DORA — Discover, Offer, Request, Acknowledge. The whole conversation runs over UDP, with the server listening on port 67 and the client on port 68, and it usually finishes in under a second.

DORA: the four steps that get a device online1Discoverclient broadcastsDHCPDISCOVER0.0.0.0 to 255.255.255.2552Offerserver replies withDHCPOFFER: an addressplus settings3Requestclient broadcastsDHCPREQUEST, pickingone offer4Acknowledgeserver confirms withDHCPACK — the clientis now onlineServers use UDP port 67; clients use UDP port 68. The whole exchange takes under a second.
The DORA exchange: four messages and a device is on the network. Illustration by Cysoro.

1. Discover

The new device has no address, so it shouts: it broadcasts a DHCPDISCOVER message from 0.0.0.0 to 255.255.255.255, which means every device on the local network. The broadcast goes to UDP port 67, where DHCP servers listen.

2. Offer

Any DHCP server that hears the broadcast may answer with a DHCPOFFER, proposing an available address plus the subnet mask, gateway, DNS servers and lease length. If several servers answer, the client picks one — usually the first to reply.

3. Request

The client broadcasts a DHCPREQUEST naming the server it chose. The broadcast is deliberate: RFC 2131 says the other servers read it as notice that their offers were declined, so they return those addresses to their pools.

4. Acknowledge

The chosen server records the lease and replies with a DHCPACK. The client configures its interface and starts communicating. Before using the address, the client should check that nobody else already has it — if a conflict shows up, it sends a DHCPDECLINE and starts over.

There are two supporting messages worth knowing. DHCPINFORM lets a device that already has a static address ask for the other settings, such as DNS servers. And a DHCP server on another subnet can still serve a client, because a router or switch in between acts as a relay agent and forwards the broadcasts.

What information does DHCP give a device?

DHCP assigns an IP address plus the settings a device needs to use it: the subnet mask, the default gateway, DNS server addresses, the domain name and the lease time. These travel as numbered options defined in RFC 2132.

OptionWhat it carriesExample
Option 1Subnet mask255.255.255.0
Option 3Router (default gateway)192.168.1.1
Option 6Domain name servers (DNS)1.1.1.1, 8.8.8.8
Option 15Domain nameoffice.example.com
Option 51IP address lease time (seconds)86400 (24 hours)
Option 54Server identifier192.168.1.1

The option system is what makes DHCP flexible: a network can hand out time servers, boot file locations, VoIP server addresses and dozens of other settings in the same exchange. Your router's admin page usually exposes the most common ones — DNS servers and lease time — and hides the rest.

What is a DHCP lease, and how does renewal work?

A DHCP lease is the time-limited assignment of an IP address to a client. The address is a loan, not a gift: the server lends it for a set period, and the client must renew before the period ends or lose the address.

Renewal is automatic and happens at two fixed points in the lease. At half the lease lifetime (T1, 50 percent), the client contacts the original server directly and asks to extend. If that fails, at 87.5 percent (T2) the client broadcasts its request to any server. If nobody answers by expiry, the client must stop using the address and start the DORA process from scratch.

The life of a DHCP leaseLease grantedDHCPACK receivedT1: 50%renew with the sameserver (unicast)T2: 87.5%rebind: ask anyserver (broadcast)Expiryaddress mustbe releasedExample: a 24-hour lease renews after 12 hours and rebinds after 21 hours.Most renewals succeed at T1, so users never notice the lease at all.
Lease renewal timing in DHCP: renew at half the lease, rebind at 87.5 percent, release at expiry. Illustration by Cysoro.

Lease length is a trade-off. Short leases — a day is typical at home — free addresses quickly when guests leave, but create more chatter. Long leases are quieter and more stable, which suits offices where the same laptops return every day. RFC 2131 measures lease time in seconds and reserves the value 0xffffffff for an infinite lease, though that is rarely used.

RFC 2131 defines three allocation methods. Dynamic allocation lends an address for a limited time and is the only method that automatically reuses an address when the client no longer needs it. Automatic allocation assigns a permanent address chosen by the server. Manual allocation hands out an address the administrator chose for that device — the mechanism behind a DHCP reservation, which always gives a printer or camera the same address.

DHCP vs static IP: which should you use?

Use DHCP for almost everything, and static addresses or reservations only for devices other machines need to find at a fixed address. That split gives you the convenience of automatic configuration where it helps and stability where it matters.

DHCPStatic IP
Setup effortNone per deviceManual, per device
Address conflictsPrevented by the serverEasy to cause by typing error
Address reuseAutomatic when devices leaveManual cleanup needed
Best forPhones, laptops, guests, IoTPrinters, cameras, servers, routers
ManagementCentral, from the serverSpreadsheet or memory

A DHCP reservation is the best of both: the device always receives the same address, but the assignment is still managed centrally on the server. Reserve addresses for printers, network cameras, NAS boxes and servers, and let everything else take whatever the pool offers. For the network itself, our guide to securing your Wi-Fi covers the router settings that matter alongside DHCP.

What is DHCPv6, and how is it different?

DHCPv6 is the version of DHCP for IPv6 networks. It is defined in RFC 9915, published in January 2026, which obsoletes the earlier RFC 8415 from November 2018. It can work alongside IPv6 stateless address autoconfiguration (SLAAC) or replace it.

The exchange is similar in shape but has different names: Solicit, Advertise, Request and Reply. IPv6 has no broadcast, so clients use a multicast address that all DHCPv6 servers listen on, and the ports change to UDP 546 for the client and UDP 547 for the server.

The biggest practical difference is that IPv6 devices can configure themselves. With SLAAC, a device builds its own address from the network prefix the router advertises, and only uses DHCPv6 for extra settings such as DNS servers — a mode called stateless DHCPv6. With stateful DHCPv6, the server assigns addresses just like DHCPv4 does, and can also delegate whole prefixes to routers. Most home networks use SLAAC plus stateless DHCPv6 and never need the stateful mode.

What are the security risks of DHCP?

DHCP has no authentication: a client trusts any server that answers. That trust is the protocol's main weakness, and three attacks exploit it — rogue servers, starvation and misconfiguration.

A rogue DHCP server is an unauthorized server plugged into the network, sometimes a misconfigured device, sometimes deliberate. It hands out a malicious gateway address, so all traffic flows through the attacker's machine. A starvation attack floods the real server with fake requests until the address pool is empty, so legitimate devices get nothing. Both are cheap to run and hard to notice until users complain.

The defenses are switch features, not client settings. DHCP snooping on managed switches only allows DHCP replies from trusted ports, which kills rogue servers outright. Dynamic ARP inspection stops devices spoofing addresses handed out by DHCP. Add port security so unknown devices cannot join trusted network segments, and keep the DHCP server patched — it is a high-value target because it knows every device on the network.

At home, the risk is lower: your router is usually the only DHCP server, and the main danger is a compromised IoT device or a neighbor on an open guest network. Keep guest devices on a separate network, as our Wi-Fi security guide explains, and change the router's default admin password.

How do you troubleshoot DHCP problems?

Start with the symptom: a device that says connected but loads nothing, or shows an address starting with 169.254, has almost certainly failed to get a DHCP lease. That self-assigned 169.254 address means no server answered.

  1. Renew the lease. On Windows run ipconfig /release then ipconfig /renew; on macOS toggle Wi-Fi off and on; on Linux run sudo dhclient -r then sudo dhclient.
  2. Restart the router or DHCP server. This clears a stuck service and is the fix more often than anyone admits.
  3. Check the pool. If the scope is exhausted — too many devices for too few addresses — shorten the lease time or enlarge the pool.
  4. Look for a rogue server. If some devices work and others get wrong gateways or DNS servers, a second DHCP server is answering. Check for a second router or an access point with DHCP still on.
  5. Check the relay. On networks with several subnets, a missing or misconfigured relay agent leaves whole segments without addresses.
  6. Check the client. A device with a manually set static address in the DHCP range will conflict; move it to a reservation outside the pool.

If the problem follows one device everywhere, the fault is on that device: a corrupted network stack, a VPN client holding the interface, or a firewall blocking UDP ports 67 and 68. If it follows one location, the fault is the network: the server, the relay or the switch in between. You can confirm what address and DNS servers a device actually received with our free DNS lookup tool.

The bottom line

DHCP is the reason networks scale: one server, one pool of addresses, and every device configured in under a second with no typing and no conflicts. Understand DORA, leases and reservations, and you understand most of what can go wrong on a local network.

For a home or small office, the practical steps are short: let the router run DHCP, reserve addresses for printers and servers, keep the lease around a day, and keep guests on their own network. On a business network, add DHCP snooping and dynamic ARP inspection so no rogue server can hijack your clients. Check your own setup with the free what-is-my-IP tool.

Frequently asked questions

What does DHCP stand for?

DHCP stands for Dynamic Host Configuration Protocol. It is defined for IPv4 in RFC 2131, published in March 1997, with its options defined in RFC 2132. For IPv6, the equivalent protocol is DHCPv6, defined in RFC 9915.

What happens if DHCP is not working?

Devices cannot get an IP address, so they usually fall back to a self-assigned address in the 169.254 range and cannot reach the internet or local servers. The fix is usually to restart the router or DHCP server, check that the address pool is not exhausted, and renew the lease on the device.

What is the difference between DHCP and DNS?

DHCP gives a device its IP address and network settings so it can communicate. DNS translates human-readable names such as www.example.com into IP addresses. DHCP hands out the DNS server address as one of its settings, so the two work together but do different jobs.

What is a DHCP lease?

A lease is a time-limited assignment of an IP address to a device. The server lends the address for a set period, measured in seconds. The device renews the lease before it expires, and when the device leaves the network the address returns to the pool for reuse.

Should I use DHCP or a static IP address?

Use DHCP for phones, laptops, guests and anything that moves. Use static addresses, or DHCP reservations, for printers, cameras, servers and anything other devices need to find at a fixed address. Reservations give you the stability of a static address with the central management of DHCP.

Is DHCP secure?

DHCP itself has no authentication, so a rogue server on your network can hand out wrong settings and redirect traffic. On business networks, enable DHCP snooping on managed switches, use dynamic ARP inspection, and keep unknown devices off trusted network segments.

What ports does DHCP use?

DHCP uses UDP port 67 on the server and UDP port 68 on the client. These port numbers come from the older BOOTP protocol that DHCP is built on, and they have not changed since RFC 2131 was published.

What is DHCPv6?

DHCPv6 is the version of DHCP for IPv6 networks, defined in RFC 9915. It uses a four-message exchange called Solicit, Advertise, Request and Reply, and it can work alongside IPv6 stateless address autoconfiguration, known as SLAAC, or replace it.

Sources

  1. IETF — RFC 2131: Dynamic Host Configuration Protocol
  2. IETF — RFC 8415: Dynamic Host Configuration Protocol for IPv6 (DHCPv6)
  3. IETF — RFC 9915: Dynamic Host Configuration Protocol for IPv6 (DHCPv6)
  4. ManageEngine — What is DHCP?
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against RFC 2131 for DHCPv4, RFC 9915 for DHCPv6 and vendor documentation of DHCP behavior.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free