HackMyIP
← back to sheets

What Is DHCP? Meaning, How It Works, DORA, Leases and DHCPv6

~/sheets/what-is-dhcp.md
1

What DHCP Means

2

DHCP stands for Dynamic Host Configuration Protocol. It is the standard network service, defined in RFC 2131, that automatically gives every device that joins a network the settings it needs to communicate: an IP address, a subnet mask, a default gateway, and DNS servers. Without DHCP, someone would have to type those four values into every phone, laptop, printer, and TV by hand. With it, a device joins a Wi-Fi network and simply works. That automatic handout is the whole meaning of DHCP.

3

A DHCP server, usually built into your home router, keeps a pool of addresses and leases one to each device that asks. The private address DHCP gives your device on the local network is separate from the single public address your router presents to the internet. You can see that public address on our IP Lookup and on the home page.

4

The DORA Process: How DHCP Assigns an Address

5

DHCP assigns an address through a four-message exchange known as DORA:

6

Discover — the new device broadcasts a DHCPDISCOVER because it has no address yet and does not know where the server is. Offer — one or more DHCP servers reply with a DHCPOFFER proposing an available address. Request — the device broadcasts a DHCPREQUEST naming the specific offer it wants to accept (so any other servers know their offers were declined). Acknowledge — the chosen server sends a DHCPACK, records the assignment, and the device can start using the address.

7

DHCP runs over UDP: the server listens on port 67 and the client on port 68 (per RFC 2131). Besides the four DORA messages, DHCP also defines DHCPNAK (the server refuses a request), DHCPDECLINE (the client found the address already in use), DHCPRELEASE (the client gives an address back early), and DHCPINFORM (a device with a static address asks only for extra settings like DNS).

8

DHCP Leases and the Renew and Rebind Timers

9

A DHCP address is not permanent — it is a lease for a limited time. The lease length is set by the network administrator (commonly hours to days, and it varies by network). The client does not wait for the lease to run out before acting. RFC 2131 defines two timers relative to the lease length:

10

T1, the renewal timer, defaults to 50% of the lease. At T1 the client quietly unicasts a DHCPREQUEST to the server that gave it the address, asking to extend, and usually keeps the same address. T2, the rebinding timer, defaults to 87.5% of the lease. If the original server never answered by T2, the client broadcasts a DHCPREQUEST to any server that will take it. If nothing answers before the lease fully expires, the device gives up the address and starts a fresh DORA. Leasing plus these timers is what lets a network with a limited pool serve many devices that come and go.

11

What a DHCP Server Actually Hands Out (Option Codes)

12

The address itself travels in the packet header, but everything else DHCP configures is carried in numbered options defined by RFC 2132 and the IANA BOOTP/DHCP registry. A few you will meet often:

13
OptionName (RFC 2132)What it sets
1Subnet MaskThe size of the local network
3RouterThe default gateway
6Domain Name ServerThe DNS resolvers to use
12Host NameThe device name the client offers (a privacy note below)
51IP Address Lease TimeHow long the lease lasts
53DHCP Message TypeWhich DORA message this is (1 Discover through 8 Inform)
55Parameter Request ListThe list of options the client is asking the server for
14

Option 6 is the reason changing DNS is often done at the router: hand out a different resolver there and every device on the network picks it up on its next lease. If you want to confirm which resolver is actually answering you, use our DNS Leak Test, and see the trade-offs in best DNS servers.

15

DHCP Across Subnets: the Relay Agent

16

DHCP discovery is a broadcast, and broadcasts do not cross routers. In a larger network with many subnets you do not put a DHCP server on every one — instead a relay agent (built into the router or switch) forwards the client broadcast to a central server as a unicast, stamping the request with the gateway address (the giaddr field) so the server knows which subnet to pick a pool from. This is how one DHCP server can serve an entire building.

17

DHCPv6: How DHCP Works for IPv6

18

IPv6 has its own version, DHCPv6 (RFC 8415), and it works differently:

19
DHCP (IPv4)DHCPv6
SpecRFC 2131RFC 8415
ExchangeDiscover, Offer, Request, AckSolicit, Advertise, Request, Reply
Ports (UDP)67 server, 68 client547 server/relay, 546 client
Reaches the server viaBroadcastMulticast (ff02::1:2)
Client identityHardware (MAC) basedDUID (DHCP Unique Identifier)
20

On IPv6, DHCPv6 is not always the whole story. Many IPv6 networks use SLAAC (Stateless Address Autoconfiguration, RFC 4862), where the device builds its own address from a prefix the router advertises, and use DHCPv6 only for extra settings like DNS. Router Advertisement flags tell the host whether to use stateful DHCPv6, SLAAC, or both — the two can run side by side.

21

DHCP, Security and Your Privacy

22

The base DHCP protocol has no built-in authentication — a client believes whichever server answers first. That design choice is the root of two classic attacks. A rogue DHCP server is an unauthorized server (an attacker, or an accidental second router) that answers Discovers with a malicious gateway or DNS, which can quietly route or spy on traffic. DHCP starvation floods the server with fake requests to drain the address pool so real devices cannot get on. The standard defense on managed networks is DHCP snooping, a switch feature that only trusts DHCP server replies arriving on ports you have marked as trusted and drops them everywhere else.

23

On the privacy side, remember that your client sends data too: the host name (option 12) and client identifier (option 61) it offers can reveal a device or person by name to whoever runs the network you join. On an untrusted network, a generic device name leaks less. See what your ISP sees for the broader picture.

24

Does DHCP Hide or Change Your Public IP? No.

25

A common mix-up: DHCP assigns the private address your device uses on the local network (often something like 192.168.x.x), not the public IP the world sees. Renewing a DHCP lease does not hide you, change your location, or give you a new public address — your ISP controls that. If your goal is actually changing your public IP, see how to change your IP address. To see the two side by side, check the private address in your device settings against the public one shown on HackMyIP and IP Lookup.

26

How to See Your Own DHCP Lease

27

On Windows, run ipconfig /all in a terminal; it typically shows fields like "DHCP Enabled", "Lease Obtained", "Lease Expires", and "DHCP Server" (your router). ipconfig /release then ipconfig /renew forces a fresh DORA. On macOS, System Settings then Network then Details then TCP/IP shows "Configure IPv4: Using DHCP" and a renew button. On Linux, nmcli or dhclient handle release and renew. In every case the address you see there is the DHCP-assigned private one; the public one still lives on the IP Lookup.

28

DHCP vs a Static IP

29

A static IP is set manually on the device and never changes, while a DHCP-assigned address is dynamic and managed centrally. DHCP is ideal for ordinary devices because it is automatic and avoids address conflicts. A static address is useful for something that other devices need to find reliably, like a printer, a NAS, or a server you are forwarding a port to. Many routers offer a middle ground called a DHCP reservation, where the server always hands the same device the same address, giving static-like stability with central management.

30

Should You Turn Off DHCP?

31

For almost all home networks, no. DHCP is what makes devices connect effortlessly, and disabling it means configuring every device by hand, which invites mistakes and address conflicts. The main reason to disable it is to avoid running two DHCP servers on the same network, for example when you add a second router and want the first one to keep handing out addresses. Outside that case, leaving DHCP on is the right default.

32

Frequently Asked Questions

33

What does DHCP mean?

34

DHCP means Dynamic Host Configuration Protocol. It is the network service, defined in RFC 2131, that automatically assigns an IP address plus a subnet mask, default gateway, and DNS servers to every device that joins a network, so no one has to configure those values by hand.

35

How does DHCP work?

36

A DHCP server, usually built into the router, holds a pool of addresses and hands one to each device that asks through a four-message exchange called DORA (Discover, Offer, Request, Acknowledge). Along with the address it supplies the subnet mask, gateway, and DNS servers. The address is a time-limited lease that the device renews before it expires.

37

What is the DHCP DORA process?

38

DORA is the four-message exchange DHCP uses to assign an address: Discover, where the device broadcasts a request, Offer, where a server offers an available address, Request, where the device names the offer it wants, and Acknowledge, where the server confirms the assignment. DHCP uses UDP with the server on port 67 and the client on port 68.

39

What ports does DHCP use?

40

DHCP for IPv4 uses UDP port 67 on the server and UDP port 68 on the client. DHCPv6, the IPv6 version defined in RFC 8415, uses UDP port 547 on servers and relays and UDP port 546 on clients.

41

What is a DHCP lease?

42

A DHCP lease is the temporary assignment of an address to a device for a limited time. The device renews the lease at about half its length (the T1 timer) and usually keeps the same address, and if a device leaves and the lease lapses the address can return to the pool. Lease duration is set by the administrator and commonly ranges from hours to days.

43

Does DHCP hide or change my public IP address?

44

No. DHCP assigns the private address your device uses on the local network, not the public IP the internet sees. Renewing a DHCP lease does not hide you or give you a new public address, because your ISP controls the public one. To actually change your public IP you would use a method like a VPN, a proxy, or a router restart.

45

What is the difference between DHCP and a static IP address?

46

A static IP is set manually on the device and never changes, while a DHCP address is assigned dynamically and managed centrally. DHCP suits ordinary devices because it is automatic and avoids conflicts, whereas a static address suits something that must be found reliably, like a printer or server. A DHCP reservation can give a device a fixed address while still being centrally managed.

47

What is DHCPv6?

48

DHCPv6 is the DHCP version for IPv6, defined in RFC 8415. It uses a Solicit, Advertise, Request, Reply exchange over UDP ports 546 and 547, reaches servers by multicast rather than broadcast, and identifies clients by a DUID. On many IPv6 networks it works alongside SLAAC, which lets a device build its own address from a router-advertised prefix.

49
Last updated: July 15, 2026