Quickstart: Install and configure DHCP Server

Applies to: Windows Server 2022, Windows Server 2019, Windows Server 2016

This quickstart shows you how to install a Dynamic Host Configuration Protocol (DHCP) server on Windows Server. You'll install the DHCP Server role, authorize the server in your Active Directory domain, and configure a scope to automatically assign DHCP IP addresses and options to IPv4 DHCP clients.

Prerequisites

Before you can install your DHCP server, you must meet the following prerequisites:

  • A computer running a supported version of Windows Server.
  • A static IPv4 address.
  • An IP address range for your DHCP scope.
  • An account that's a member of the Administrators group, or equivalent.

Install the DHCP Server

Installing the DHCP Server involves adding the DHCP Server role to an existing Windows Server server.

To install the DHCP Server role as a standalone server, perform the following steps:

Here's how to install DHCP using the Install-WindowsFeature command.

  1. Run PowerShell on your computer in an elevated session.

  2. Run the following command:

    Install-WindowsFeature DHCP -IncludeManagementTools
    

The installation doesn't require a reboot.

Configure DHCP server

After you have successfully installed the DHCP Server role, you need to authorize and configure your DHCP server.

Authorize the DHCP server in Active Directory

If you're installing DHCP in a domain environment, you must perform the following steps to authorize the DHCP server to operate in the domain.

Note

Unauthorized DHCP servers that are installed in Active Directory domains can't function properly and don't lease IP addresses to DHCP clients. The automatic disabling of unauthorized DHCP servers is a security feature that prevents unauthorized DHCP servers from assigning incorrect IP addresses to clients on your network.

To authorize your DHCP server in a domain environment:

  1. Run the following command to add the DHCP server to the list of authorized DHCP servers in Active Directory.

    Note

    If you don't have a domain environment, don't run this command.

    Add-DhcpServerInDC -DnsName DHCP1.corp.contoso.com -IPAddress 10.0.0.3
    
  2. To verify that the DHCP server is authorized in Active Directory, run the following command:

    Get-DhcpServerInDC
    

    The following example shows the output you should see in Windows PowerShell.

    IPAddress     DnsName
    ---------     -------
    10.0.0.3      DHCP1.corp.contoso.com
    

For more information about these commands, see the following articles:

Configure an IPv4 scope

After you have successfully authorized your DHCP Server, you can proceed to create a new DHCP scope. Scopes are used to indicate the range of IP addresses for your DHCP server and its clients. To learn more about planning your scope ranges, see DHCP scopesfor guidance.

To create a new IPv4 DHCP scope, select the relevant method and follow the steps.

Here's how to create a new scope using the Add-DhcpServerv4Scope PowerShell command.

  1. Run PowerShell on your computer in an elevated session.

  2. To configure a new DHCP scope named Contoso network with a range from 10.10.10.100 to 10.10.10.200 and a subnet mask of 255.255.255.0, run the following command.

    Add-DhcpServerv4Scope -Name "Contoso network" -StartRange 10.10.10.100 -EndRange 10.10.10.200 -SubnetMask 255.255.255.0
    

Managing scope options

After configuring your new scope, you can manage scope options using either the DHCP console or PowerShell.

You can modify DHCP scope options using PowerShell with the Set-DhcpServerv4OptionValue cmdlet. For example, to set the DNS server option for the scope 192.168.15.0 and set the DNS servers to 192.168.15.10 and 192.168.15.11, run the following command:

Set-DhcpServerv4OptionValue -ScopeId 192.168.15.0 -OptionId 6 -Value "192.168.15.10", "192.168.15.11"

Managing reservations

With client reservations, you can reserve an IP address for permanent use by a DHCP client. Reservations are stored using a network interface card's (NIC) MAC address and ensure that the DHCP server exclusively leases a specific IP address to a specific MAC address.

You can create reservations using the Add-DhcpServerv4Reservation PowerShell cmdlet. For example, to add a reservation to a DHCP scope with a scope ID of 192.168.15.0, an IP address of 192.168.15.100, and the MAC address 00-11-22-33-44-55, run the following PowerShell command:

Add-DhcpServerv4Reservation -ScopeId 192.168.15.0 -IPAddress 192.168.15.100 -ClientId "00-11-22-33-44-55" 

Managing exclusions

Here's how to manage exclusion ranges in DHCP server.

You can run the Add-DhcpServerv4ExclusionRange cmdlet to add an exclusion range to a DHCP scope using PowerShell. For example, to add the exclusion range 192.168.15.1 to 192.168.15.10 to the scope 192.168.15.0, run the following command:

Add-DhcpServerv4ExclusionRange -ScopeId 192.168.15.0 -StartRange 192.168.15.1 -EndRange 192.168.15.10

Next steps