I have just faced an interesting problem at work. When I log onto work’s WiFi network I have to use a DNS server that is assigned by DHCP. After logging in, there is some bug that does not allow me access to company’s web page that is public on the Internet. So I came up with this little trick:
- Set DNS to be retrieved via DHCP
- Log into the network
- Set DNS back to Google ones (184.108.40.206 and 220.127.116.11)
And all of this can easily be done using NETSH command (everything is in a “.bat” file. It requires to be run with administrator priviliges):
ECHO OFF ECHO Setting DNS to DHCP mode... netsh interface ip set dns name="WiFi" DHCP ECHO ...done. Press ENTER to set DNS back to Google's servers PAUSE ECHO Setting primary DNS server... netsh interface i set dns "WiFi" static 18.104.22.168 ECHO ...done. Setting secondary DNS server... netsh interface ip add dns name="WiFi" addr=22.214.171.124 index=2 ECHO ...done. PAUSE
NOTE: My wireless connection name is “WiFi”. Adjust it to match yours accordingly.