Skip to content

Instantly share code, notes, and snippets.

@programmarchy
Created August 24, 2011 14:52
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save programmarchy/1168242 to your computer and use it in GitHub Desktop.
Save programmarchy/1168242 to your computer and use it in GitHub Desktop.
Batch files for switching DNS servers between Google (8.8.8.8, 8.8.4.4) and DHCP
REM
REM Usage:
REM dns-dhcp.bat
REM
REM Description:
REM Configures DNS Servers with DHCP on interfaces listed below.
REM
REM To change interfaces, replace "name" with your interface names, or use "index" instead.
REM
REM To list the names and indices of your interfaces, run:
REM
REM netsh interface ipv4 show interfaces
REM netsh interface ipv6 show interfaces
REM
netsh interface ipv4 set dnsservers name="Local Area Connection" source=dhcp
netsh interface ipv6 set dnsservers name="Local Area Connection" source=dhcp
netsh interface ipv4 set dnsservers name="Wireless Network Connection" source=dhcp
netsh interface ipv6 set dnsservers name="Wireless Network Connection" source=dhcp
REM
REM Usage:
REM dns-google.bat
REM
REM Description:
REM Configures Primary and Secondary DNS with Google DNS Servers on interfaces listed below.
REM
REM To change interfaces, replace "name" with your interface names, or use "index" instead.
REM
REM To list the names and indices of your interfaces, run:
REM
REM netsh interface ipv4 show interfaces
REM netsh interface ipv6 show interfaces
REM
netsh interface ipv4 add dnsserver "Local Area Connection" 8.8.8.8
netsh interface ipv6 add dnsserver "Local Area Connection" 2002:0:0:0:0:0:808:808
netsh interface ipv4 add dnsserver "Wireless Network Connection" 8.8.4.4
netsh interface ipv6 add dnsserver "Wireless Network Connection" 2002:0:0:0:0:0:808:404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment