Share via


Windows 2012 Core Survival Guide – DNS Server Setting

Learn about my 2012 Core Survival Guide here.

DNS Server Setting

Name resolution is critical to any server configuration.  DNS is required to function correctly to locate Active Directory domain controllers, Exchange Servers, and just about every service located on your network.  It is common for every server to be configured with two DNS servers.  The common errors I run into are misconfigured DHCP scope, DNS Servers are removed from service, or a manual typo in the configuration.  This blog will help you correct the last two mentioned where you need to reconfigure the settings at the server.

Viewing the DNS server

I use the same command to view the DNS server's settings as I did for the Default gateway.  I also show you a third way to view this configuration information.

PowerShell Command:

Get-NetIPConfiguration

The command will show in a list format each network interfaces IP configuration.  Can you spot the IPv4 DNS configuration error?

 

If you wish to view this information in a table format you can use the following command

PowerShell Command:

Get-NetIPConfiguration | format-table interfaceindex, interfacealias,Ipv4address, @{ Label="DefaultGateway"; Expression={ $_.IPv4DefaultGateway.NextHop } }, @{ Label="DnsServers"; Expression={ $_.DnsServer.ServerAddresses } } -autosize

 

 You can also use get-dnsclientserveraddress to view the Dns Server Address of an interface

PowerShell Command:

Get-dnsclientserveraddress -addressfamily IPv4

 

By now you should have noticed that there are no IPv4 DNS server address assigned to each network interface.

Setting the DNS Server Address

I set the DNS server address using the set-dnsclientserveraddress cmdlet.  You do not need to remove any previous settings.  In the example below we are going to set the DNS server address with two new DNS server IP address (192.168.0.10 and 192.168.0.11)

PowerShell Command:

Set-DNSClientServerAddress -interfaceindex 15 -ServerAddress ("192.168.0.10","192.168.0.1")

In the example output below I show you the current settings.  I run the Set-DNSClientServerAddress cmdlet to set the DNS Server Address. Then I show you the results.

 

Removing the DNS Server Address

You can remove the DNS server address by using the cmdlet below:

PowerShell Command:

Set-DNSClientServerAddress -interfaceindex 15 -ResetServerAddress

In the example output below I show you the current settings.  I run the cmdlet to remove the DNS Server Address. Then I confirm the results.

 

I hope you found this useful. Please leave me a comment

Bruce

Comments

  • Anonymous
    January 01, 2003
    Hey Bruce - I really appreciated this article! Just letting you know.