Network Connection Configurations

|

If you are on Windows Vista/7/8 you will need to create the batch file and then run it as administrator.

In the examples below you will need to first know what the connection name is for your network connection(s)

When you click on the start menu or Windows key on your keyboard in the search type in “ncpa.cpl” and hit enter and that will tell you all the connections you have. Depending on what one you use or want to modify you may need to update the name in the below examples from “Local Area Connection” or “Wireless Network Connection” to something else.

Rarely is this needed unless you have already set static IP addresses

@echo off
netsh interface ip set address name="Local Area Connection" source=dhcp
netsh interface ip set dns name="Local Area Connection" source=dhcp

When setting a static IP address you will need to also set the static DNS

@echo off
netsh interface ip set address name="Local Area Connection" source=static addr=10.0.0.54 mask=255.255.255.0
netsh interface ip set address name="Local Area Connection" gateway=10.0.0.1 gwmetric=0
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
ipconfig /all

If you choose to keep DHCP for your IP Address but have static DNS this will be what you need to use.

@echo off
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
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
ipconfig /release
ipconfig /renew
ipconfig /flushdns

OpenDNS Default Servers
Primary: 208.67.222.222
Secondary: 208.67.220.220

OpenDNS FamilyShield DNS Servers
Primary: 208.67.222.123
Secondary: 208.67.220.123

Google Default Servers
Primary: 8.8.8.8
Secondary: 8.8.4.4

Originally Posted on June 25, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.