How to install a DHCP Server on Server Core

To make life easier as an admin, several network protocols have been introduced to help manage TCP/IP. One of these protocols is the Dynamic Host Configuration Protocol (DHCP).

DHCP Servers hand out IP addressing information to DHCP clients to make it easy for people using these devices to connect to the network without making changes to their networking configuration. In dynamically scaling environments, DHCP clients are increasingly becoming DHCP clients with the DHCP Server maintaining DHCP reservations; this practice ensures that certain DHCP clients get the same IP address every time, based on their MAC address.

History of the DHCP Server Role in Server Core ^

The DHCP Server Server Role has been included in Server Core since Windows Server 2008. Server Core installations of Windows Server 2012 support failover DHCP scopes. This new feature, which is found in both Server Core and Server with a GUI installations of Windows Server 2012, adds redundancy to DHCP Servers without failover clustering, shared storage, and multiple network interconnects between two (or more) DHCP Servers. This also replaces the practice where admins needed to place 80% of their leases on one DHCP Server and 20% on another DHCP Server (and maintain reservations and DHCP options on both servers) to achieve DHCP Server redundancy.

Configuring Server Core as a DHCP Server ^

Just like the other Server Roles and Features on Server Core installations, you can install them using three methods. The first method features the dism.exe command line tool. The second method features PowerShell, specifically the Install-WindowsFeature cmdlet. A third way to install Server Roles and Features on Server Core installations is through Server Manager remoting, but since this is done through the Graphical User Interface (GUI), it’s not for real men like us.

To install the DHCP Server Role on a Server Core installation with dism.exe, use the following command:

To install the DHCP Server Role on a Server Core installation with Install-WindowsFeature, first start PowerShell on the command line (by typing it) and then use the following command:

Install-WindowsFeature DHCP -IncludeManagementTools

Install a DHCP Server with PowerShell

Install a DHCP Server with PowerShell

Configuring Basic DHCP Scopes ^

To hand out IP information to clients requesting them, you will need to create one or more DHCP scopes. To benefit most from your DHCP Servers, you will want to specify not only IP ranges to hand out but also DHCP options, like the default gateway address and addresses for DNS Servers. These DHCP options can be configured at the DHCP scope level and at the server level.

For this purpose, we’ll configure an example Server Core installation with IP address 192.168.0.9SC2, using the range of IP addresses from 192.168.0.10 through 192.168.0.250, with a Default Gateway address of 192.168.0.254. The installation also has a DNS Server, available at 192.168.0.1 for the domain demo.servercore.net. In this example, the commands to configure the DHCP scope look like this:

If you’d rather define these options as Server options, replace the Set command with the following:

Authorizing DHCP Servers in Active Directory ^

Now, your DHCP Server may not be handing out IP information just yet. One reason for this is that your Server Core Domain Controller saw another DHCP Server on the network when it tried to activate its DHCP scope. Another situation might be that your Server Core Domain Controller is a member of an Active Directory domain and is not yet authorized in Active Directory to hand out IP addresses.

Note: DHCP Servers on Domain Controllers are authorized in Active Directory automatically.

To authorize your Server Core DHCP Server in Active Directory, use the following command:

Add-DhcpServerInDC -DNSName demo.servercore.net

DHCP Server High Availability through DHCP Scope Failover

Let’s get back to the failover DHCP scopes I mentioned earlier. Once again, this feature can be deployed through PowerShell as well as in the DHCP Server MMC Snap-in. I recommend using PowerShell in this case, however, since it’s harder to click the wrong buttons on the command line.

Requirements

To use DHCP scope failover, you should have two Windows Server 2012 installations with the DHCP Server Role installed on them. It is recommended to make these two DHCP Servers members of the same Active Directory Forest to accommodate authentication and time synchronization. In this case, both DHCP Servers need to be authorized in Active Directory, and you should log on with domain admin credentials for these steps.

Example

To explain how DHCP failover works, we will look at it in an example environment. Building upon the earlier example, two DHCP Servers named SC2 and SC3, with IP addresses 192.168.0.2 and 192.168.0.3, will host the (admittedly tiny) DHCP 192.168.0.10 to 192.168.0.250 scope. The two DHCP Servers will be configured in Load Balance mode, essentially creating an Active-Active configuration wherein both DHCP Servers serve client requests with 50%/50% load distribution percentages.

Configuring DHCP failover

Of course, SC2 is already configured with the DHCP scope. To configure DHCP failover for this scope, use the following commands on SC2:

To see statistics on the replication of the DHCP scope, use the following command:

Concluding ^

The DHCP Server Server Role in Server Core installations of Windows Server 2012 is as full-fledged as on Server with a GUI installations. You can configure all the nitty-gritty DHCP Server configuration options straight from PowerShell or remotely through the Remote Server Administration Tools (RSAT) on either Windows 8 or Windows Server 2012 installations.

Windows Server 2012–based Server Core DHCP Servers offer the best DHCP Server performance of all Windows Server installations to date.

Want to write for 4sysops? We are looking for new authors.

Read 4sysops without ads and for free by becoming a member!

0
Share
3 Comments
  1. yael 4 years ago

    Very clear and helpfull documentation.
    I will be using this for a school project,

    thank you!

    0

  2. cliff 4 years ago

    This is all be done in VMware. I know I can point and click in server manager and it will all work. with the market trend I what to be proficient in PowerShell.

    logical layout is as follows.

    Parent domain x.local has 2 AD DC's named SRV1 & SRV2

    Child domain y.x.local has just the one DC SRV2

    I am having an issue with authorizing the dhcp server on SRV3 in powershell. I am logged in as administrator of SRV3.

    I have the service installed and running with your above example. I also was able to create a scope of 192.168.100.241 - 192.168.10.254 /28

    I can't use the option to set DNS is this the dhcp is yet to be authorized?

    I can see in server manager that the DHCP Service on SRV3 is running, And shows that post install configuration is needed.

    a) create the security groups "DHCP Administators & DHCP Users" did that from powershell.

    b) authorize DHCP server on target computer (if domain joined)

    the above Add-DhcpServerInDC -DNSName y.x.local give a user authorization error

    any help would be great.

     

    0

  3. Andei P 8 months ago

    Errata for: Configure Server Core as DHCP Server regarding installing DHCP Server Rolte using dism.exe

    Correct comand is:

    Regards,
    Andrei P.

    0

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account