Setting Up a DHCP Server Role on Windows Server

Windows Server’s DHCP role hands out IP addresses automatically to devices on a network — a foundational service for any office or datacenter that doesn’t want to manually configure static IPs on every device.

Install-WindowsFeature -Name DHCP -IncludeManagementTools

# Create a scope (a range of IPs to hand out)
Add-DhcpServerv4Scope -Name "Office Network" -StartRange 192.168.1.100 <code>
  -EndRange 192.168.1.200 -SubnetMask 255.255.255.0

# Set scope options - default gateway and DNS servers
Set-DhcpServerv4OptionValue -ScopeId 192.168.1.0 -Router 192.168.1.1 </code>
  -DnsServer 192.168.1.10,8.8.8.8

# Reserve a specific IP for a known device (by MAC address)
Add-DhcpServerv4Reservation -ScopeId 192.168.1.0 -IPAddress 192.168.1.50 `
  -ClientId "00-11-22-33-44-55" -Description "Print Server"

Authorization in Active Directory

A DHCP server in a domain environment must be explicitly authorized in Active Directory before it will actually respond to client requests — a deliberate safeguard against rogue DHCP servers accidentally (or maliciously) handing out conflicting IP addresses on the network.