Replace DNS settings with static using netsh

article #548, updated 2857 days ago

First, set the primary DNS as a static primary, bypassing DHCP for DNS only:

netsh interface ip set dns name="Local Area Connection" static 8.8.8.8 primary

Then, add the secondary DNS:

netsh interface ip add dns name="Local Area Connection" 8.8.4.4 index=2

In the example above, 8.8.8.8 is being set as primary, and 8.8.4.4 as secondary; these are Google’s public DNS servers, quite useful in some circumstances. On many systems the names of the interfaces (above, “Local Area Connection”) will have to be changed, either to “Local Area Connection 2” or something more different for wireless; you can get the names using ‘ipconfig’ (they are prefixed with “Ethernet adapter”, take those two words off and you have it) or GUI.

Categories: