Network security

What Is a DHCP Server? How It Assigns IP Addresses and Leases

A DHCP server hands every device on your network an IP address and the settings it needs to get online — automatically, in under a second.

Cysoro Security TeamPublished · 9 min read
DHCP SERVER192.168.1.100lease: 24 hoursgateway: .1 DNS: .53NETWORK SECURITYDHCPserverYour network, auto-configured.
Quick answer

A DHCP server is a network service that automatically assigns IP addresses and related settings — subnet mask, default gateway and DNS servers — to devices when they join a network. It hands out each address on a temporary lease from a pool, tracks which device holds which address, and reclaims the address when the lease expires, so you never configure devices by hand.

Key takeaways

  • A DHCP server assigns IP addresses, subnet masks, gateways and DNS servers automatically, using the four-step DORA exchange.
  • Leases are temporary: clients renew at half the lease time, and expired addresses return to the pool for reuse.
  • DHCP has no built-in authentication, so rogue servers and starvation attacks are real risks — DHCP snooping and reservations are the main defenses.

Plug a laptop into a network and it is online within seconds. Nobody typed in an IP address, a gateway or a DNS server. That quiet automation is a DHCP server at work — and when it breaks or gets abused, every device on the network feels it.

What is a DHCP server?

A DHCP server is a network service that automatically assigns IP addresses and network settings to devices when they join a network. It keeps a pool of available addresses, lends one to each device for a set time, and takes it back when the device leaves.

DHCP stands for Dynamic Host Configuration Protocol. The protocol is defined in RFC 2131, published in March 1997, and it builds on the older BOOTP protocol. The IPv6 version, DHCPv6, is defined in RFC 8415.

The server does more than hand out an address. A typical lease also delivers the subnet mask, the default gateway, DNS server addresses, the domain name, and sometimes the address of a time server. Without those, a device would have an address but no route to the internet and no way to resolve names.

Almost every network uses one. Your home router runs a DHCP server, your office network runs one, and your internet provider runs one for its customers. Many routers and residential gateways have DHCP server capability built in.

How does a DHCP server work?

When a device joins a network, it has no IP address, so it cannot send a message to a specific server. Instead it broadcasts a request, and a DHCP server answers with an offer. The whole exchange is called DORA.

The DORA exchange — four messages, under a second1DiscoverClient broadcasts:is there a server?DHCPDISCOVER2OfferServer replies withan address + settingsDHCPOFFER3RequestClient accepts oneoffer, by broadcastDHCPREQUEST4AcknowledgeServer confirmsthe lease startsDHCPACKServer listens on UDP 67, client on UDP 68. The first message is a broadcast to 255.255.255.255.
The DORA exchange between a DHCP client and server. Illustration by Cysoro.

The four DORA steps

1. Discover. The client broadcasts a DHCPDISCOVER message to 255.255.255.255 from 0.0.0.0, because it has no address yet. Any DHCP server on the local segment can hear it.

2. Offer. Each available server replies with a DHCPOFFER: a proposed IP address, lease duration, subnet mask, gateway and DNS servers.

3. Request. The client picks one offer and broadcasts a DHCPREQUEST accepting it. The broadcast also tells the other servers their offers were declined, so they can return those addresses to their pools.

4. Acknowledge. The chosen server sends a DHCPACK confirming the assignment, and the lease starts. If the server cannot honor the request, it sends a DHCPNAK and the client starts over.

DHCP uses UDP port 67 on the server and UDP port 68 on the client. Because the first messages are broadcasts, they do not cross routers on their own. Larger networks use a DHCP relay agent, usually on the router, to forward requests to a central server on another subnet.

What is a DHCP lease and how does renewal work?

A lease is a temporary loan of an IP address. The server records which device holds which address, and the client must renew the lease before it runs out. When a lease expires unused, the address goes back into the pool.

Renewal is automatic. The client tries to renew with its original server after half the lease time has passed — the T1 timer, 50% of the lease. If that fails, it tries again later and eventually broadcasts to any server at 87.5% of the lease, the T2 timer.

Typical lease times vary. Home routers often use 24 hours. Business networks often use 8 hours, so addresses are reclaimed quickly when laptops leave. Guest networks may use 1 hour. Short leases recycle addresses faster but create more DHCP traffic; long leases are quieter but slower to free addresses.

When a device disconnects cleanly, it can send a DHCPRELEASE to give the address back early. Most devices simply let the lease expire instead, which is fine — the server reclaims it anyway.

What are the three ways a DHCP server assigns addresses?

RFC 2131 defines three allocation mechanisms, and most real networks mix them. Knowing the difference matters when you need a device to keep the same address.

MethodHow it worksAddress changes?Best for
Dynamic allocationAddress leased from a pool for a limited time, then returnedYes, over timeLaptops, phones, guest devices
Automatic allocationAddress assigned permanently from the pool, no expiryNoStable desktops on small networks
Manual allocation (reservation)Admin maps a specific address to a device, usually by MAC addressNoPrinters, servers, cameras, NAS

Dynamic allocation is the default almost everywhere. It is the only method that automatically reuses an address a client no longer needs, which is why it suits devices that connect only temporarily.

Reservations are the practical middle ground. The device still gets its settings from DHCP, so you manage everything in one place, but it always receives the same address. Use a reservation for anything other devices need to find reliably, such as a printer or a file server.

DHCP vs static IP: which should you use?

Use DHCP for almost everything and static addresses only where a fixed address is genuinely needed. Hand-configuring every device invites typos, duplicate addresses and hours of troubleshooting.

Static IPs suit servers, network printers, security cameras, routers and any device that other systems reach by address. A server that moves address every few days breaks bookmarks, firewall rules and monitoring.

DHCP suits everything else: laptops, phones, tablets, smart TVs and guest devices. If a device needs a stable address but you still want central management, give it a DHCP reservation instead of a true static address.

One common mistake is mixing the two without planning. If you assign static addresses from inside the DHCP pool, the server may hand that address to another device and create a conflict. Keep static addresses and reservations outside the dynamic pool, or exclude them from it.

How is DHCPv6 different from DHCPv4?

DHCPv4, defined in RFC 2131, serves IPv4 networks with 32-bit addresses. DHCPv6, defined in RFC 8415, serves IPv6 networks with 128-bit addresses. The ideas are the same; the messages and options differ.

The biggest practical difference is that IPv6 devices can also configure themselves without a server, using SLAAC (Stateless Address Autoconfiguration). With SLAAC, a device builds its own address from the network prefix the router advertises.

Many IPv6 networks use both: SLAAC for the address, and DHCPv6 for extra settings such as DNS servers — a mode called stateless DHCPv6. Stateful DHCPv6, which assigns addresses like DHCPv4 does, is used when administrators want the same control and logging they have on IPv4.

If you run a dual-stack network, you manage two services. Do not assume your IPv4 DHCP controls, such as snooping, automatically cover IPv6. Rogue DHCPv6 and rogue router advertisements are a separate risk to check.

Is a DHCP server a security risk?

Yes — DHCP was designed for convenience, not security. It has no authentication, so a client accepts the first plausible answer it receives. That trust gap creates two well-known attacks.

Rogue DHCP server. An attacker — or a misconfigured device — answers DHCP requests faster than the real server. It hands out its own address as the default gateway and DNS server, so traffic flows through the attacker. This is a classic man-in-the-middle setup.

DHCP starvation. An attacker floods the server with requests using spoofed MAC addresses until the address pool is empty. No genuine device can then get an address, which is a denial of service for the whole segment. Starvation is often the first step before a rogue server takes over.

Accidents cause the same outages as attacks. A second router plugged into the office network, a test server, or a phone sharing its connection can all start handing out wrong addresses and take a floor offline in minutes.

Rogue DHCP: how it works, and what stops itThe attackRogue server answers first, handing outitself as gateway and DNS — traffic is intercepted.The defense: DHCP snoopingSwitch blocks server replies on untrustedports; only uplinks to the real server are trusted.Starvation attackFlood of fake MAC addresses drainsthe pool, so real devices get no address.More defensesPort security, rate limiting, IP SourceGuard, and auditing the lease table.
Rogue DHCP servers and starvation attacks, and the controls that stop them. Illustration by Cysoro.

How do you secure a DHCP server?

Start at the switch, not the server. DHCP snooping is the main control: the switch watches DHCP traffic, blocks server replies arriving on untrusted user ports, and builds a binding table of legitimate leases. Only uplinks to the real DHCP server are marked trusted.

Add port security to limit how many MAC addresses can appear on one port, and rate-limit DHCP messages so a flood cannot drain the pool in seconds. IP Source Guard goes a step further by only allowing traffic from addresses in the snooping binding table.

On the server itself, keep the pool sized to the network, use reservations for fixed devices, and audit the lease table regularly for unfamiliar MAC addresses. A sudden jump in leases, or leases to devices you do not recognize, deserves investigation.

At home, the risk is smaller but real. Change the router admin password, keep its firmware updated, and do not plug an unknown router or extender into your network. If devices suddenly get addresses in a range you did not configure, suspect a second DHCP server. Our guide to how to secure your Wi-Fi covers the home-network basics that sit around DHCP.

Watch for 169.254.x.x addressesIf a device gets a 169.254 address, it could not reach a DHCP server at all. Check the cable or Wi-Fi, then check whether the DHCP server or its pool is down — do not just reboot and hope.

How do you troubleshoot DHCP problems?

Most DHCP problems show up as one device, or every device, failing to get online. Work from the client outward, and check the lease before you blame the network.

  1. Check the address. On Windows run ipconfig; on macOS or Linux run ip addr. A 169.254.x.x address means no DHCP reply arrived.
  2. Release and renew. Run ipconfig /release then ipconfig /renew on Windows, or disconnect and reconnect to Wi-Fi. This forces a fresh DORA exchange.
  3. Check the pool. On the server or router, look at the lease table. A full pool, or a pool full of unfamiliar devices, points to starvation or a rogue device.
  4. Check for a second server. If addresses come from a range you did not configure, another device is answering DHCP. Unplug suspects one at a time.
  5. Check the relay. If only one subnet is affected, the relay agent or the path to the central server is the likely fault, not the server itself.
  6. Check the lease time. Very short leases on a busy network can flood the server with renewals; very long leases can leave the pool full of stale entries.

To see what your own device actually received, check your current address with our what is my IP tool.

When name resolution fails alongside DHCP, the DHCP specification in RFC 2131 is the reference for what the server should have sent.

The bottom line

A DHCP server is the quiet service that makes a network usable: it assigns addresses, gateways and DNS settings automatically, reclaims them when leases expire, and keeps hundreds of devices from colliding. You rarely notice it until it stops working or someone abuses it.

Treat it as infrastructure worth protecting, not a set-and-forget router feature. Use reservations for fixed devices, keep pools sized to the network, and turn on DHCP snooping on managed switches. You can check the network settings your own connection is using right now with the free what is my IP tool.

Frequently asked questions

What is a DHCP server in simple terms?

It is the service on your network that gives each device an IP address and the settings it needs to get online, such as the gateway and DNS servers. Without it, you would have to type those settings into every phone, laptop and printer by hand.

What is the difference between a DHCP server and a DNS server?

A DHCP server assigns IP addresses and network settings to devices. A DNS server translates domain names like example.com into IP addresses. They work together: DHCP usually tells devices which DNS server to use.

What port does DHCP use?

DHCP uses UDP port 67 on the server and UDP port 68 on the client. The client broadcasts its first request because it has no IP address yet, and the server replies to port 68.

What is a DHCP lease?

A lease is a temporary grant of an IP address for a set time, often 8 hours on a business network or 24 hours at home. The client renews it automatically, usually after half the lease time has passed, and the address returns to the pool when the lease expires.

What happens if the DHCP server goes down?

New devices cannot get an IP address and cannot join the network. Devices with a valid lease keep working until that lease expires. On Windows, a device that cannot reach a DHCP server may fall back to a 169.254.x.x address, which only works for local communication.

Is DHCP secure?

Not by itself. DHCP has no authentication, so a rogue server can hand out a fake gateway and DNS server and intercept traffic. The main defenses are DHCP snooping on managed switches, port security, and keeping unknown devices off trusted network ports.

What is DHCP vs static IP?

DHCP assigns addresses automatically and temporarily, which suits most devices. A static IP is typed in by hand and never changes, which suits servers, printers and network equipment that other devices must always find at the same address.

Do I need a DHCP server at home?

Almost certainly you already have one: it runs inside your home router. It assigns addresses to your phones, laptops and smart devices, usually in a range like 192.168.1.100 to 192.168.1.200.

Sources

  1. IETF — RFC 2131, Dynamic Host Configuration Protocol
  2. IETF — RFC 8415, DHCPv6
  3. ManageEngine — What is DHCP?
  4. Cisco — DHCP Starvation Attacks
  5. ITU Online — DHCP Snooping: Stop Rogue DHCP Servers
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 8415 for DHCPv6, and Cisco guidance on DHCP starvation and snooping.

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