Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set / change DNS using the command-prompt at windows 8

How can I set my DNS settings using the command-prompt or bat file at windows 8

I tried this:

netsh interface ip set dns name="Local Area Connection" source=static addr=none 

but not worked.

like image 986
Zuhair Taha Avatar asked Sep 04 '13 17:09

Zuhair Taha


People also ask

How do I change DNS settings on Windows 8?

Double-click on the icon for the internet connection you are using and then click 'Properties' Click on 'Internet Protocol Version 4 (TCP/IPv4)', then 'Properties' Select the option 'Use the following DNS server addresses' Enter the new DNS address, then click 'OK' to apply the new settings.

What command is used to configure DNS from the Command Prompt?

At the command prompt, type ipconfig /displaydns and press Enter to see that the entry is in your DNS cache. Type ping university and press Enter.

How do I change my DNS from 8.8 8.8 to 11?

To make changes, click the Edit button. Select Manual from the dropdown menu when the “Edit network DNS settings” dialog comes up. Next, turn on IPv4 and type in the preferred and alternate DNS provider's details. For example, to use Google's public DNS, type 8.8.


2 Answers

First, the network name is likely "Ethernet", not "Local Area Connection". To find out the name you can do this:

netsh interface show interface 

Which will show the name under the "Interface Name" column (shown here in bold):

 Admin State    State          Type             Interface Name ------------------------------------------------------------------------- Enabled        Connected      Dedicated        Ethernet 

Now you can change the primary dns (index=1), assuming that your interface is static (not using dhcp):

netsh interface ipv4 add dnsserver "Ethernet" address=192.168.x.x index=1 

2018 Update - The command will work with either dnsserver (singular) or dnsservers (plural). The following example uses the latter and is valid as well:

 netsh interface ipv4 add dnsservers "Ethernet" address=192.168.x.x index=1 
like image 196
chue x Avatar answered Oct 13 '22 04:10

chue x


To change DNS to automatic via command, you can run the following command:

netsh interface ip set dns "Local Area Connection" dhcp 
like image 45
Marcos Cassiano Avatar answered Oct 13 '22 05:10

Marcos Cassiano