How to Change Your IP Address From the Command Prompt in Windows

HomeLatest NewsTechnology

How to Change Your IP Address From the Command Prompt in Windows

Using the Control Panel tool to change your IP address isn't hard, but you do have to click through a number of different windows and dialog boxes. Bu

How to Use the Linux Terminal to Copy Files and Directories
Some changes in the nails always indicate a serious problem
Top Elements to Level-Up Your Live Streaming Game
Spread the love

Using the Control Panel tool to change your IP address isn’t hard, but you do have to click through a number of different windows and dialog boxes. But if you like the Command Prompt, you can do it faster by using the netsh command, one of the many great network apps that come with Windows.

Launch Command Prompt as Admin to Use Netsh

We’ll use the netsh tool, which needs tool Prompt to be opened as an administrator for it to work. The netsh command in Windows lets you change almost every part of your network links.

To run Command Prompt (or PowerShell) as Admin, open the Start menu, look for “cmd,” hover over the result, and then click “Run as Administrator.”

Opening Command Prompt on Window 10

You can also right-click the Start menu or press Windows+X on your computer to open the Power User Menu and select “PowerShell (Admin)” in Windows 10 or Windows 11.

View Your Network Information with Command Prompt

Before you can change your IP address and other related information, you’ll need to find the full name of the network for the device you want to change. Type the following instructions to do this:

netsh interface ipv4 show config

Command Prompt Interface

Keep scrolling down until you find the layout you want. In our case, we’ll change the Wi-Fi interface, which on our computer is simply called “Wi-Fi.” Windows gives ports other names by default, like “Local Area Connection,” “Local Area Connection* 2,” and “Ethernet.” Just look for the one you want and write down the exact name. To make things easier, you can also copy and paste the name into Notepad and then back into Command Prompt.

Change Your IP Address, Subnet Mask, and Default Gateway

With the interface name in hand, you can change the IP Address, subnet mask, and gateway. To do this, you’ll issue a command using the following syntax:

netsh interface ipv4 set address name="YOUR INTERFACE NAME" static IP_ADDRESS SUBNET_MASK GATEWAY

So, for example, your command might look something like the following:

netsh interface ipv4 set address name="Wi-Fi" static 192.168.3.8 255.255.255.0 192.168.3.1

Where the info is replaced by whatever you want to use. In our example, the command does the following:

  • Uses the interface name “Wi-Fi”
  • Sets the IP address to 192.168.3.1
  • Sets the subnet mask to 255.255.255.0
  • Sets the default gateway to 192.168.3.1

And if you are using a static IP address but want to switch to an IP address that is automatically given by a DHCP server, like your router, you can use the following command:

netsh interface ipv4 set address name="YOUR INTERFACE NAME" source=dhcp

Change Your DNS Settings in Command Prompt

You can also change a network interface’s DNS servers with the netsh tool. DNS servers from companies other than your ISP, like Google Public DNS and OpenDNS, can be faster and more secure. No matter why you want to change your DNS server, you can do it at the router or on each individual device. If you do it at the router, the change will affect all the devices that get their information. With the netsh tool, it’s easy to change the DNS servers for just one PC.

You’ll need to use the command twice: once to set your main DNS server and again to set your secondary, or backup, DNS server. Use the following code to set your main DNS server:

netsh interface ipv4 set dns name="YOUR INTERFACE NAME" static DNS_SERVER

So, for example, your command might look something like the following (in which we set it to Google’s primary public DNS server, 8.8.8.8):

netsh interface ipv4 set dns name="Wi-Fi" static 8.8.8.8

To set your secondary DNS server, you’ll use a very similar command:

netsh interface ipv4 set dns name="YOUR INTERFACE NAME" static DNS_SERVER index=2

So, continuing our example, you might set your secondary DNS as the Google Public DNS secondary server, which is 8.8.4.4:

netsh interface ipv4 set dns name="Wi-Fi" static 8.8.4.4 index=2

And just like with the IP address, you can change it so that the network interface immediately gets its DNS settings from a DHCP server instead. Just type in the following:

netsh interface ipv4 set dnsservers name"YOUR INTERFACE NAME" source=dhcp

And that’s the end of it. Whether you prefer working at the command prompt or just want to show off to your coworkers, you now know how to change your IP address settings with command line magic.

FAQS

Is it possible to change your IP address?

You can change your IP address by using the Tor browser, a VPN, or a proxy server, or by changing the settings on your computer. Is it against the law to change your IP address? It may or may not be allowed to change your IP address. It depends on how you do it and where you are.

How do I change my IP address settings?

  1. Select Start, then select Settings > Network & Internet.
  2. Do one of the following: For a Wi-Fi network, select Wi-Fi > Manage known networks. …
  3. Under IP assignment, select Edit.
  4. Under Edit IP settings, select Automatic (DHCP) or Manual. …
  5. When you’re done, select Save.

Does a VPN change your IP?

A VPN changes your real IP address, so it looks like you’re connecting to the internet from a different place: the real location of the VPN server, instead of where you are. This is just one reason why so many people use VPNs.


Spread the love

COMMENTS