Switching between DNS addresses easily

1

Sometimes I need to use preferred and alternate DNS server addresses, and sometimes I need Windows to obtain it automatically. The common approach to switch between those addresses is:

  • Right click on Local Area Connection icon on the taskbar notification area
  • Select Status
  • Click on Properties
  • Select Internet Protocol (TCP/IP) and select Properties
  • Switch between Obtain DNS server address automatically and Use the following DNS server addresses.

Since I am switching them frequently, I need a faster and easier way to do this. Any recommendations?

Mehper C. Palavuzlar

Posted 2010-02-03T13:16:05.890

Reputation: 51 093

Answers

2

You could use the netsh.exe command-line utility to achieve that. I found this page which provides some examples, including a couple to edit nameservers.

ayaz

Posted 2010-02-03T13:16:05.890

Reputation: 8 106

3

I use Net Profiles for this purpose. You can make predefined network profiles and easily switch between them at any time:

alt text

Features

  • Save your network settings as profiles.
  • Automatically activate wireless profiles when specified wireless connections are detected. (XP only)
  • Change IP Address, Subnet Mask, Default Gateway, Primary and Secondary DNS Servers, WINS Server, and DHCP settings with the click of a button.
  • Specifiy different mapped drives for each profile.
  • Change your default printer based on which profile you're currently using.
  • Automatically change your profile via program shortcuts created with Net Profiles.
  • Change the default homepage for Internet Explorer, Firefox, and Opera.
  • Proxy settings for Internet Explorer, Firefox, and Opera.
  • Run a user-defined list of programs when a profile is activated.
  • Maintain seperate desktop wallper for each profile.
  • Change screen resolutions and color quality when profiles are activated.
  • Can be easily translated into other languages using the enclosed XML language file.

Net Profiles is free and open source.

John T

Posted 2010-02-03T13:16:05.890

Reputation: 149 037

0

You could set up a Powershell script to change the DNS settings as shown in this blog:

$strDNSServers = "192.168.1.50", "192.168.1.51","192.168.1.52"

function Update-DNS
{
  $Nic = Get-WMIObject Win32_NetworkAdapter -comp $strComputer |where{$_.NetConnectionID -eq "Local Area Connection"}

  $Config   = Get-WMIObject Win32_NetworkAdapterConfiguration -comp $strComputer |where{$_.MACAddress -eq $Nic.MACAddress}

  write-host "The current DNS Search Order is:"
  $config.DNSServerSearchOrder

  $config.SetDNSServerSearchOrder($strDNSServers) | out-null
}

heavyd

Posted 2010-02-03T13:16:05.890

Reputation: 54 755