A command line application, sometimes called a command shell, can be found on most Windows NT-based operating systems. Its purpose is to execute specific commands to troubleshoot or solve specific Windows problems, perform advanced administrative functions, and automate tasks using batch files and scripts.
However, you can also use it to change your IP address when you want to spoof it in order to bypass geoblocks or online bans on sites that impose such restrictions on their content, or change your Domain Name System (DNS) servers. for troubleshooting or for making surfing safer and faster.
In this tutorial, we will show you how to change IP address and DNS servers using command line in Windows 10.
How to change the IP address using Command Prompt
An IP address contains information about your device, location, your Internet Service Provider (ISP), and browser information.
Changing it is useful if you have a faulty router that provides addresses used by another computer on the network, or if you accidentally configure the wrong address. It is also useful if you want to install a new router and reconfigure your home network to use the default IP range.
- Open an elevated command prompt by typing CMD in the search bar and clicking Run as Administrator.
- Then type netsh interface ipv4 show config in the Command Prompt window, press Enter and scroll down to the desired interface.
In our case, we will change the Wi-Fi interface, but you can choose the interface that suits your case. Make a note of the interface name.
- To change the IP address, enter the following command: netsh interface ipv4 set address name = “YOUR INTERFACE NAME” static IP ADDRESS SUBNET_MASK GATEWAY
In our example, this command will look like this: netsh interface ipv4 set address name = “Wi-Fi” static 192.168.0.173 255.255.255.0 192.168.0.0
This command will use the wifi interface, set the IP address to 192.168.0.173, set the subnet mask to 255.255.255.0, and set the default gateway to 192.168.0.0.
If you want to switch to using an IP address automatically assigned by a DHCP server instead of a static IP address, use the netsh interface ipv4 set address name = ”YOUR INTERFACE NAME” command source = dhcp.
How to change DNS Servers using Command Prompt
A DNS server stores public IP addresses and associated host names in a database and is used to translate or translate host names to IP addresses. The server does this by running special software to communicate with other servers using special protocols based on specific requests from the computer.
The conversion process is thoroughly vetted and verified, and it goes quickly behind the scenes to get information that matches the server the computer is looking for, and then tells the originally connected computer where to go so it can connect to that server.
There are several reasons why you might want to change your default DNS server, but the main ones are:
- Increase privacy when bypassing firewalls, bypassing geoblocks or ISP blocking on a website
- Increased security
- Parental controls such as blocking websites on your router.
- Speed ??up browsing that your own ISP’s DNS servers cannot offer as they are not always reliable or up to date
Note. You can change DNS servers individually for your home network on your router or on computers, smartphones, Chromebooks and other devices
How to change DNS servers using the command line
How to change DNS servers using Command Prompt
Follow the steps below to learn how to change DNS servers using the command line.
- Open an elevated command prompt by typing CMD in the search bar and clicking “Run as administrator”.
- Type netsh and press Enter.
- Then enter interface ip show config and press Enter.
- Find the network interface whose DNS server you want to change and enter netsh interface ipv4 set dns name = ”YOUR INTERFACE NAME” static DNS_SERVER. This will set up your primary DNS server.
- Then enter the command netsh interface ipv4 set dns name = ”YOUR INTERFACE NAME” static DNS_SERVER index = 2 to set the secondary DNS server. Again, we’ll use Google’s public secondary DNS server 18.104.22.168 as an example, which will look like this: netsh interface ipv4 set dns name = ”Wi-Fi” static 22.214.171.124 index = 2.
In the above example, we have changed the IP address for the “Wi-Fi” interface, so we will use the same example to change the DNS servers.
For this tutorial, we’ll be using Google’s primary public DNS server, 126.96.36.199. The command will look something like this: netsh interface ipv4 set dns name = ”Wi-Fi” static 188.8.131.52
Note. You can use the netsh interface ipv4 set dnsservers name “YOUR INTERFACE NAME” source = dhcp command if you want the network interface to automatically fetch DNS settings from the DHCP server. Continuing with our example, this command will look like this: netsh interface ipv4 set dnsservers name “Wi-Fi” source = dhcp
Command line is a great tool to use when you want to change IP addresses and DNS servers. It’s faster and saves you the trouble of clicking through multiple windows and dialogs in the Control Panel interface just to go to the IPv4 Properties dialog and do the same.
Was this guide helpful? Let us know by leaving your comment in the section below.