When working with Active Directory-integrated DNS zones, you might encounter a puzzling scenario where:
C:\Users\User>nslookup hostname
Server: unknown
Address: 192.168.1.26
*** Unknown can't find hostname: Non-Existent domain
Yet ping works perfectly:
C:\Users\User>ping hostname
Pinging hostname.domain.com [192.168.1.28] with 32 bytest of data:
Reply from 192.168.1.28: bytes=32 time=14ms TTL=128
The core issue stems from how nslookup and ping handle DNS queries differently. Ping uses the full DNS resolution process including:
- Appending DNS suffixes from network adapter settings
- Checking local host files
- Following the full DNS resolution chain
Whereas nslookup by default performs a pure DNS query without suffix appending.
For a workgroup client to properly resolve AD DNS names:
1. Network Adapter Settings:
- Primary DNS: Your AD DNS server (192.168.1.26)
- Secondary DNS: Another DC if available
- DNS suffix for this connection: domain.com
- ✔ Register this connection's addresses in DNS
- ✔ Use this connection's DNS suffix in DNS registration
2. DNS Server:
- Forward lookup zone for domain.com exists
- Allow secure and non-secure dynamic updates
- Reverse lookup zone exists for your subnet
Check DNS client configuration:
Get-DnsClient | Select-Object InterfaceAlias, ConnectionSpecificSuffix,
RegisterThisConnectionsAddress, UseSuffixWhenRegistering
Verify DNS registration:
Resolve-DnsName hostname.domain.com -Server 192.168.1.26
The solution often lies in DHCP configuration. AD-integrated networks should:
- Use Windows Server DHCP role instead of router DHCP
- Configure DHCP Option 015 (DNS Domain Name) with domain.com
- Set DHCP Option 006 (DNS Servers) with AD DNS server IPs
Sample DHCP scope configuration in PowerShell:
Add-DhcpServerv4Scope -Name "MainScope" -StartRange 192.168.1.100
-EndRange 192.168.1.200 -SubnetMask 255.255.255.0
Set-DhcpServerv4OptionValue -DnsDomain domain.com -DnsServer 192.168.1.26
For non-domain joined machines, verify these registry settings:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
- SearchList = domain.com (REG_SZ)
- Domain = domain.com (REG_SZ)
- UseDomainNameDevolution = 1 (REG_DWORD)
For quick testing, you can force nslookup to append suffixes:
nslookup hostname.domain.com
nslookup hostname domain.com
To confirm everything is working properly:
- Clear DNS cache:
ipconfig /flushdns
- Register DNS:
ipconfig /registerdns
- Check all DNS records exist in the zone
A properly configured system should return consistent results across all resolution methods.
During my recent Active Directory DNS configuration, I encountered an interesting discrepancy between nslookup
and ping
commands when resolving hostnames from a workgroup client:
C:\Users\User>nslookup hostname
Server: unknown
Address: 192.168.1.26
*** Unknown can't find hostname: Non-Existent domain
C:\Users\User>ping hostname
Pinging hostname.domain.com [192.168.1.28] with 32 bytes of data:
Reply from 192.168.1.28: bytes=32 time=14ms TTL=128
The difference occurs because:
- Ping uses the full DNS resolution process including DNS suffix search lists
- NSLookup performs a more strict DNS query without suffix appending by default
After extensive testing, these settings proved crucial:
# Network Interface DNS Settings:
Primary DNS: 192.168.1.26 (DC)
DNS suffix for this connection: domain.com
[x] Register this connection's address in DNS
[x] Use this connection's DNS suffix in DNS registration
The critical breakthrough came when I migrated DHCP services from my router to the Windows Server:
# DHCP Scope Options Configuration:
006 DNS Servers = 192.168.1.26
015 DNS Domain Name = domain.com
This script helps validate DNS registration status:
# Check DNS registration status
$computer = $env:COMPUTERNAME
$dnsServer = "192.168.1.26"
$zone = "domain.com"
$record = Get-DnsServerResourceRecord -ZoneName $zone -Name $computer -ComputerName $dnsServer -RRType "A"
if ($record) {
Write-Host "DNS A record exists:" $record.RecordData.IPv4Address
} else {
Write-Warning "No DNS record found for $computer.$zone"
}
# Verify DNS suffix search list
Get-DnsClientGlobalSetting | Select-Object SuffixSearchList
When the basic configuration doesn't resolve the issue:
- Verify reverse lookup zones exist for all subnets
- Check secure DNS updates are properly configured in AD-integrated zones
- Test with FQDN in nslookup:
nslookup hostname.domain.com
- Clear DNS client cache:
ipconfig /flushdns
To make nslookup behave like ping for name resolution, use these commands:
nslookup
> set srchlist=domain.com
> set search
> hostname
Or alternatively in one line:
nslookup hostname.domain.com