Skip to content

Instantly share code, notes, and snippets.

@jackthailand
Forked from programmarchy/dns-dhcp.bat
Created July 15, 2018 13:26
Show Gist options
  • Save jackthailand/a0e3b5d0cbc1b5822beeb396bf7b6a43 to your computer and use it in GitHub Desktop.
Save jackthailand/a0e3b5d0cbc1b5822beeb396bf7b6a43 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