DNS and DHCP Server Configuration

3 Nov 2026, 18:2315 min readby ITYantra Admin

# DNS and DHCP Server Configuration ## Introduction DNS (Domain Name System) and DHCP (Dynamic Host Configuration Protocol) are core network infrastructure services. DNS translates hostnames to IP

# DNS and DHCP Server Configuration

Introduction

DNS (Domain Name System) and DHCP (Dynamic Host Configuration Protocol) are core network infrastructure services. DNS translates hostnames to IP addresses, while DHCP automatically assigns IP addresses and network configuration to clients. This tutorial covers installing and configuring DNS and DHCP server roles on Windows Server, including zones, records, scopes, reservations, and failover.

By the end of this guide, you will be able to deploy and manage DNS and DHCP services for a Windows Server network.

Technical Background

DNS Concepts

| Concept | Description | |---------|-------------| | Zone | Portion of DNS namespace hosted on a DNS server | | A Record | Maps hostname to IPv4 address | | AAAA Record | Maps hostname to IPv6 address | | CNAME | Canonical name (alias) record | | MX Record | Mail exchange record | | PTR Record | Pointer record for reverse DNS lookup | | SRV Record | Service location record (used by Active Directory) | | Forward Lookup Zone | Resolves names to IP addresses | | Reverse Lookup Zone | Resolves IP addresses to names |

DHCP Concepts

| Concept | Description | |---------|-------------| | Scope | Range of IP addresses available for lease | | Reservation | Fixed IP address for specific MAC address | | Exclusion | IP addresses excluded from scope | | Lease | Duration of IP address assignment | | Option | DHCP options (DNS, gateway, WINS) | | Failover | Redundant DHCP servers for availability |

DNS Record Types

| Record Type | Purpose | Example | |-------------|---------|---------| | SOA | Start of Authority (zone info) | ityantra.lab | | NS | Name Server | ns1.ityantra.lab | | A | IPv4 address | www → 192.168.1.50 | | AAAA | IPv6 address | www → 2001:db8::1 | | CNAME | Alias | www → server01.ityantra.lab | | MX | Mail server | mail.ityantra.lab priority 10 | | PTR | Reverse lookup | 192.168.1.50 → www.ityantra.lab | | SRV | Service location | _ldap._tcp.ityantra.lab |

Prerequisites

  • Windows Server 2025 installed
  • Static IP address configured
  • Administrator credentials
  • Active Directory (optional, for AD-integrated zones)

Architecture

DNS and DHCP Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Network Services                         │
│                                                             │
│  ┌─────────────┐          ┌─────────────┐                  │
│  │   DNS       │          │    DHCP     │                  │
│  │   Server    │─────────▶│   Server    │                  │
│  │  (192.168.1.10)│       │ (192.168.1.11)│               │
│  └─────────────┘          └─────────────┘                  │
│         │                           │                       │
│    Forward Zone              Scope: 192.168.1.100-200      │
│    Reverse Zone              Lease: 8 days                  │
│    AD Integrated             Options: DNS, Gateway          │
└─────────────────────────────────────────────────────────────┘

DHCP Lease Process (DORA)

Client → Discover → Server
Client ← Offer ← Server
Client → Request → Server
Client ← Acknowledge ← Server

Step-by-Step Implementation

Step 1: Install DNS Server Role

**Purpose**: Install DNS server role for name resolution.

**Commands** (PowerShell):

# Install DNS Server role
Install-WindowsFeature -Name DNS -IncludeManagementTools

# Verify installation
Get-WindowsFeature DNS

**Expected output**: DNS Server role installed with management tools.

Step 2: Configure DNS Forward Lookup Zone

**Purpose**: Create forward lookup zone for domain name resolution.

**Commands** (PowerShell):

# Import DNS Server module
Import-Module DnsServer

# Create forward lookup zone (AD-integrated if AD DS installed)
Add-DnsServerPrimaryZone -Name "ityantra.lab" -ReplicationScope "Domain" -PassThru

# Or create standard primary zone
Add-DnsServerPrimaryZone -Name "ityantra.lab" -ZoneFile "ityantra.lab.dns" -PassThru

# Verify zone
Get-DnsServerZone -Name "ityantra.lab"

**Expected output**: Forward lookup zone created.

Step 3: Configure DNS Reverse Lookup Zone

**Purpose**: Create reverse lookup zone for IP-to-name resolution.

**Commands** (PowerShell):

# Create reverse lookup zone for 192.168.1.0/24
Add-DnsServerPrimaryZone -Name "1.168.192.in-addr.arpa" -ReplicationScope "Domain" -PassThru

# Verify zone
Get-DnsServerZone -Name "1.168.192.in-addr.arpa"

**Expected output**: Reverse lookup zone created.

Step 4: Create DNS Records

**Purpose**: Add host records for network resources.

**Commands** (PowerShell):

# Create A record for web server
Add-DnsServerResourceRecordA -Name "www" -ZoneName "ityantra.lab" -IPv4Address "192.168.1.50" -TimeToLive 3600

# Create A record for mail server
Add-DnsServerResourceRecordA -Name "mail" -ZoneName "ityantra.lab" -IPv4Address "192.168.1.51" -TimeToLive 3600

# Create CNAME record
Add-DnsServerResourceRecordCName -Name "intranet" -ZoneName "ityantra.lab" -HostNameAlias "www.ityantra.lab" -TimeToLive 3600

# Create MX record
Add-DnsServerResourceRecordMX -Name "@" -ZoneName "ityantra.lab" -MailExchange "mail.ityantra.lab" -Preference 10 -TimeToLive 3600

# Create PTR record (reverse lookup)
Add-DnsServerResourceRecordPtr -Name "50" -ZoneName "1.168.192.in-addr.arpa" -PtrDomainName "www.ityantra.lab" -TimeToLive 3600

# Verify records
Get-DnsServerResourceRecord -ZoneName "ityantra.lab"

**Expected output**: DNS records created for network resources.

**Verification**:

nslookup www.ityantra.lab
nslookup 192.168.1.50

Step 5: Configure DNS Forwarders

**Purpose**: Forward external DNS queries to upstream servers.

**Commands** (PowerShell):

# Add forwarders
Set-DnsServerForwarder -IPAddress "8.8.8.8","1.1.1.1" -PassThru

# Verify forwarders
Get-DnsServerForwarder

**Expected output**: DNS forwarders configured for external resolution.

Step 6: Install DHCP Server Role

**Purpose**: Install DHCP server role for automatic IP assignment.

**Commands** (PowerShell):

# Install DHCP Server role
Install-WindowsFeature -Name DHCP -IncludeManagementTools

# Verify installation
Get-WindowsFeature DHCP

# Authorize DHCP server in AD (if AD DS installed)
Add-DhcpServerInDC -DnsName "DC01.ityantra.lab" -IPAddress 192.168.1.11

# Verify authorization
Get-DhcpServerInDC

**Expected output**: DHCP Server role installed and authorized in AD.

Step 7: Create DHCP Scope

**Purpose**: Define IP address range for client leases.

**Commands** (PowerShell):

# Create DHCP scope
Add-DhcpServerv4Scope -Name "Client Network" -StartRange 192.168.1.100 -EndRange 192.168.1.200 -SubnetMask 255.255.255.0 -State Active

# Create exclusion range (for static IPs)
Add-DhcpServerv4ExclusionRange -ScopeId 192.168.1.0 -StartRange 192.168.1.1 -EndRange 192.168.1.99

# Create reservation for server
Add-DhcpServerv4Reservation -ScopeId 192.168.1.0 -IPAddress 192.168.1.50 -MACAddress "00-15-5D-XX-XX-XX" -Name "WEB01" -Description "Web Server"

# Verify scope
Get-DhcpServerv4Scope

**Expected output**: DHCP scope created with exclusions and reservations.

**Verification**:

Get-DhcpServerv4Scope
# Shows scope details
Get-DhcpServerv4Reservation -ScopeId 192.168.1.0
# Shows reservations

Step 8: Configure DHCP Options

**Purpose**: Set DHCP options (DNS, gateway, domain name).

**Commands** (PowerShell):

# Set server options (applies to all scopes)
Set-DhcpServerv4OptionValue -DnsDomain "ityantra.lab" -DnsServer 192.168.1.10 -Router 192.168.1.1

# Set scope-specific options
Set-DhcpServerv4OptionValue -ScopeId 192.168.1.0 -DnsServer 192.168.1.10 -Router 192.168.1.1 -LeaseDuration 172800

# Verify options
Get-DhcpServerv4OptionValue -ScopeId 192.168.1.0

**Expected output**: DHCP options configured for clients.

**Verification**:

# Client receives IP with correct options
ipconfig /all  # on client machine

Step 7: Configure DHCP Failover (Optional)

**Purpose**: Provide DHCP redundancy with failover.

**Commands** (PowerShell):

# Configure DHCP failover (primary server)
Add-DhcpServerv4Failover -Name "DHCP-Failover" -PartnerServer "DC02.ityantra.lab" -ScopeId 192.168.1.0 -Mode LoadBalance -Percent 50

# Verify failover
Get-DhcpServerv4Failover

**Expected output**: DHCP failover configured between servers.

Configuration Examples

Complete DNS Zone Configuration (PowerShell)

# Create forward zone
Add-DnsServerPrimaryZone -Name "ityantra.lab" -ReplicationScope "Domain"

# Create reverse zone
Add-DnsServerPrimaryZone -Name "1.168.192.in-addr.arpa" -ReplicationScope "Domain"

# Add host records
Add-DnsServerResourceRecordA -Name "dc01" -ZoneName "ityantra.lab" -IPv4Address "192.168.1.10"
Add-DnsServerResourceRecordA -Name "dc02" -ZoneName "ityantra.lab" -IPv4Address "192.168.1.11"
Add-DnsServerResourceRecordA -Name "fileserver" -ZoneName "ityantra.lab" -IPv4Address "192.168.1.50"

# Add PTR records
Add-DnsServerResourceRecordPtr -Name "10" -ZoneName "1.168.192.in-addr.arpa" -PtrDomainName "dc01.ityantra.lab"
Add-DnsServerResourceRecordPtr -Name "50" -ZoneName "1.168.192.in-addr.arpa" -PtrDomainName "fileserver.ityantra.lab"

# Set forwarders
Set-DnsServerForwarder -IPAddress "8.8.8.8","1.1.1.1"

Complete DHCP Scope Configuration (PowerShell)

# Authorize DHCP server
Add-DhcpServerInDC -DnsName "DC01.ityantra.lab" -IPAddress 192.168.1.11

# Create scope with exclusions
Add-DhcpServerv4Scope -Name "ClientNet" -StartRange 192.168.1.100 -EndRange 192.168.1.200 -SubnetMask 255.255.255.0 -State Active
Add-DhcpServerv4ExclusionRange -ScopeId 192.168.1.0 -StartRange 192.168.1.1 -EndRange 192.168.1.99

# Add reservations
Add-DhcpServerv4Reservation -ScopeId 192.168.1.0 -IPAddress 192.168.1.50 -MACAddress "00-15-5D-00-00-01" -Name "WEB01"
Add-DhcpServerv4Reservation -ScopeId 192.168.1.0 -IPAddress 192.168.1.51 -MACAddress "00-15-5D-00-00-02" -Name "MAIL01"

# Set options
Set-DhcpServerv4OptionValue -ScopeId 192.168.1.0 -DnsServer 192.168.1.10 -Router 192.168.1.1 -DnsDomain "ityantra.lab" -LeaseDuration 172800

DNS Resource Record Examples

# A Record (IPv4)
Add-DnsServerResourceRecordA -Name "www" -ZoneName "ityantra.lab" -IPv4Address "192.168.1.50" -TimeToLive 3600

# CNAME Record (Alias)
Add-DnsServerResourceRecordCName -Name "web" -ZoneName "ityantra.lab" -HostNameAlias "www.ityantra.lab" -TimeToLive 3600

# MX Record (Mail)
Add-DnsServerResourceRecordMX -Name "@" -ZoneName "ityantra.lab" -MailExchange "mail.ityantra.lab" -Preference 10 -TimeToLive 3600

# SRV Record (AD Service)
Add-DnsServerResourceRecordSRV -Name "_ldap._tcp" -ZoneName "ityantra.lab" -DomainName "dc01.ityantra.lab" -Port 389 -Priority 0 -Weight 100 -TimeToLive 3600

Verification

DNS Verification Commands

# Test name resolution
nslookup www.ityantra.lab
nslookup 192.168.1.50

# Test DNS server
dnscmd /Info
Get-DnsServerZone
Get-DnsServerResourceRecord -ZoneName "ityantra.lab"

# Test from client
ipconfig /flushdns
nslookup server01.ityantra.lab

DHCP Verification Commands

# Check DHCP server authorization
Get-DhcpServerInDC

# Check scope
Get-DhcpServerv4Scope

# Check leases
Get-DhcpServerv4Lease -ScopeId 192.168.1.0

# Check reservations
Get-DhcpServerv4Reservation -ScopeId 192.168.1.0

# Test from client
ipconfig /release
ipconfig /renew
ipconfig /all

Expected Results

  • DNS resolves names to correct IP addresses
  • Reverse DNS resolves IP addresses to names
  • DHCP clients receive IP addresses from scope
  • DHCP options (DNS, gateway, domain) applied correctly
  • Reservations assign fixed IPs to specific MAC addresses

Troubleshooting

| Symptom | Possible Cause | Diagnostic Command | Corrective Action | Verification | |---------|---------------|-------------------|-------------------|--------------| | DNS resolution fails | DNS server not responding | `nslookup <server>` | Start DNS service; check firewall | nslookup succeeds | | Clients get no DHCP | DHCP not authorized or scope inactive | `Get-DhcpServerInDC`; `Get-DhcpServerv4Scope` | Authorize server; activate scope | Client gets IP | | DNS zone not found | Zone not created | `Get-DnsServerZone` | Create zone | Zone exists | | Reverse lookup fails | PTR record missing | `nslookup <ip>` | Add PTR record | Reverse lookup works | | DHCP scope exhausted | Too many clients | `Get-DhcpServerv4Lease` | Expand scope; reduce lease time | Leases available | | Zone not replicating | AD replication issue | `repadmin /showreps` | Fix replication | Zone replicates | | DHCP failover not working | Partner unreachable | `Get-DhcpServerv4Failover` | Check network; restart DHCP | Failover active |

Best Practices

1. **Use AD-integrated DNS zones**: Secure updates and replication. 2. **Configure DNS forwarders**: Forward external queries to ISP or public DNS. 3. **Create reverse lookup zones**: Required for some applications and troubleshooting. 4. **Use DHCP exclusions**: Reserve IPs for servers and network devices. 5. **Set appropriate lease duration**: 8 days for wired, 1-2 days for wireless. 6. **Authorize DHCP server**: Required in AD environments to prevent rogue DHCP. 7. **Monitor DNS and DHCP logs**: Event Viewer → Applications and Services Logs. 8. **Implement DHCP failover**: Provides redundancy for IP assignment. 9. **Document DNS records**: Record all hostnames, IPs, and purposes. 10. **Test failover**: Verify DHCP clients get IPs when one server is down.

Conclusion

DNS and DHCP are fundamental network services that enable name resolution and automatic IP configuration. Proper DNS configuration includes forward and reverse zones, host records, and forwarders. DHCP configuration includes scopes, exclusions, reservations, and options. Together, they provide the foundation for network connectivity in Windows Server environments. Regular monitoring and testing ensure these critical services remain available.

References

  • Microsoft DNS Documentation (https://learn.microsoft.com/windows-server/networking/dns/)
  • Microsoft DHCP Documentation (https://learn.microsoft.com/windows-server/networking/dhcp/)
  • PowerShell DnsServer Module (https://learn.microsoft.com/powershell/module/dnsserver/)
  • PowerShell DhcpServer Module (https://learn.microsoft.com/powershell/module/dhcpserver/)
#dns#dhcp#windows-server#network-services#dns-server#dhcp-server#zones#scopes#reservations