DHCP for Windows Server 2012

Configuring Windows 2012's DHCP ServerDHCP in Windows Server 2012

The benefit of DHCP is automatic IP configuration. Time spent in setting scope options repays handsomely even on small networks.  If you have to change the IP address of a router then thanks to DHCP's central control it's easy to update the clients' network adapter settings.

I will also confess that configuring DHCP is fun, satisfying and an area of computing where I am always learning new network tricks such as failover.

Windows 2012 Server DHCP Topics

 ♦

Windows Server 2012 DHCP Basics

The principles underpinning Windows 2012's DHCP server have not changed since NT 3.51 and the dawn of Microsoft's servers.  The idea is that the DHCP server acts like a blackjack dealer, only instead of holding a pack of cards, the DHCP server has a scope of IP addresses.  And instead of having punters, the DHCP server doles out IP addresses to Windows client computers.

Along with allocating a unique IP address to a client, it's standard practice for the DHCP server to also configure the IP addresses of the default gateway and of at least one DNS server.  The benefit is that if you change a default gateway, add a DNS server or amend another DHCP setting, then you only have to modify the setting once on the DHCP server and then all the clients will get the update automatically.

Setting Up DHCP in Server 2012Configure DHCP in Windows Server 2012

I know this is obvious, but what really helps with DHCP is if you have a plan of what you want to achieve.  For example, decide the IP address range(s), calculate the subnet masks, and consider scope options such as the address of the DNS server.

To get started, add the role DHCP server to your Windows 2012 computer.  Once installation completes then call for the Server Manager and the click on the 'Tools' menu.

Like it's predecessor Windows 2008 R2, Windows Server 2012 also supports assigning IPv6 addresses via a DHCP server.  In each case setting up a scope with a range of IP addresses is the key concept.

What's New in DHCP for Server 2012?

Each new generation Windows server brings yet more options for DHCP configuration, these are the highlights of new DHCP features in Windows Server 2012.

PowerShell in Windows Server 2012

PowerShell v3 introduces a whole family of cmdlets to configure DHCP in Windows Server 2012.  Employ PowerShell not only to install the DHCP server role, but also to configure the scope.

Let us assume that you have created a DHCP scope, and now wish to exclude a range of IP addresses that are used by routers.

# PowerShell 3.0 aim to exclude an IP address range
Add-DhcpServerv4ExclusionRange -ScopeId 192.168.4.0`
-StartRange 192.168.4.10 -EndRange 192.168.4.20 

Note 1: The key parameter is -ScopeId, observe how it ends in zero

Note 2: The backtick (`) tells the command to wrap to the next line.

See how to create a DHCP scope with PowerShell 3 »

Guy Recommends: The Free IP Address Tracker (IPAT) Free IP Tracker

Calculating IP Address ranges is a black art, which many network managers solve by creating custom Excel spreadsheets.  IPAT cracks this problem of allocating IP addresses in networks in two ways:

For Mr Organized there is a nifty subnet calculator, you enter the network address and the subnet mask, then IPAT works out the usable addresses and their ranges.  For Mr Lazy IPAT discovers and then displays the IP addresses of existing computers. 

Download the Free IP Address Tracker

Windows Server 2012 DHCP Policy 

The idea is that you can assign different DHCP options depending on the client device, for example, you could assign different default gateways depending whether the computer is a laptop, a phone, or a member server.

DHCP Policies Use Values Obtained From:DHCP Policy in Windows Server 2012

  • Vendor Class
  • User Class 
  • MAC Address
  • Client Identifier
  • Relay Agent Information

Note 3: To get DHCP policies working I urge you to research setting User Classes on the Windows client. It's also worth mastering wildcards especially if you configure the Client Identifier field.

Ipconfig /ShowClassID is useful in troubleshooting, but do remember to specify the adapter thus:

Ipconfig /ShowClassID "Local Area Connection"

Complications arise if you create too many settings.  My advice is start by creating DHCP policies only at the scope level.

Recap: DHCP Failover in Windows Server 2008DHCP Failover Server 2012

It was possible to protect against a 2008 DHCP server failure in two ways: assigning split scope DHCP, and by creating a Windows failover cluster.  With the split scope concept you allocate say 80% of a scope the primary server, if the clients cannot contact that server, then they are directed to the backup which has the remaining scope IP addresses to lease to the clients.

In failover clustering the primary server holds 100% of the scope, and in the event of a crash the secondary DHCP server takes over the role.  The weakest point of failover is the single shared storage for the data.  Another factor is that you need precisely two servers, no more and no less!

New DHCP Failover in Windows Server 2012

With Windows Server 2012 there are two superior failover solutions, hot standby or load sharing mode. With hot standby mode, there is a primary active server.  Yet thanks to the failover relationship, the secondary server takes over should the primary server be unavailable for any reason.

With load sharing the pair of servers simultaneously serve IP addresses to DHCP clients on a given subnet. These requests are load balanced between the two Windows Server 2012 machines.

The load sharing option is ideal for situations where both DHCP servers in a failover relationship are located at the same physical site.  Whereas the hot standby option is better where you want a central backup to DHCP servers at a remote site

Configuring DHCP Failure in Windows 2012
From the DHCP server GUI, I prefer to right-click the IPv4 icon, then select 'Configure Failover'.

DHCP Failover Server 2012

Note 4: 'Shared Secret' is just another name for password.

DHCP Failover Summary
DHCP failover enables two DHCP servers to replicate lease information.  The concept is that one of the DHCP partners takes responsibility, and doles out addresses to the Windows clients, if a catastrophic event occurs and the first DHCP failsover to the second DHCP server.

Guy Recommends:  A Free Trial of the Network Performance Monitor (NPM)Review of Orion NPM v12 v12

SolarWinds’ Network Performance Monitor will help you discover what’s happening on your network.  This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.

Perhaps the NPM’s best feature is the way it suggests solutions to network problems.  Its second best feature is the ability to monitor the health of individual VMware virtual machines.  If you are interested in troubleshooting, and creating network maps, then I recommend that you give this Network Performance Monitor a try.

Download your free trial of SolarWinds Network Performance Monitor.

Windows Server 2012 DHCP TipsConfigure DHCP in Windows Server 2012

You Will Find That Setting
My number one tip for configuring DHCP is belief. Trust that the setting you are looking for is there somewhere, it's just a matter of finding the right menu.  If you don't find what you are looking for at the Scope level, then look higher up and right-click the server icon.  See screenshot right.

User Classes
For large heterogeneous networks take the time to create and configure DHCP user classes, it's one of the most challenging concepts to understand and to implement, but creating 'Classes' is essential if you want DHCP options for different types of people or computer.  See more on DHCP User Classes.

Exclusion Range
It makes good sense to for Domain controllers, DNS servers and Exchange servers to have static IP addresses even though it means configuring their network adapters manually.  To avoid any IP address conflicts follow through with the best practice of creating an Exclusion Range at the DHCP Scope. DHCP Server 2012 Subnet

Subnet Mask Trap
Curiously, while you can modify the DHCP Scope Options, you cannot amend the Subnet mask once you have created it; observe that the box is greyed-out, thus you cannot change the mask.

My solution is to be ruthless and delete then recreate the scope; I used PowerShell v 3 for this and other DHCP tasks, incidentally there is no subnet parameter for Set-DHCPServerv4Scope.  However, you will see -subnet when you Add-DHCPServerv4Scope.

APIPA
If potential DHCP client computers have an IP address beginning 169.254.x.y then this is a sure sign that DHCP is not working.

When troubleshooting changes that you made at the Windows 2012 DHCP server, remember to issue these commands at the client: ipconfig / release command, followed by an ipconfig / renew.  Incidentally, you can use PowerShell instead of CMD for such ipconfig commands.

Authorized in Active Directory
Microsoft's solution to rogue DHCP servers is to require that official servers be Authorized in Active Directory.  A symptom that this step has not been completed is a red dot on the Windows 2012 server icon.  Remember to achieve this task you have to be an Enterprise Admin.

Order of Precedence for DHCP Options

  1. Reserved Clients (Highest)
  2. Vendor / User Options
  3. Scope Options (Over-rights Server Options)
  4. Server Options 

A client such as Windows 7, Windows 8 or XP with the network adapter set to manual (rather than automatic) will trump all of the above.

Summary of Windows Server 2012 DHCP

Configuring DHCP server is fun.  Windows 2012 introduces numerous PowerShell cmdlets not only to add the DHCP role, but also to configure the scopes.  The benefit of DHCP is that once up and running you don't need to worry about clients machines getting the right IP address.  Furthermore if you need to change the IP address of a key router or server, then the clients machine automatically receive the update.

If you like this page then please share it with your friends

 


Microsoft Windows Server 2012 Services

Windows Server 2012 Home   • Disable UAC Windows Server 2012   • Network Performance Monitor

DHCP Server Windows 2012   • Disable Shutdown Event Tracker Server 2012

Shutdown Windows Server 2012   • Remote Desktop Server 2012   • Windows Server 2012 Hyper-V