Learn › Windows Server

DNS and DHCP Essentials for Windows Admins

How DNS and DHCP work on a Windows network, the records you use every week, and the commands that solve most 'can't connect' problems fast.

Intermediate 11 min read
By Gopinath Karthikeyan

“It’s always DNS” is a joke because it’s so often true. When a user says an app is down, the server is frequently fine – their computer just can’t find it. This guide gives you the basics of DNS and DHCP, and a routine to rule them in or out fast.

DNS in one minute

DNS turns names (app01.contoso.local) into IP addresses (10.0.0.25). When a computer looks up a name it:

  1. Checks its own cache (and the hosts file).
  2. Asks its configured DNS server.
  3. That server answers from its zones, its cache, or by asking other servers (forwarders or root servers).

In an Active Directory network, domain controllers usually run DNS, and AD itself uses special DNS records to let computers find domain controllers. Broken DNS means broken logons.

How a DNS name is resolved: client, Windows DNS server, root, TLD and authoritative servers Your PC Resolve-DnsNamewww.contoso.com உங்கள் PC Resolve-DnsNamewww.contoso.com 1 Where is www.contoso.com? www.contoso.com எங்கே? Windows DNS server Checks cache → own zones → forwarders Windows DNS server Cache → own zones → forwarders பார்க்கும் 2 3 4 Root servers “Ask .com” Root servers “.com-ஐ கேள்” .com servers “Ask contoso” .com servers “contoso-வைகேள்” contoso.com Authoritative contoso.com Authoritative Answer: 203.0.113.10 Cached for the record’s TTL பதில்: 203.0.113.10 TTL நேரம் வரை cache-ல் இருக்கும் 5 Steps 2–4 happen only if the answer isn’t cached or local 2–4: cache-லோ local zone-லோ இல்லை என்றால் மட்டும்
Your PC asks its DNS server (1). If the answer isn’t cached or in a local zone, the server walks root → TLD → authoritative (2–4), then returns and caches the answer (5).PC தன் DNS server-ஐ கேட்கிறது (1). Cache அல்லது local zone-ல் இல்லை என்றால், server root → TLD → authoritative வரை கேட்டு (2–4), பதிலை cache செய்து திருப்பித் தருகிறது (5).

Records you’ll use every week

Record Example Purpose
A app01 → 10.0.0.25 Name to IPv4 address
AAAA app01 → fd00::25 Name to IPv6 address
CNAME reports → app01 An alias pointing to another name
PTR 10.0.0.25 → app01 Reverse lookup (IP to name)
SRV _ldap._tcp.dc._msdcs.contoso.local Lets clients find services such as domain controllers
MX mail server for a domain Email delivery

TTL (time to live) is how long others may cache an answer. Lower it a day before you change an important record, so the change spreads quickly.

Commands that answer most questions

# What does this computer think the name is?
Resolve-DnsName app01.contoso.local

# Ask a specific DNS server (bypasses this computer's cache)
Resolve-DnsName app01.contoso.local -Server 10.0.0.10

# Reverse lookup
Resolve-DnsName 10.0.0.25

# Can I find a domain controller?
Resolve-DnsName -Type SRV _ldap._tcp.dc._msdcs.contoso.local

# Which DNS servers does this computer use?
Get-DnsClientServerAddress -AddressFamily IPv4

# Clear this computer's DNS cache after a record change
Clear-DnsClientCache

nslookup still works, but Resolve-DnsName returns objects you can filter, and it uses the same resolver path as applications.

Managing records on a Windows DNS server

# Add an A record (and its PTR, if the reverse zone exists)
Add-DnsServerResourceRecordA -ZoneName contoso.local -Name app02 -IPv4Address 10.0.0.26 -CreatePtr

# Add an alias
Add-DnsServerResourceRecordCName -ZoneName contoso.local -Name reports -HostNameAlias app02.contoso.local

# Find records
Get-DnsServerResourceRecord -ZoneName contoso.local -Name app02

DHCP in one minute

DHCP hands out IP settings automatically. The client and server exchange four messages – Discover, Offer, Request, Acknowledge (DORA). The client gets an IP address, subnet mask, default gateway and DNS servers for a lease period.

Key ideas:

  • Scope – the range of addresses for a subnet, e.g. 10.0.1.50–10.0.1.200
  • Exclusions – addresses inside the range DHCP must not hand out
  • Reservations – always give the same IP to a specific device (printers, appliances)
  • Options – gateway (003), DNS servers (006), DNS domain name (015)
  • Relay / IP helper – routers forward DHCP requests to a DHCP server in another subnet

Servers should normally have static IPs, not DHCP addresses.

Get-DhcpServerv4Scope
Get-DhcpServerv4Lease -ScopeId 10.0.1.0 | Select-Object IPAddress, HostName, AddressState
Get-DhcpServerv4ScopeStatistics      # how full is each scope?
DHCP DORA process: Discover, Offer, Request, Acknowledge Client PC No IP yet Client PC இன்னும்IP இல்லை DHCP server Scope 10.0.0.0/24 DHCP server Scope 10.0.0.0/24 Discover (broadcast)“Any DHCP server?” Discover (broadcast)“DHCP server இருக்கா?” D Offer“You can have 10.0.0.25” Offer“10.0.0.25 எடுத்துக்கொள்” O Request“I’ll take 10.0.0.25” Request“10.0.0.25 வேண்டும்” R AcknowledgeLease: 8 days AcknowledgeLease: 8 நாட்கள் A The client renews at 50% of the lease time Lease காலத்தின் 50%-ல் client renew செய்யும்
DORA: the client broadcasts Discover, the server Offers an address, the client Requests it and the server Acknowledges with a lease.DORA: client Discover broadcast செய்கிறது, server ஒரு address-ஐ Offer செய்கிறது, client அதை Request செய்கிறது, server lease உடன் Acknowledge செய்கிறது.

A 5-minute “can’t connect” routine

  1. Resolve-DnsName name – does the name resolve? To the right IP?
  2. Test-NetConnection 10.0.0.25 -Port 443 – is the port reachable? (TcpTestSucceeded)
  3. If the name fails but the IP works → it’s DNS. Check the record and the client’s DNS servers.
  4. If the client has a 169.254.x.x address → it never got a DHCP lease. Check the scope isn’t full and the relay is configured.
  5. If it works from one PC but not another → compare their DNS servers and clear the cache.

FAQ

I changed a record but users still reach the old server. Why? Caching. The old answer lives in client and server caches until its TTL expires. Clear caches you control and wait out the rest.

Should every server have a PTR record? It’s good practice. Some tools and security checks rely on reverse lookups.

What’s next

Next: Group Policy – create, link and troubleshoot.

Practise this topic

Test yourself with free questions on this topic – instant answers and explanations.

Start practice questions

DNSDHCPWindows ServerNetworkingTroubleshooting

Gopinath Karthikeyan

Gopinath Karthikeyan – Windows Site Reliability Engineer with about 12 years in enterprise Windows Server infrastructure, and founder of WinOps Academy. YouTube · LinkedIn

More in Windows Server