DHCP Server Installation, Configuration and Working Principle

DHCP (Dynamic Host Configuration Protocol) is the protocol that automatically distributes the IP address, the subnet mask, the default gateway and the DNS servers to the clients on a network. With static addressing, every device must be configured manually, and as the number of devices grows, errors such as giving the same address to 2 devices or entering a wrong gateway become unavoidable. A DHCP server manages this configuration from a single point.

In a network that is divided into VLANs, a separate scope is defined for each VLAN. If the DHCP server is not in the same VLAN as the clients, DHCP Relay (IP Helper) is configured on the router so that the clients' broadcast requests are forwarded to the DHCP server.

In this article, I explain the address assignment and lease renewal process of DHCP, then install the DHCP Server role on a Windows Server, create a scope and configure scope options, reservations and filters. Redundancy with multiple DHCP servers is not covered.

The installation and configuration screens of the DHCP Server role have the same structure from Windows Server 2012 R2 to Windows Server 2025. There may be small differences in the screens between versions.

1- How Does DHCP Work?

A client obtains an address from DHCP in 4 messages: Discover, Offer, Request and Acknowledge. These 4 messages are commonly called DORA, after their initial letters. The DHCP server uses UDP port 67 and the client uses UDP port 68.

Client (0.0.0.0)                                    DHCP Server
   │  1. DHCP Discover   Broadcast 255.255.255.255  ──►  │
   │  ◄──  2. DHCP Offer  Broadcast or Unicast           │
   │  3. DHCP Request    Broadcast 255.255.255.255  ──►  │
   │  ◄──  4. DHCP ACK   Broadcast or Unicast            │

DHCP Discover

Because the client does not have an IP address yet, it sends the Discover message as a broadcast with the source address 0.0.0.0, the destination address 255.255.255.255 and the destination MAC address FF:FF:FF:FF:FF:FF. The message contains the MAC address of the client, a Transaction ID that is used to match the later messages to this exchange, and the list of options that the client requests. Because routers do not forward broadcasts, the message reaches only the DHCP servers on the same subnet or the DHCP Relay on the router. If there is an unauthorised DHCP server (rogue DHCP) on the same subnet, it can also receive this message and reply.

DHCP IP Address Assignment Process - DORA

DHCP Offer

Every DHCP server that receives the Discover sends the client an Offer that contains an address and the parameters to be used with this address. The message type is specified by Option 53, Option 1 carries the subnet mask, Option 3 the default gateway and Option 6 the DNS servers. Whether the Offer is sent as a broadcast or as a unicast to the offered address depends on the broadcast flag that the client used in its Discover message. If there are multiple servers, the client can receive multiple Offers and selects 1 of them.

DHCP IP Address Assignment Process - DORA

DHCP Request

The client accepts the offer that it selected with a Request message. The message contains the requested address in Option 50 and the identifier of the server that offered this address in Option 54. The Request is also sent as a broadcast. The reason is not only that the client still does not have a valid address. Because of the broadcast, the other servers that sent an offer also learn that their offers were not selected, and they release the addresses that they reserved.

DHCP IP Address Assignment Process - DORA

DHCP Acknowledge

The selected server assigns the address to the client with an ACK message. Together with the address, the message contains the lease duration in Option 51, the renewal time (T1) in Option 58 and the rebinding time (T2) in Option 59. The client starts to use the address after it receives the ACK. If the server cannot give the address, it sends a NAK instead of an ACK and the client starts the process again.

DHCP IP Address Assignment Process - DORA

Lease Renewal and APIPA

DHCP does not give an address indefinitely, it leases the address for a specific period. This period is called the lease, and its default value on Windows DHCP Server is 8 days. The client tries to renew its lease before the lease expires.

Lease start                     50% (T1)                    87.5% (T2)              100%
      │─────────────────────────────│───────────────────────────│─────────────────────│
                                Unicast Request           Broadcast Request        Address is released,
                                to the original server    to any server            restart with Discover

At half of the period (T1), the client sends a unicast Request to the server from which it obtained the lease. If the server replies, the lease period starts again. If the client does not receive a reply, it sends the Request as a broadcast at 87.5% of the period (T2) and asks any DHCP server for a renewal. When the lease expires, the client releases the address and starts again with Discover. If it cannot find any server, it assigns itself an APIPA (Automatic Private IP Addressing) address from the 169.254.0.0/16 range. With this address, it can communicate only with devices on the same subnet that also have APIPA addresses.

When the computer is restarted, the Windows client sends a Request to verify its lease that has not expired. If it cannot reach the DHCP server, it continues to use the current address as long as it can reach the default gateway.

When the lease of a computer that has been switched off for a long time expires, the server returns this address to the pool after a short waiting period and can give it to another client. When the computer is switched on again, it usually requests its old address. If the address has not been given to another device, the computer receives the same address. If it has been given, the computer receives a different address.

2- Preliminary Checks

Before I start, I verify the following items:

Check Expected State
IP address of the server A static IP address is configured on the server where DHCP Server will be installed
Other DHCP servers on the network No other DHCP server (modem, firewall, etc.) assigns addresses on the same subnet
Authorize permission The account that performs the operation is a member of Enterprise Admins or has been delegated the permission
Address plan The subnet, the range to distribute, the devices with static addresses, and the gateway and DNS addresses are known

3- Decision Table

I collect the decisions that I will make during the installation before I start.

Step Decision to Make Choice in This Installation
Section 5 Address range and subnet mask 192.168.1.1 - 192.168.1.254, 255.255.255.0
Section 5 Exclusion ranges 192.168.1.1 - 192.168.1.10 and 192.168.1.251 - 192.168.1.254
Section 5 Lease duration 8 days (default)
Section 6 Scope options 003 Router, 006 DNS Servers, 015 DNS Domain Name
Section 7 Client type to support DHCP only if there is no BOOTP device in the environment

4- Installing the DHCP Server Role and Authorisation

1- In Server Manager, I click Add Roles and Features.

DHCP Server

2- I continue with Role-based or feature-based installation selected.

DHCP Server

3- On the Server Selection screen, I select the server on which I will install DHCP Server. In this lab environment, I install the role on the domain controller.

DHCP Server

4- On the Server Roles screen, I select the DHCP Server role.

DHCP Server

5- The wizard states that the management tools will also be installed with the role. I add them to the selection with Add Features.

DHCP Server

DHCP Server

6- On the Features screen, I continue without an additional selection.

DHCP Server

7- On the confirmation screen, I select the Restart the destination server automatically if required option. Because the DHCP Server role does not require a restart, this option has no effect in this installation. I start the installation with Install.

DHCP Server

DHCP Server

DHCP Server

After the installation, the Complete DHCP configuration step in the Server Manager notification creates the DHCP Administrators and DHCP Users security groups and authorises the server in Active Directory.

8- In an Active Directory environment, a DHCP server does not assign addresses unless it is authorised. This prevents an unauthorised Windows DHCP server from being added to the network. In the DHCP console, I right-click the server name and select Authorize.

DHCP Server

9- After the authorisation, the IPv4 and IPv6 icons appear with a green tick.

DHCP Server

I can also perform the role installation, the creation of the security groups and the authorisation with PowerShell. I replace {Server FQDN} and {Server IP} with the full name and the IP address of the DHCP server.

Install-WindowsFeature DHCP -IncludeManagementTools
Add-DhcpServerSecurityGroup
Restart-Service -Name DHCPServer
Add-DhcpServerInDC -DnsName "{Server FQDN}" -IPAddress {Server IP}

Checkpoint
The IPv4 and IPv6 icons must be green in the DHCP console, and the server must be listed in the Get-DhcpServerInDC output.

5- Creating a Scope

A scope defines the address range that the DHCP server distributes for a subnet and the settings that are given together with these addresses. A separate scope is created for each subnet or VLAN.

1- In the DHCP console, I right-click IPv4 and select New Scope....

DHCP Server

2- I give the scope a name.

DHCP Server

3- On the IP Address Range screen, I enter 192.168.1.1 in the Start IP address field and 192.168.1.254 in the End IP address field. The wizard suggests 255.255.255.0 (/24) as the subnet mask. A maximum of 254 addresses can be used in this subnet.

DHCP Server

The subnet mask of a scope cannot be changed after the scope is created. When a larger subnet is needed, the scope must be deleted and created again. I define the subnet mask according to the requirement from the start.

4- On the Add Exclusions and Delay screen, I define the addresses that are inside the pool but that DHCP will not distribute. 192.168.1.1 is the address of the default gateway, and I reserve the addresses after it for devices with static addresses, such as servers and printers. For this reason, I add the range from 192.168.1.1 to 192.168.1.10 as an exclusion. In the same way, I also exclude the range from 192.168.1.251 to 192.168.1.254 from distribution. If the address of a device with a static address in the pool is not added to the exclusions, DHCP can give this address to another client and an IP address conflict occurs.

DHCP Server

DHCP Server

5- On the Lease Duration screen, I set the lease duration. I keep the default of 8 days.

DHCP Server

Lease Duration Advantage Disadvantage Suitable Environment
Short (hours, 1 day) The addresses of devices that leave the network return to the pool quickly Renewal traffic and server load increase Guest networks, wireless networks, devices that change frequently
Long (8 days or more) Renewal traffic is low, addresses stay the same for a long time The addresses of devices that leave the network do not return to the pool for a long time Office networks with fixed desktop computers

6- On the Configure DHCP Options screen, the choice is between configuring the options in the wizard and configuring them manually later. Because I explain the options separately in section 6, I select No, I will configure these options later and complete the wizard with Finish.

DHCP Server

DHCP Server

7- When the wizard finishes with this option, the scope stays inactive and does not assign addresses. I right-click the scope and select Activate.

DHCP Server

DHCP Server

Checkpoint
The Address Pool section of the scope must show the 192.168.1.1 - 192.168.1.254 range and the 2 exclusion ranges. In this scope, DHCP distributes the 240 addresses between 192.168.1.11 and 192.168.1.250.

6- Scope Options

Scope options are the settings that are given to clients together with the address. Options that are common to all scopes on a server (usually the DNS servers and the DNS domain name) are defined in Server Options, and options that are specific to 1 scope (such as the router) are defined in Scope Options. If the same option is defined in both places, Scope Options takes precedence.

1- I right-click Scope Options under the scope and select Configure Options....

DHCP Server

2- I enter the default gateway address (192.168.1.1) in the 003 Router option. Clients send the traffic that leaves the subnet to this address.

DHCP Server

DHCP Server

3- I enter the addresses of the DNS servers that the clients will use in the 006 DNS Servers option. In an Active Directory environment, clients must use internal DNS servers that can resolve the records of the domain. In most environments these servers run on the domain controllers, but this is not a requirement.

DHCP Server

DHCP Server

DHCP Server

4- I enter the domain name in the 015 DNS Domain Name option. Clients append this domain name to queries that are made with a short name.

DHCP Server

5- The 044 WINS/NBNS Servers and 046 WINS/NBT Node Type options are for NetBIOS name resolution. In this lab environment, I configure both of them.

DHCP Server

DHCP Server

Microsoft added WINS to the list of deprecated features with Windows Server 2022. WINS is still supported in Windows Server 2025 and will be removed from later versions. In new environments, it is configured only if there are legacy applications that depend on NetBIOS.

Option 046 defines the order in which the client resolves NetBIOS names:

Value Node Type Resolution Order
0x1 B-node (Broadcast) Broadcast only, does not leave the subnet
0x2 P-node (Point-to-Point) WINS server only, no resolution is possible if WINS cannot be reached
0x4 M-node (Mixed) Broadcast first, then the WINS server
0x8 H-node (Hybrid) WINS server first, then broadcast

In environments that use WINS, I use the 0x8 (H-node) value because it reduces broadcast traffic to a minimum.

DHCP Server

6- The options that I configured appear in the Scope Options list.

DHCP Server

I can also create the scope, the exclusion ranges and the options with PowerShell. I replace {DNS Server} and {Domain Name} with my own values.

Add-DhcpServerv4Scope -Name "{Scope Name}" -StartRange 192.168.1.1 -EndRange 192.168.1.254 -SubnetMask 255.255.255.0 -LeaseDuration 8.00:00:00 -State Active
Add-DhcpServerv4ExclusionRange -ScopeId 192.168.1.0 -StartRange 192.168.1.1 -EndRange 192.168.1.10
Add-DhcpServerv4ExclusionRange -ScopeId 192.168.1.0 -StartRange 192.168.1.251 -EndRange 192.168.1.254
Set-DhcpServerv4OptionValue -ScopeId 192.168.1.0 -Router 192.168.1.1 -DnsServer {DNS Server} -DnsDomain "{Domain Name}"

7- Scope Properties

I right-click the scope and open its general settings with Properties.

DHCP Server

General

The General tab contains the address range and the lease duration of the scope. The range can be extended or reduced within the limits that the subnet mask allows. In this scope, the range already covers the whole /24 subnet, so it cannot be extended further. With the 2 exclusion ranges, this scope can give addresses to a maximum of 240 clients.

If more addresses are needed, the scope is deleted and created again with a larger subnet. For example, 510 addresses can be used in the 255.255.254.0 (/23) subnet. For this reason, I determine the address requirement with a correct subnet calculation before I create the scope.

DHCP Server

Advanced

On the Advanced tab, I select the type of clients that the scope gives addresses to:

Option Result
DHCP only Addresses are given only to DHCP clients (default)
BOOTP only Addresses are given only to BOOTP clients
Both Addresses are given to both types of client

BOOTP is a protocol that is older than DHCP and that some legacy devices still use. BOOTP clients do not renew their addresses. For this reason, a period of 30 days is defined by default in the Lease duration for BOOTP clients field. Current thin clients and network devices use DHCP. If no device in the environment actually uses BOOTP, I keep the default DHCP only selection. In this lab environment, Both is selected in the screenshot.

The delay in the Delay configuration field defines after how many milliseconds this server replies to a Discover message in designs where multiple DHCP servers serve the same subnet. In this single-server design, it stays at 0.

DHCP Server

8- DNS Dynamic Update Settings

The DHCP server can create and update the DNS records of the clients that it gives addresses to, on their behalf. These settings are on the DNS tab of the window that opens when I right-click IPv4 and select Properties. Here I specify that dynamic update is enabled and that records are also created for clients that do not request a DNS record.

If the DHCP server runs on a domain controller, by default it registers the DNS records on behalf of clients with the computer account of the domain controller. Because this account has broad permissions on DNS records, I define a separate account for DHCP that is used only for this task. The account is defined with the Credentials button on the Advanced tab of the same window, or with PowerShell.

Set-DhcpServerDnsCredential -Credential (Get-Credential) -ComputerName "{Server FQDN}"
If a separate DNS update account is not defined while DHCP runs on a domain controller, the DNS records that DHCP creates are managed with the permissions of the computer account of the domain controller.

9- Reservation

A reservation makes sure that a specific device always receives the same address from DHCP. The device is identified by its MAC address, and the address that is reserved for it is not given to another client. It is used for end devices such as printers and IP cameras, whose address must stay the same but which should receive their settings from DHCP. Infrastructure devices such as the default gateway and servers are given static addresses, and these addresses are kept in the exclusion range.

A reservation can be created in 2 ways.

1- If the device has already obtained an address from DHCP, I right-click it in the Address Leases section and select Add to Reservation. The current address of the device is reserved for it.

DHCP Server

DHCP Server

2- I right-click Reservations and create the reservation manually with New Reservation.... For this, I need to know the MAC address of the device.

DHCP Server

To find the MAC address, I ping the device and then run the arp -a command. The command lists the address and MAC address mappings in the ARP table.

DHCP Server

arp -a shows only the MAC addresses of devices on the same subnet. For a device on a different subnet, the MAC address of the default gateway appears. The MAC address of a device that has obtained an address from DHCP is also shown in the Address Leases section.

In the New Reservation window, the network part of the address is already filled in the IP address field, and I enter the last octet. I enter the MAC address of the device in the MAC address field.

DHCP Server

DHCP Server

In the Address Leases section, the Lease Expiration column of the 192.168.1.12 address shows Reservation (active). This shows that the address is reserved for this device and that the device is using the address now.

DHCP Server

I can also create the reservation with PowerShell. I replace {MAC Address} with the MAC address of the device.

Add-DhcpServerv4Reservation -ScopeId 192.168.1.0 -IPAddress 192.168.1.12 -ClientId "{MAC Address}" -Name "{Device Name}"

10- Filters

Filters define which devices the DHCP server gives addresses to, based on the MAC address. Filters are applied to the server, not to the scope, and are managed in the Filters section under IPv4.

List When Enabled
Allow Addresses are given only to the MAC addresses in the list
Deny Addresses are not given to the MAC addresses in the list, other devices receive addresses

The lists are not active by default. The Enable Allow list or Enable Deny list option must be selected on the Filters tab of the window that opens when I right-click IPv4 and select Properties. If a MAC address is in both lists, Deny takes precedence.

If the Allow list is enabled and left empty, no device can obtain an address. Before I enable the Allow list, I add all devices that must obtain an address to the list.

I can add a device to a list in 2 ways. The steps are the same for the Deny list.

1- In the Address Leases section, I right-click the device and select Allow or Deny under Add to Filter. I can select multiple devices with the Ctrl key and add them together.

DHCP installation

2- Under Filters, I right-click Allow or Deny and enter the MAC address of the device manually with New Filter....

DHCP installation

DHCP installation

DHCP installation

3- The device appears in the Allow list.

DHCP installation

4- I can right-click an entry in the list and move it to the Deny list with Move to Deny.

DHCP installation

DHCP installation

Because the MAC address can be changed easily on the client side, DHCP filters are not a security control. Authentication methods such as 802.1X are used to restrict network access.

11- Verification

On a client, I request a new address and check the settings that it receives.

ipconfig /release
ipconfig /renew
ipconfig /all

In the output, the IPv4 address must be between 192.168.1.11 and 192.168.1.250. The Default Gateway, DNS Servers and Connection-specific DNS Suffix fields must show the values in Scope Options, the DHCP Server field must show the address of the DHCP server, and the difference between Lease Obtained and Lease Expires must show the lease duration. On the server side, I check the lease record of the client with PowerShell.

Get-DhcpServerv4Lease -ScopeId 192.168.1.0 | Select-Object IPAddress, ClientId, HostName, LeaseExpiryTime, AddressState

If I need to disable the scope temporarily, I right-click it and select Deactivate. Existing clients continue to use their addresses until their leases expire, and new clients cannot obtain an address from this scope. If I decommission the server completely, I remove its authorisation in Active Directory with Unauthorize in the console.

I know that the installation is complete by these criteria: the server is authorised in Active Directory, the scope is active and the exclusion ranges are defined, the client receives the correct address, gateway and DNS settings, and the lease record appears on the server. The next step is to make DHCP redundant by distributing it to a second server with split scope or DHCP Failover, and to configure DHCP Relay for the VLANs that do not have a DHCP server.

I hope you find it useful...

No comments on this article yet. Be the first to comment!

750 characters available.
Security code
Comments are published once approved.
Your email is only used to let you know when your comment is approved. It is never published.