Sunday, 29 March 2020

How to Change LAN IP address and DNS Server by Command Prompt

Changing the TCP/IP settings via the GUI interface is very easy and simple. But
What happened if you are working with more than one network simultaneously? It will be very difficult to change IP Address and DNS server frequently via GUI Interface.
It is very easy to change IP Address and DNS server by Command Prompt using the built-in utility in Windows called Netsh

 To run Netsh click on Startthen type CMD and press ENTER.
On command Prompt window type netsh and press Enter. Now  type “interface ip show config“. That command will bring up the TCP/IP network settings.

Now, To change IP Address, Subnet mask and Default Gateway of  the Ethernet TCP/IP settings, type the following command: “Interface ip set address name="Ethernet" static 192.168.1.10 255.255.255.0 192.168.1.1”

In the example above, we changed the network properties for “Ethernet” to use a static IP address of 192.168.1.10,subnet mask  255.255.255.0 and a default gateway of 192.168.1.1.

To change DNS Server of  the Ethernet TCP/IP settings, type the following command: “interface ip set dns name="Ethernet" static 208.67.222.193”

To change DNS Server of  the Ethernet TCP/IP settings, type the following command:  “interface ip set dns name="Ethernet" static 4.2.2.2 index=2

To set the network properties to obtain the IP address from a DHCP server of Router, type the following command:  “interface ip set address "Ethernet" dhcp”
To set DNS to obtain IP address automatically from a DHCP server of Router,   type the following: interface ip set dns "Ethernet" dhcp”
 After all command complete If you see network adapter settings via Control Panel, you’ll see that the values have been updated there in the GUI interface.


No comments: