Photo of the server/storage
|

Understanding netsh interface ip show dns: How to View and Troubleshoot DNS Settings in Windows

Short answer: The command netsh interface ip show dns shows DNS configuration for each Windows network interface (whether obtained via DHCP or statically configured). Below you’ll find examples, what the output means, modern alternatives using PowerShell, and step-by-step troubleshooting guides.

1. Why Check DNS Settings?

DNS (Domain Name System) maps hostnames such as example.com to IP addresses. When name resolution fails—websites won’t load by name but IPs do, remote services appear down, or your host registers incorrectly—the local DNS configuration is often the culprit.

On the Windows operating system, DNS can be set through DHCP, static configuration, or adapter settings. The command netsh interface ip show dns lets you inspect DNS configuration per interface quickly from the command line.

2. Quick Answer: The Command and Its Output

Command:

C:\> netsh interface ip show dns

Example output:

Configuration for interface "Ethernet"
    DNS servers configured through DHCP: 10.0.0.53
    Register with which suffix: Primary only

Configuration for interface "Wi-Fi"
    DNS servers configured through DHCP: 192.168.1.1
    Register with which suffix: Primary and connection specific
  • Configuration for interface — Name of the network adapter.
  • DNS servers configured through DHCP / static — Lists current DNS servers and how they were obtained.
  • Register with which suffix — Indicates how Windows registers its hostname in DNS (important in enterprise networks).

3. Common Use Cases

Check if DNS is from DHCP or static

Verify whether your DNS settings come from DHCP or were manually assigned.

Verify VPN and split-DNS behavior

VPN adapters often use internal DNS. Use the command to confirm which DNS servers apply to your VPN interface.

Diagnose name resolution failures

If IP connectivity works but hostname resolution fails, check which DNS servers are configured and reachable.

Audit DNS configurations

Gather DNS server details across multiple machines using scripts for inventory or compliance checks.

4. Alternative: PowerShell and Modern Tools

Why PowerShell? The netsh tool is reliable but older. PowerShell offers structured output, scripting support, and easier automation.

Equivalent PowerShell command:

PS C:\> Get-DnsClientServerAddress

Example output:

InterfaceAlias       : Ethernet
InterfaceIndex       : 4
AddressFamily        : IPv4
ServerAddresses      : {10.0.0.53, 8.8.8.8}

To list only IPv4 DNS servers with interface names:

PS C:\> Get-DnsClientServerAddress -AddressFamily IPv4 | Select-Object InterfaceAlias, ServerAddresses

Use netsh for quick inspection and PowerShell for scripting and reporting.

5. Troubleshooting Tips

1) Confirm DNS server configuration

C:\> netsh interface ip show dns
PS C:\> Get-DnsClientServerAddress | Format-Table -AutoSize

2) Test name resolution

C:\> nslookup example.com
PS C:\> Resolve-DnsName example.com

3) Flush the DNS cache

C:\> ipconfig /flushdns

4) Restart the DNS Client service

PS C:\> Restart-Service -Name "Dnscache" -Force

5) Reset TCP/IP stack

C:\> netsh int ip reset
C:\> netsh winsock reset

6) Manually set DNS server

C:\> netsh interface ip set dns name="Ethernet" static 8.8.8.8
PS C:\> Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 8.8.8.8,8.8.4.4

7) Check DNS server reachability

C:\> ping 10.0.0.53
C:\> tracert 10.0.0.53

8) Inspect adapter-specific DNS

Some VPN or virtual adapters override DNS. Inspect all adapters individually using the same command.

9) Check DNS registration settings

For Active Directory environments, ensure the adapter registers with the correct suffix. You can check this in Network Adapter → TCP/IPv4 → Advanced → DNS.

6. Bonus: Automating DNS Checks

Batch script example

@echo off
echo DNS configuration for %computername% > dns-report-%computername%.txt
netsh interface ip show dns >> dns-report-%computername%.txt
echo Report saved to dns-report-%computername%.txt

PowerShell script example

# Run as Administrator
$rows = Get-DnsClientServerAddress -AddressFamily IPv4 | ForEach-Object {
    [PSCustomObject]@{
        Computer        = $env:COMPUTERNAME
        InterfaceAlias  = $_.InterfaceAlias
        InterfaceIndex  = $_.InterfaceIndex
        ServerAddresses = ($_.ServerAddresses -join ";")
    }
}
$rows | Export-Csv -Path "dns-servers-$(Get-Date -Format yyyyMMdd_HHmmss).csv" -NoTypeInformation

This script creates a CSV file listing each adapter and its DNS servers, perfect for audits or inventory.

Check our Windows 11 Installation Checklist for Systems Admins and Ninite: The Easy Way to Install and Update Your Favorite Software

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *