Change DNS Settings


Manually change the DNS server used by Windows.
This is where the DNS server IP addess is set in windows.
To get here in vista, Control Panel > Network and Sharing Centre > Manage Network Connections.

Right click on whichever network card you are using and select "Properties".


Select "Internet Protocol Version 4 (TCP/IPv4)" and click "Properties"



Select "Obtain DNS server addess automatically" to use the DNS server set in the router.
Select "Use the following DNS server addess" to specify your own DNS server, in this case it's set to Google DNS.



Switch DNS server's in seconds using a batch file.

The following batch files allows you to change DNS server settings in the computers TCP properties. This change takes effect immediately without the need to re-boot.
To create the batch file, copy and past the following to a "notepad" file and save with the extension ".bat" (eg opendns.bat)  or down load the files at the bottom of this page.
To use the file, right click on the file and select "Run as administrator".

Batch file to set OpenDNS as the DNS server for a wireless connection.
rem Set Opendns for wireless connection

ipconfig /flushdns
netsh interface ip set dns name="Wireless Network Connection" source=static addr=208.67.222.222
netsh interface ip add dns name = "Wireless Network Connection" addr=208.67.220.220

pause

Batch file to set OpenDNS as the DNS server for a wired connection.
rem Set Opendns for wired connection

ipconfig /flushdns 
netsh interface ip set dns name="Local Area Connection" source=static addr=208.67.222.222
netsh interface ip add dns name = "Local Area Connection" addr=208.67.220.220

pause

Batch file to re-set to "Obtain DNS server address automatically" for a wireless connection.
rem Set Obtain DNS Automatically for a wireless connection

ipconfig /flushdns
netsh interface ip set dns name="Wireless Network Connection" dhcp

pause

Batch file to re-set to "Obtain DNS server address automatically" for a wired connection.
rem Set Obtain DNS Automatically for a wired connection

ipconfig /flushdns
netsh interface ip set dns name="Local Area Connection" dhcp

pause


Explanation of opendns.bat
When a line starts with "rem" no commands in this line are processed. It's a convenient way to disable a line of commands or to include a line of text (remarks).
"ipconfig /flushdns" -- this clears the DNS cache.
Then next one or two lines set the DNS servers used by the computers wireless network card ("Wireless Network Connection")  or ethernet network card ("Local Area Connection").
In some cases the name of the network card may be different to that show here, check the Network Connections window for the name of your card. See screen capture at top of this page.
The "pause" instruction causes the batch window to remain showing until a key is pressed. This can be removed if you wish the batch window to automatically closed after the file has finished.



Important Notes: If "User Account Control" is turned on in vista or windows 7 :-
The batch file needs to be run by right clicking on the batch file and select "Run as administrator".

If run from a shortcut, first configure the shortcut by right clicking on it, select properties > shortcut tab > advanced > place tick in "Run as administrator" > ok > ok.

If running your own DNS resolver then be aware, IP 127.0.0.1 can not be set with the "netsh" command.Changing the DNS settings using "netsh.exe" or batch file using "netsh" may produce an error saying the DNS server is invalid. The batch files may also be slow to complete.This indicates "netsh" is being blocked by a firewall and needs outbound permission on UDP port 53.See windows vista outbound firewall rules In some cases the network connection name my have a number appended.eg "Wireless Network Connection 2"In this case the batch files on this page need editing to reflect this.

Freely available DNS servers and batch file downloads.


OpenDNS
208.67.222.222
208.67.220.220

DNSAdvantage
156.154.70.1
156.154.71.1

Level 3 Communications
4.2.2.1
4.2.2.2
4.2.2.3
4.2.2.4
4.2.2.5
4.2.2.6
209.244.0.3
209.244.0.4

Google DNS
8.8.8.8
8.8.4.4

The following batch files work in Windows xp, Vista and Windows 7.
Wireless connection batch files
Local connection batch files



All in  one batch file.
The following batch files combine the above in to two files, one for wireless connections and one for wired connections.
These two files are suitable for Vista and Windows 7, they will not work in Windows XP.

 
Download for both files  Batch.zip



Batch file to check which DNS server has been set.

This show "Advantage" DNS is used by the wireless network connection, no setting for the local area connection.
Works with Windows xp, Vista and Windows 7
This file contains just two line:-

ipconfig /all
pause



Install a personal DNS caching resolver
DNS resolvers available for windows and where to download.

Install Bind for Windows Install Bind as a local DNS caching resolver.

Install Unbound for Windows Install Unbound as a local DNS caching resolver.

Home Page

footer
Copyright© NPR 2010 - 2012       Disclaimer