• Buying Guides

Complete Guides by How-To Geek

Our latest product roundups, reader favorites, more from how-to geek, latest geek news, latest reviews, across lifesavvy media.

Join 425,000 subscribers and get a daily digest of news, geek trivia, and our feature articles.

By submitting your email, you agree to the Terms of Use and Privacy Policy .

How to Assign a Static IP Address in Windows 10 or 11

Lowell is the founder and CEO of How-To Geek. He’s been running the show since creating the site back in 2006. Over the last decade, Lowell has personally written more than 1000 articles which have been viewed by over 250 million people. Prior to starting How-To Geek, Lowell spent 15 years working in IT doing consulting, cybersecurity, database management, and programming work. Read more...

how to set static ip address in windows 7 using cmd

Sometimes, it’s better to assign a PC its own IP address rather than letting your router assign one automatically. Join us as we take a look at assigning a static IP address in Windows.

What is a Static IP Address? Assign Static IP Addresses Via Your Router How to Set a Static IP Address in Windows 11 How to Set a Static IP Address in Windows 10 How to Set a Static IP Address in Windows 7 or 8 Using "Network Connections" Set a Static IP Address in Windows Vista Set a Static IP Address in Windows XP

What is a Static IP Address?

A static IP address is manually set to a permanent, fixed address rather than being assigned automatically by your router using a procotol known as Dynamic Host Configuration Protocol (DHCP). DHCP is a handy way for devices to connect to your network more easily, because you don’t have to configure IP addressing for each new device yourself. The downside to automatic addressing is that it’s possible for a device’s IP address to change from time to time, which is why people choose static IPs for certain types of devices. For example:

Whatever your reason, assigning static IP addresses to devices is not difficult, but you do have a choice to make—whether to do it from the router or on the device itself.

RELATED: How to Set a Static IP Address in Ubuntu

Assign Static IP Addresses Via Your Router

While this article covers assigning static IP addresses to PCs within Windows itself, there is another way to go about it. Many routers allow you to assign a pool of IP addresses that are handed out to specific devices (based on the device’s physical, or MAC address). This method offers a couple of significant advantages:

This article is about assigning static IP addresses directly to PCs running Windows. We’ve already got a great guide on How to Set Static IP Addresses On Your Router , so if that’s the way you want to go, be sure to give it a read.

With all that in mind, though, let’s take a look at how to assign static IP addresses within any version of Windows.

RELATED: How to Find Your Router's IP Address on Any Computer, Smartphone, or Tablet

How to Set a Static IP Address in Windows 11

To set a static IP address in Windows 11, you’ll want to open Settings, go to Network & Internet, and then find the Properties for your network. Inside there you’ll be able to click the Edit button for IP Assignment and then fill out the manual network details.

First, open up the Settings app and then find Network & Internet on the left-hand side. You’ll be presented with a panel that shows your current network connection. You can click where it says “Properties” right underneath the network, or if you have multiple network connections you can drill down into the specific network to see the IP address details for each one . In this case it’s called “Ethernet”, but you will most likely see “Wi-Fi” as the option to choose.

Once you’ve drilled down into the network connection that you want to set a manual IP for, scroll down until you see “IP Assignment” and then click the Edit button to the right.

Once there, you’ll flip the drop-down to “Manual” and switch the IPv4 switch to “On”. At this point you can fill out your network details and click Save to finish.

You can also use the old-school Network Connections panel in Windows 11, so if you prefer to use that method, keep reading.

If you’re interested in more advanced networking, you might need to set up a static TCP/IP route , reset the entire TCP/IP stack on Windows , check open TCP/IP ports , find your MAC address on Windows , or find your IP address from the Command Prompt . We’ve got you covered there too.

How to Set a Static IP Address in Windows 10

To set a static IP address in Windows 10, you’ll need to open the Settings app and drill down to Network & Internet. From there you’ll select Properties for your network, and then the Edit button next to IP Assignment where you can input a manual IP address.

First, open the Settings app and locate the Network & Internet button.

On the next screen you’ll see your network status, which should show you your active network. Here you’ll want to click the Properties button. If you have multiple different networks, you could select them from the left-hand menu—in our case you’ll notice we have both Wi-Fi and Ethernet networks, so you’ll want to pick the one that you are trying to set a manual IP address for. You’ll notice this is the same method we use when we’re trying to find an IP address on Windows 10 .

On the network properties screen, scroll down until you see “IP settings” and click the Edit button under “IP assignment”.

In the resulting popup window, change the Edit IP settings dropdown to Manual and then flip the IPv4 switch to “On”. Fill out the details, click Save, and you should be good to go.

You might need to reboot to get all of your applications to work properly, just because it’s Windows.

It’s worth noting that you can use the old Network Connections method to set an IP address in any version of Windows, so if you prefer that method, keep reading.

How to Set a Static IP Address in Windows 7 or 8 Using “Network Connections”

To change the computer’s IP address in Windows 7, you’ll need to open the “Network Connections” window. Hit Windows+R, type “ncpa.cpl” into the Run box, and then hit Enter.

In the “Network Connections” window, right-click the adapter for which you want to set a static IP address, and then select the “Properties” command.

In the properties window for the adapter, select “Internet Protocol Version 4 (TCP/IPv4)” and then click the “Properties” button.

Select the “Use the following IP address” option, and then type in the IP address, subnet mask, and default gateway that corresponds with your network setup. Next, type in your preferred and alternate DNS server addresses. Finally, select the “Validate settings upon exit” option so that Windows immediately checks your new IP address and corresponding information to ensure that it works. When you’re ready, click the “OK” button.

And then close out of the network adapter’s properties window.

Windows automatically runs network diagnostics to verify that the connection is good. If there are problems, Windows will give you the option of running the Network troubleshooting wizard. However, if you do run into trouble, the wizard likely won’t do you too much good. It’s better to check that your settings are valid and try again.

Set a Static IP Address in Windows Vista

Changing your IP from DHCP to a Static address in Vista is similar to other versions of Windows, but getting to the correct location is a bit different. Open the Start Menu, right-click on Network, and select Properties.

The Network and Sharing Center opens…click on Manage network connections .

Right-click on the network adapter you want to assign an IP address and click Properties.

Highlight Internet Protocol Version 4 (TCP/IPv4) then click the Properties button.

Now change the IP, Subnet mask, Default Gateway, and DNS Server Addresses. When you’re finished click OK.

You’ll need to close out of Local Area Connection Properties for the settings to go into effect.

Open the Command Prompt and use the ipconfig command to verify that the changes were successful.

Set a Static IP Address in Windows XP

To set a Static IP in Windows XP, right-click the “My Network Places” icon, and then select “Properties.”

Right-click the adapter for which you want to set the IP, and then select “Properties” from the context menu.

Select the “Internet Protocol (TCP/IP)” entry, and then click the “Properties” button.

Select the “Use the following IP address” option. Type in the IP address, subnet mask, default gateway, and DNS server addresses you want to use. When you’re finished, click the “OK” button.

You will need to close out of the adapter’s properties window before the changes go into effect.

And you can verify your new settings by using the ipconfig  command at the command prompt.

By and large, it’s better to let most of your devices have their IP addresses assigned automatically by your router. Occasionally, though, you might want to set a static IP address for a particular device. While you can set static IP addresses directly on your devices (and this article has shown you how to do just that on Windows PCs), we still recommending setting up static IP addressing on your router if possible. It will just make life easier.

RELATED: How to Find Any Device's IP Address, MAC Address, and Other Network Connection Details

how to set static ip address in windows 7 using cmd

Static IP Configuration - Windows 7

Click the Start menu. Next, click on the Control Panel option.

how to set static ip address in windows 7 using cmd

Click on the Network and Sharing Center option.

how to set static ip address in windows 7 using cmd

Click on Change adapter settings from the left side menu.

how to set static ip address in windows 7 using cmd

Right-click on the Local Area Connection icon, then select Properties .

how to set static ip address in windows 7 using cmd

In the window that opens, click on the Internet Protocol Version 4 (TCP/IPv4) (you may need to scroll down to find it). Next, click on the Properties button.

how to set static ip address in windows 7 using cmd

In the window that opens, click the Use the following IP address: radio button. In the IP address: , Subnet mask: , and Default gateway: number fields, insert the numbers that were assigned to you by OIT.

how to set static ip address in windows 7 using cmd

Next, click the Use the following DNS server addresses: radio button. Next, in the Preferred DNS server: , and Alternate DNS server: number fields, input the numbers that were assigned by OIT. Then click the OK button.

how to set static ip address in windows 7 using cmd

Click OK in the other window. You can now start using your new internet connection. If for some reason the internet connection doesn't start working right away, restart the computer and try again.

Tweaks.com Logo

Configure IP Address and DNS from Command Line

Posted in Windows 10 , Windows 7 , Windows Vista , Windows Server by Steve Sinchak

how to set static ip address in windows 7 using cmd

The first thing you need to identify is the name of the network interface you want to modify.  You can find the names of all network interfaces by running the following command:

This will list all the interfaces available.  In most cases, your wired network adapter will be called "Local Area Connection" but it may include a number at the end of the name.  It is important to use the full name in the commands below and surround it with quotes if the name contains spaces.   

How to set a static IP address

A static IP address can be set from the command prompt by running the netsh command at an administrative level prompt.  Make sure to substitute the parameters in the command below for your environment. 

"Local Area Connection" is the name of the adapter you want to modify.

"123.123.123.123" is the IP address you want to set. 

"255.255.255.0" is the subnet mask.

"123.123.123.1" is the gateway.

The "1" on the end of the command is the gateway metric. You will want to leave this as 1 for almost all cases. 

How to enable DHCP instead of a static IP

If you want to enable DHCP you can run:

As mentioned in the previous section, replace "Local Area Connection" with the name of the network adapter you want to modify.  

How to Set Specific DNS Servers

There are two commands for DNS since administrators typically configure a primary and secondary DNS server. 

For the primary DNS server run:

For the secondary DNS server run:

How to configure the network adapter to use the DNS servers provided by DHCP:

If you PC is already configured to use DHCP want to configure the adapter to use DNS from DHCP as well run the following command. 

When you are finished with all of your IP and DNS changes run ipconfig -all to review the new settings.

Windows 10

Hot Deals @ DealGizmo.com

Apple 2022 MacBook Air Laptop with M2 chip: 13.6-inch Liquid Retina Display 8GB RAM 512GB SSD Storage Backlit Keyboard 1080p FaceTime HD Camera. Works with iPhone and iPad; Silver

$1,499.00 $1,299.99 (13% off) Apple 2022 MacBook Air Laptop with M2 chip: 13.6-inch Liquid Retina Display 8GB RAM 512GB SSD...

SteelSeries Arctis Nova Pro Wireless Xbox Multi-System Gaming Headset - Premium Hi-Fi Drivers - Active Noise Cancellation - Infinity Power System - ClearCast Mic - Xbox PC PS5 PS4 Switch Mobile

$349.99 $306.15 (13% off) SteelSeries Arctis Nova Pro Wireless Xbox Multi-System Gaming Headset - Premium Hi-Fi Drivers -...

Apple MagSafe Battery Pack - Portable Charger with Fast Charging Capability Power Bank Compatible with iPhone

$99.00 $79.00 (20% off) Apple MagSafe Battery Pack - Portable Charger with Fast Charging Capability Power Bank Compatible...

ROCKPALS Portable Power Station 1254.4Wh 1300W LiFePO4 Battery Backup Power Solar Generator with 3x110V/1300W AC Outlets(Peak 2000W) Emergency Power Equipment for Outdoor RV/Van Camping Home Use

$2,099.00 $1,399.99 (33% off) ROCKPALS Portable Power Station 1254.4Wh 1300W LiFePO4 Battery Backup Power Solar Generator with...

Epson Expression Premium XP-6100 Wireless Color Photo Printer with Scanner and Copier Black Medium

$189.99 $99.99 (47% off) Epson Expression Premium XP-6100 Wireless Color Photo Printer with Scanner and Copier Black Medium

Rechargeable Lighted Makeup Mirror Wall Mount Extendable Double Sided Vanity Mirror with 10X Magnification 8 Inch Led Magnifying Mirror with 3 Color Lights Articulating Bathroom Mirror Matt Nickel

$46.99 $37.39 (20% off) Rechargeable Lighted Makeup Mirror Wall Mount Extendable Double Sided Vanity Mirror with 10X...

Apple 96W USB-C Power Adapter

$80.38 $59.00 (27% off) Apple 96W USB-C Power Adapter

Multi Plug Outlet Extender with USB Outlets Power Strip Non Surge Protector Electric Outlet Splitter with 3 USB Wall Charger (1 USB C) Multiple Outlet Expander for Cruise Dorm Travel Home Office

$12.99 $9.99 (23% off) Multi Plug Outlet Extender with USB Outlets Power Strip Non Surge Protector Electric Outlet Splitter...

Apple 140W USB-C Power Adapter

$99.00 $79.00 (20% off) Apple 140W USB-C Power Adapter

NOBLEWELL Computer Desk with Storage Shelves 47 inch Home Office Desk with Monitor Stand Writing Desk Table with Keyboard Tray (Rustic Brown)

$139.99 NOBLEWELL Computer Desk with Storage Shelves 47 inch Home Office Desk with Monitor Stand Writing...

Windows 7 Tweaks by Steve Sinchak

StackHowTo

Home » Windows 10 » How To Set Static IP Address in Windows 10 using CMD

How To Set Static IP Address in Windows 10 using CMD

I n this tutorial, we are going to see how to set static IP address in Windows 10 using CMD . There are several methods to set a static IP address in Windows 10. In this tutorial, we will see together how to set a static IP address from the Command Prompt.

In Windows 10, setting a static IP address for your device is an essential configuration that may be required in a number of scenarios. For example, if you plan to share files or a printer on a local network, or when you try to set up port forwarding.

Using CMD may seem difficult for some users, yet it is one of the fastest ways to assign a static IP address in Windows 10.

how to set static ip address in windows 7 using cmd

how to set static ip address in windows 7 using cmd

Image Resizer on Right-click for Windows 10

How to Restore Windows 10 Image Backup From Hard Drive

How to Set an Alarm Clock on Windows 10

How To Find Out If a Program is 32 or 64-bit Windows 10

You May Also Like

Image Resizer on Right-click for Windows 10

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

port forward shopping cart

Setting a Static IP Address in Windows 7

It is very important to setup a static ip address, if you are going to use port forwarding. When you have port forwarding setup, your router forwards ports to an ip address that you specify. This will probably work when you initially set it up, but after restarting your computer it may get a different ip address. When this happens the ports will no longer be forwarded to your computer's ip address. So the port forwarding configuration will not work.

What is an ip address? IP addresses are four sets of numbers separated by periods that allow computers to identify each other. Every computer has at least one ip address, and two computers should never have the same ip address. If they do, neither of them will be able to connect to the internet. There is a lot of information at the following link. You don't need all of it. But if you want to know more about how networks work, you'll find it there. For more information on ip addresses, subnets, and gateways go here

Dynamic vs Static IPs Most routers assign dynamic IP addresses by default. They do this because dynamic ip address networks require no configuration. The end user can simply plug their computer in, and their network will work. When ip addresses are assigned dynamically, the router is the one that assigns them. Every time a computer reboots it asks the router for an ip address. The router then hands it an ip address that has not already been handed out to another computer. This is important to note. When you set your computer to a static ip address, the router does not know that a computer is using that ip address. So the very same ip address may be handed to another computer later, and that will prevent both computers from connecting to the internet. So when you asign a static IP addresses, it's important to assign an IP address that will not be handed out to other computers by the dynamic IP address server. The dynamic IP address server is generally refered to as the dhcp server.

Setting up a static ip for Windows 7.

If you have a printer, before you begin print out this page! Step 1: Open up the start menu, and look for the Search programs and files box. You should now see the following window.

win7_staticip_run_dialog.jpg

Step 2: Type cmd in the Search programs and files box, and press Enter on your keyboard. The will bring up a black command prompt window.

winxp-command.jpg

Step 3: The command prompt may look different on your screen, but it doesn't really matter. Type ipconfig /all in that window, and then press the enter key. This will display a lot of information. If it scrolls off the top you may need to enlarge the window.

win7_staticip_command_prompt.jpg

Step 4: I want you to write down some of the information in this window. Take down the IP address, Subnet Mask, Default Gateway, and Name Servers. Make sure to note which is which. We are going to use this information a little bit later. We are only concerned with IPv4 entries, you can ignore the IPv6 stuff.

The name server entries are a bit complicated. Name Server is just another name for DNS(domain name server) server. Some router's act as a proxy between the actual name servers and your computer. You will know when this is the case, because the Default Gateway will list the same ip address as the Name Servers entry. We need to have the correct Name Server IP addresses. If we do not, you will not be able to browse the web. There are a couple ways to get these. The first way is to log into your router's web interface, and look at your router's status page. On that page you should see an entry for DNS Servers, or Name Servers. Write down the ip adresses of your Name Servers. Another way to get the correct Name Servers to use, is to give your ISP a call. They should know the ip addresses of your Name Servers right off. If they ask you why you need them, you can tell them you are trying to setup a static IP address on your computer. If they try to sell you a static external ip address, don't buy it. That's an entirely different thing that what you are trying to setup.

Type exit in this window, then press the enter key to close it.

Step 5: Once again open the start menu. This time click Control Panel .

win7_staticip_control_panel1.jpg

Step 6: Click on View Network Status and Tasks .

win7_staticip_control_panel2.jpg

Step 7: Single click Change adapter settings on the left side of your screen.

win7_staticip_change_adapter_settings.jpg

Step 8: You might have more than one Internet connection listed here. You will need to determine which adapter is your connection to the Internet if this is the case. Right click on your network adapter and choose properties to open up the properties window of this internet connection.

win7_staticip_change_adapter_properties.jpg

Step 9: Click Internet Protocol Version 4(TCP/IPv4) and then the Properties button.

win7_staticip_lan_properties.jpg

You will see the following screen:

vista_static_ip_07.jpg

Step 10: Before you make any changes, write down the settings that you see on this page. If something goes wrong you can always change the settings back to what they were! You should see a dot in the Obtain an IP address automatically box. If you do not, your connection is already setup for a static ip. Just close all these windows and you are done.

Pick an ip address and enter it into the IP Address box. The ip address you choose should be very similar to the router's ip addres. Only the last number of the ip address should be different. If the router's ip address is 192.168.1.1, I might choose 192.168.1.10. The ip address you choose should end with a number between 1 and 254, and should not be the same as the router's ip address. Every device that connects to your network needs to have it's own ip address.

Put the subnet mask we previously found in the subnet mask section. The default gateway should go into the Default gateway box. Enter the dns servers we prevoiusly found into the two DNS Server boxes. Click okay all the way out of this menu.

If you find that you can not pull up webpages, the problem is most likely the dns numbers you entered. Give your ISP a call, and they will be able to tell you which dns servers to use. This is a question they answer all of the time. They will be able to tell you what you should use right away.

That's it you should be done! If you can't connect to the internet go back and change your configuration back to what it originally was.

More From Portforward

Thumbnail for For Honor

For Honor Port Forwarding

Help improve your online connections and make connecting with others easier in For Honor by forwarding some ports.

Thumbnail for Tom Clancy's The Division 2

Port Forwarding for Tom Clancy's The Division 2

You can help improve your online connections in Tom Clancy's The Division 2 by forwarding some ports in your router.

Back 4 Blood game cover artwork

How to Port Forward Back 4 Blood in Your Router

You can help improve online connections and connect with more players in Back 4 Blood by forwarding some ports.

Thumbnail for Far Cry 6

Creating a Port Forward in Your Router for Far Cry 6

You can help improve your online experiences and more easily connect with others in Far Cry 6 by forwarding some ports.

Thumbnail for Fortnite

How To Open Ports in Your Router for Fortnite

Want a better experience in Fortnite? Setup a port forward in 5 minutes and have a lag free experience.

Minecraft game art showing characters

How To Port Forward Minecraft

Minecraft needs a port forwarded in your router in order to allow other players to connect to your world.

Red Dead Redemption 2 game art showing player pointing a revolver at the viewer.

Open Ports on Your Router for Red Dead Redemption 2

Help improve your online connections in Red Dead Redemption II by forwarding some ports in your router.

Brawlhalla artwork featuring Reno the Bounty Hunter

Opening Ports for Brawlhalla using Your Router

Forwarding some ports for Brawlhalla in your router can help improve your online multiplayer connections.

how to set static ip address in windows 7 using cmd

Change TCP/IP settings

TCP/IP defines how your PC communicates with other PCs.

To make it easier to manage TCP/IP settings, we recommend using automated Dynamic Host Configuration Protocol (DHCP). DHCP automatically assigns Internet Protocol (IP) addresses to the computers on your network if your network supports it. If you use DHCP, then you don't have to change your TCP/IP settings if you move your PC to another location, and DHCP doesn't require you to manually configure TCP/IP settings, such as Domain Name System (DNS) and Windows Internet Name Service (WINS).

To enable DHCP or change other TCP/IP settings

Select  Start , then type settings . Select  Settings  >  Network & internet .

Do one of the following:

For a Wi-Fi network, select  Wi-Fi  >  Manage known networks . Choose the network for which you want to change the settings.

For an Ethernet network, select  Ethernet , then select the Ethernet network you’re connected to.

Next to  IP assignment , select  Edit .

Under  Edit network IP settings or Edit IP settings , select  Automatic (DHCP)  or  Manual .

To specify IPv4 settings manually

Under  Edit network IP settings or Edit IP settings , choose  Manual , then turn on  IPv4 .

To specify an IP address, in the  IP address, Subnet mask , and  Gateway  boxes, type the IP address settings.

To specify a DNS server address, in the  Preferred DNS  and  Alternate DNS  boxes, type the addresses of the primary and secondary DNS servers.

To specify if you want to use an encrypted (DNS over HTTPS) or unencrypted connection to the DNS server or servers you specify, for DNS over HTTPS , choose the setting you want:

Off : All DNS queries will be sent to the DNS server unencrypted in plaintext over HTTP.

On (automatic template) : DNS queries will be encrypted and sent to the DNS server over HTTPS. DNS queries will use the default settings for the automatic template or try to discover them automatically.

On (manual template) : DNS queries will be encrypted and sent to the DNS server over HTTPS. They’ll use the settings you enter in the DNS over HTTPS template box.

If you use DNS over HTTPS (automatic or manual template), turn Fallback to plaintext on or off:

When it’s turned on, a DNS query will be sent unencrypted if it can’t be sent over HTTPS.

When it’s turned off, a DNS query won’t be sent if it can’t be sent over HTTPS.

To specify IPv6 settings manually

Under  Edit network IP settings or Edit IP settings , choose  Manual , then turn on  IPv6 .

To specify an IP address, in the  IP address , Subnet prefix length , and  Gateway  boxes, type the IP address settings.

When you select  Automatic (DHCP) , the IP address settings and DNS server address setting are set automatically by your router or other access point (recommended).

When you select  Manual , you can manually set your IP address settings and DNS server address.

When you’re done, select  Save .

Note:  To install IPv4, run Command Prompt as an administrator, type netsh interface ipv4 install , and then press Enter .

Select Start   , then select Settings   > Network & Internet   .

For a Wi-Fi network, select Wi-Fi   > Manage known networks . Choose the network you want to change the settings for, then select Properties.

For an Ethernet network, select Ethernet , then select the Ethernet network you’re connected to.

Under IP assignment , select Edit .

Under Edit IP settings , select Automatic (DHCP) or Manual .

Under Edit IP settings , choose Manual , then turn on IPv4 .

To specify an IP address, in the IP address, Subnet prefix length , and Gateway boxes, type the IP address settings.

To specify a DNS server address, in the Preferred DNS and Alternate DNS boxes, type the addresses of the primary and secondary DNS servers.

Under Edit IP settings , choose Manual , then turn on IPv6 .

When you select Automatic (DHCP) , the IP address settings and DNS server address setting are set automatically by your router or other access point (recommended).

When you select Manual , you can manually set your IP address settings and DNS server address.

When you’re done, select Save .

In Windows 8.1, select the Start button, start typing View network connections , and then select View network connections in the list.

In Windows 7, open Network Connections by selecting the Start button, and then selecting Control Panel . In the search box, type adapter , and then, under Network and Sharing Center , select View network connections .

Right-click the connection that you want to change, and then select Properties . If you're prompted for an administrator password or confirmation, type the password or provide confirmation.

Select the Networking tab. Under This connection uses the following items , select either Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol Version 6 (TCP/IPv6) , and then select Properties .

To specify IPv4 IP address settings, do one of the following:

To get IP settings automatically using DHCP, select Obtain an IP address automatically , and then select OK .

To specify an IP address, select Use the following IP address , and then, in the IP address, Subnet mask , and Default gateway boxes, type the IP address settings.

To specify IPv6 IP address settings, do one of the following:

To get IP settings automatically using DHCP, select Obtain an IPv6 address automatically , and then select OK .

To specify an IP address, select Use the following IPv6 address , and then, in the IPv6 address, Subnet prefix length , and Default gateway boxes, type the IP address settings.

To specify DNS server address settings, do one of the following:

To get a DNS server address automatically using DHCP, select Obtain DNS server address automatically , and then select OK .

To specify a DNS server address, select Use the following DNS server addresses , and then, in the Preferred DNS server and Alternate DNS server boxes, type the addresses of the primary and secondary DNS servers.

To change advanced DNS, WINS, and IP settings, select Advanced .

Facebook

Need more help?

Want more options.

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

how to set static ip address in windows 7 using cmd

Microsoft 365 subscription benefits

how to set static ip address in windows 7 using cmd

Microsoft 365 training

how to set static ip address in windows 7 using cmd

Microsoft security

how to set static ip address in windows 7 using cmd

Accessibility center

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

how to set static ip address in windows 7 using cmd

Ask the Microsoft Community

how to set static ip address in windows 7 using cmd

Microsoft Tech Community

how to set static ip address in windows 7 using cmd

Windows Insiders

Microsoft 365 Insiders

Find solutions to common problems or get help from a support agent.

how to set static ip address in windows 7 using cmd

Online support

Was this information helpful?

Thank you for your feedback.

how to set static ip address in windows 7 using cmd

Show and Configure IPv4 on the Windows cmd Command Prompt with netsh (Set IP Address)

User avatar

Author Henry J F

This file briefly demonstrates the basic IPv4 interface configuration options of the Windows cmd line tool netsh. It demonstrates how to do six tasks: 1. List the system network interfaces with TCP/IPv4 enabled. 2. Show the IPv4 configuration for the interface. 3. Configure the static IP address of the interface. 4. Enable DHCP configuration of the interface. 5. Use the question mark "?" to show the available next options for the command line. 6. Abbreviate commands. The steps of the tutorial are numbered, but they should be used practically in any order. For example, step 2 may be used to verify the results of steps 3 or 4. Also, it might be strange to set a static IP address (step 3) and then immediately enable DHCP (step 4).

Screenshots with sample commands and output are included with each step. Step 7 includes a text-based version of this tutorial.

Start with a cmd command prompt as admin.

7 Steps total

Step 1: list the system network interfaces with tcp/ipv4 enabled..

Step List the system network interfaces with TCP/IPv4 enabled.

Identify the interface Name and Index (Idx) number to change.

netsh interface ipv4 show interfaces

Step 2: Show the IPv4 configuration for a specific interface.

Step Show the IPv4 configuration for a specific interface.

Instead of "Name," it is easier to use the "Idx" index number of the interface. For example, show the configuration of this machine's Wi-Fi interface, index number 25.

netsh interface ipv4 show config name=25

Step 3: Configure the static IP address.

Step Configure the static IP address.

For example, change the IP address on Wi-FI to 10.1.1.101 with a subnet mask of 255.0.0.0 and default gateway of 10.1.1.1.

netsh interface ipv4 set address name=25 source=static address=10.1.1.101 mask=255.0.0.0 gateway=10.1.1.1

Step 4: Enable DHCP configuration of the interface.

Step Enable DHCP configuration of the interface.

For example, set Wi-Fi to use DHCP.

netsh interface ipv4 set address name=25 source=dhcp

Step 5: Use the ? question mark to show the next available options for the command line.

Step Use the ? question mark to show the next available options for the command line.

There are many more settings that may be configured with netsh. For example, use ? to look up how to set DNS server settings.

netsh interface ipv4 set ?

netsh interface ipv4 set dnsservers ?

Step 6: Abbreviate commands.

Step Abbreviate commands.

If multiple options match the abbreviation, then netsh uses the first alphabetical match to the abbreviation. Use caution.

netsh int ipv4 sho int

Step 7: Text-based version

The .txt file attached to this step in Spiceworks contains the same steps along with sample output.

Attachment icon

This tutorial demonstrated how to use the Windows cmd line and netsh to configure IPv4. Many more capabilities are available from netsh. Use the ? to explore. Much more documentation is available from Microsoft and other sources on the Web, including here: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/netsh .

User avatar

Thank you for the private message feedback. Revised: More precise title. Used the How-to page's steps. Captured screen shots and re-captured sample output. Removed the netsh is a shell step. Added steps 5 and 6. Revised text based version with :: comments and sample commands for easy copy and paste to the command prompt. Added link to Microsoft documentation for further reading, but did not include it as a reference because I did not use it to write the How-to.

I hope you like it!

User avatar

Hi thanks for the use full information I have really weird question and kind of problem perfectionist you know how we are so here goes the question (netsh interface ipv4 show interfaces) show me all the interfaces in my case for example:

Índ Mét MTU Estado Nombre --- ---------- ---------- ------------ --------------------------- 11 65 1500 connected Wi-Fi 8 65 1500 disconnected Conexión de red Bluetooth 27 25 1500 disconnected Conexión de área local* 9 1 75 4294967295 connected Loopback Pseudo-Interface 1 10 5 1500 disconnected Ethernet 22 25 1500 disconnected Conexión de área local* 10 29 25 1500 disconnected Conexión de área local* 13 2 35 1500 connected VMware Network Adapter VMnet1 46 25 1500 disconnected Conexión de área local* 14 7 35 1500 connected VMware Network Adapter VMnet8

In case some one give me the answer I have other question I create a hotspot to share my wifi connection to mobile devices first I did it using netsh but then find out that in windows 10 there is a easy option already there to created hotspot but know when I activated the hotspot and check my network adapter I can see the SSID i create but also a 3 at the side like the example above everything is working find I just can get rid off of this and google hole night after resetting network settings, deleting registry profiles and more I'm unable to delete that may be this is really easy and I look like stupid but that's why I ask so I learn if there is a way even if there is not actual issue.Thanks so much for any advice or comment on this.

So sorry for the difficulty Geozagra. I am not sure I follow. I bet if you posted this as a question to the community with some screenshots, then you would get some great help. Let me know, and I will look at it.

User avatar

Excellent write up....I will book mark this one. Thank you Henry for the How-to

User avatar

What do the IDX and the MET actually mean? Thank you.

@rudiaplaga Sorry I missed this a year ago! Try netsh interface ipv4 show int level=verbose

Idx is for index. It's a number that refers to the interface. So, you can refer to the interface by its name or its number. I find it is easier and more consistent to use the Idx number for these commands.

Met stands for metric. It is used to prioritize which interfaces are used. I suppose it must be used to build the routing table. See https://www.windowscentral.com/how-change-priority-order-network-adapters-windows-10 .

how to set static ip address in windows 7 using cmd

Thank you for taking the time to respond. The NETGEAR documentation team uses your feedback to improve our knowledge base content.

Rating Submitted

Do you have a suggestion for improving this article?

Characters Left : 500

NETGEAR logo

MyNETGEAR® Account

Welcome back

Access your NETGEAR

how to set static ip address in windows 7 using cmd

NETGEAR Support

How do I set a static IP address in Windows?

Was this article helpful?    Yes      No | 5 people found this helpful in last 30 days

Most users do not need to set a static IP address. However, advanced users and businesses might benefit from a static IP address.

A static IP address is useful for hosting servers or websites and for sharing large files. For more information about static and dynamic IP addresses, see What is an IP address?

To set a static IP address in Windows 7, 8, and 10:

To set a static IP address on a Macintosh OS X computer, see  Configuring TCP/IP and Proxy Settings on Mac OSX .

Last Updated:03/01/2023 | Article ID: 27476

Was this article helpful?

This article applies to:.

Looking for more about your product?

Get information, documentation, videos and more for your specific product.

Can’t find what you’re looking for?

Quick and easy solutions are available for you in the NETGEAR community.

Need to Contact NETGEAR Support?

With NETGEAR’s round-the-clock premium support, help is just a phone call away.

Complimentary Support

NETGEAR provides complimentary technical support for NETGEAR products for 90 days from the original date of purchase.

NETGEAR Premium Support

Gearhead support for home users.

GearHead Support is a technical support service for NETGEAR devices and all other connected devices in your home. Advanced remote support tools are used to fix issues on any of your devices. The service includes support for the following:

ProSUPPORT Services for Business Users

NETGEAR ProSUPPORT services are available to supplement your technical support and warranty entitlements. NETGEAR offers a variety of ProSUPPORT services that allow you to access NETGEAR's expertise in a way that best meets your needs:

Where to Find Your Model Number

To find the model/version number, check the bottom or back panel of your NETGEAR device.

Select a product or category below for specific instructions.

how to set static ip address in windows 7 using cmd

Nighthawk Routers

how to set static ip address in windows 7 using cmd

Powerline and Wall Plug Extenders

how to set static ip address in windows 7 using cmd

Cable and DSL Modem Routers

how to set static ip address in windows 7 using cmd

ReadyNAS Network Storage

how to set static ip address in windows 7 using cmd

Wireless Access Points

how to set static ip address in windows 7 using cmd

Other Business Products

how to set static ip address in windows 7 using cmd

Mobile Broadband

How To Set Static Ip Address In Windows

Do note that we’re talking about static private IP addresses here, i.e., ones assigned to devices on your local network. This is different from a static public IP, i.e. WAN IP assigned to your router/modem. You’ll need to get the details from your ISP and configure the router for the latter.  Most routers do support DHCP reservation, which uses a device’s MAC Address to assign a static IP to it from within the DHCP scope. But that, again, falls more on the router configuration side of things and will require a tutorial of its own.  In this article, we’ll instead focus on how you can set a static IPv4 address on Windows devices from the live Windows environment. We’ll do this without accessing the router management interface or anything of the sort.

IPv4 Address Classes #

An IP address is basically an identifier, a unique set of numbers assigned to a device to identify it on a network. In the case of IPv4, which is still primarily used instead of IPv6, an IP address is a 32-bit number. As such, IPv4 addresses are divided into four octets (e.g., 192.168.10.7). The first octet, i.e., the first decimal number (192 in the above example), determines the IP class. The table below should help you figure out what class any IP address belongs to and what the default subnet mask for it is. Let’s look at the earlier example once again. We’re dealing with a class C IP address with a subnet mask of 255.255.255.0. This means the first 24 bits, i.e., the first three octets, represent the network part of the IP address (192.168.10). The remaining bits, or the fourth octet, represents the host part (7). This is important because when setting a static IP, you should only configure the host ID. Changing the network ID would mean the device is no longer on the same network. In the above example, you would only change 7 to something else. Class C IP Addresses are most commonly used in small LANs, but let’s also look at a class B case (e.g., 172.16.74.23). Here, the first 16 bits (172.16) represent the network ID, and the remaining bits represent the host ID (74.23). Thus, you can change 74.23 to different values in this scenario.

Things to Know Before Setting Static IP #

We’ve covered how the IP Address class affects which values you can change. With this in mind, here are some other things you should know when setting a Static IP on your Windows device:

You can use the ipconfig command in CMD to check the device’s current IP address, subnet mask, and default gateway. ipconfig /all will give you much more information, including things like DNS. These will be necessary when setting the static IP.The static IP should be set outside the DHCP scope to ensure IP conflicts don’t happen. You can check the DHCP range via the router’s settings page.Additionally, you can ping an IP address to ensure it’s not already in use. For instance, if you ping 192.168.18.23 and get “Destination Host is Unreachable” as the output, it usually means the IP isn’t in use.In some cases, this output can also occur because the firewall is blocking the connection. Thus, it’s better to use the arp -a command. You can use a static IP as long as it’s not on this list.

How to Set Static IP in Windows? #

The Network Control Panel applet is very intuitive, and it’s most commonly used to change IP configurations in Windows, so we’ll start with that. Ultimately, the other methods also lead to the same result, so you’re free to use your preferred method.

Through Control Panel #

Here are the steps to set a static IP on Windows via the Control Panel:

Through Settings #

As stated, you can also set a static IP via Windows settings. Here are the necessary steps for this:

Through Command Prompt #

As usual, the command prompt allows you to assign a static IP efficiently through the netsh tool. Here are the necessary steps to use it:

Through PowerShell #

Netsh is a legacy tool. If you want a newer alternative, you can also use Powershell’s NetTCPIP module to set a static IP. Here are the necessary steps for this method:

Windows Server 2012 Training, Citrix Training, VMWare Training

ITIngredients

Add Spice To Technology

ChangeIPAddressFromCommandPrompt

How to change IP Address from command prompt

How to change ip address from command prompt.

In this post we’ll learn the steps to assign an IP address to Windows Server 2012 R2 from command prompt. We’ll use Netsh command to change an IP. IP (Internet Protocol) is an identify of your Computer. It is required for computers to communicate with teach other. There are multiple ways to change the IP address, in addition to that you can either assign static IP address to your Computer or Dynamic IP address to your Computer. DHCP Server is required if you want Dynamic IP Address to be assigned to your Server.

1. Right click on start and select the command prompt (admin).

ChangeIPAddressFromCommandPrompt

2. On User Account Control window click on “Yes” to open command prompt.

ChangeIPAddressFromCommandPrompt

3. Type command “ ipconfig ” to check an IP address of your computer. This shows an APIPA IP address . APIPA is “ Automatic Private IP Addressing “, this concludes that our computer is not able to communicate with DHCP Server as currently we don’t have any DHCP in our environment.

ChangeIPAddressFromCommandPrompt

4. To assign an IP to our computer type “ Netsh “. It will show “ netsh> ” console. Then type “ Interface   IP ” this will change the console to “ netsh interface ipv4 “.

ChangeIPAddressFromCommandPrompt

5. Type the command “ set address “Ethernet0” static 192.168.1.10 255.255.255.0 192.168.1.1 “. In this command “Ethernet0” is the name of our Ethernet Adapter. As we are assigning static IP address therefore we need to mention an IP address and a subnet mask. 192.168.1.10 is an IP address that we want to assign and 255.255.255.0 is a subnet mask. In addition to IP we are also assigning Gateway to this computer after subnet mask we can define the gateway which is 192.168.1.1 in this example.

ChangeIPAddressFromCommandPrompt

6. Moreover we need to define DNS information. Type a command “ set dnsservers “Ethernet0” static 192.168.1.10 primary ” to define the primary DNS. Here, “Ethernet0” is the name of our network adapter and 192.168.1.10 is the IP of DNS.

ChangeIPAddressFromCommandPrompt

7. Type “ Exit ” to exit from netsh interface ipv4 console.

ChangeIPAddressFromCommandPrompt

8. Type “ ipconfig /all ” to verify that static IP address, subnet mask, default gateway and DNS server IP is assigned.

ChangeIPAddressFromCommandPrompt

If you are not fond of commands then you can change IP address from GUI .

Related articles:

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Script to change ip address on windows

I use my computer to communicate with a piece of hardware via ethernet. To communicate with this device I set my ip to 192 168 0 11, subnet mask to 255 255 255 0, and default gateway to 192 168 0 1 for IPv4. To use the internet, I choose "Obtain an IP address automatically" via control panel.

I'd like to have a script that allows my to quickly choose one or the other ethernet setting - hardware or internet.

I program mostly in python but maybe there is a batch file solution.

Baz's user avatar

5 Answers 5

You can use the Python WMI module to do this (install the PyWin32 extensions and the WMI module before running these scripts). Here is how to configure things to talk to the hardware device:

Here is how to revert to obtaining an IP address automatically (via DHCP):

Note: in a production script you should check the values returned by EnableStatic() , SetGateways() and EnableDHCP() . ('0' means success, '1' means reboot required and other values are described on the MSDN pages linked to by the method names. Note: for EnableStatic() and SetGateways(), the error codes are returned as lists).

Full information on all the functionality of the Win32NetworkAdapterConfiguration class can also be found on MSDN .

Note: I tested this with Python 2.7, but as PyWIn32 and WMI modules are available for Python 3, I believe you should be able to get this working for Python 3 by removing the "u" from before the string literals.

msanders's user avatar

You can use the subprocess module to start

Start this from the commandline (without[params]) to get some help how to use it. Then you can do

For those who's too busy to rtfm,

here lan is the name of the network interface to configure, 192.168.0.100 is ip address, 255.255.255.0 is network mask. The first command sets static address, the second reverts to dhcp.

Antony Hatchkins's user avatar

Actually very simple to do (windows only) (uses preinstalled libraries only):

mayank1234r56's user avatar

#again back to normal

akash pawar's user avatar

You can use vbscript to change IP Address,

Tester's user avatar

Your Answer

Sign up or log in, post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged python windows windows-7 batch-file ipv4 or ask your own question .

Hot Network Questions

how to set static ip address in windows 7 using cmd

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

How to configure a static IP on Windows 10 or 11

Do you need to switch from a dynamic to a static IP address configuration on Windows 11 or 10? Here's how.

Windows 11 static IP

On Windows, the router's Dynamic Host Configuration Protocol (DHCP) server is (usually) responsible for assigning a dynamic Transmission Control Protocol/Internet Protocol (TCP/IP) configuration to every device in the network, including to your computer running Windows 11 or Windows 10.

Although a dynamic IP address is the recommended configuration for most situations, you may need to change to a static IP address if you're thinking about setting up a printer or file sharing, or you have to configure port forwarding on the router to your computer.

The reason is that a dynamic network configuration can change at any time after the lease from the DHCP expires and if the address changes, network resources you may have configured will stop working. Setting a static IP address will always stay the same on the computer, allowing a more reliable experience sharing resources in the network or forwarding ports.

Whatever the reason, on Windows 10 and 11, you have many ways to configure a static TCP/IP address, including using the Settings app and Command Prompt.

This guide will walk you through the different ways to configure a static network configuration on Windows 11 and 10.

How to set a static TCP/IP network configuration on Windows 11

On Windows 11, you can change your computer's dynamic IP configuration to static in at least two ways through the Settings app or commands.

Configure IP from Settings app

To assign a permanent TCP/IP configuration on Windows 11, use these steps:

Once you complete the steps, the computer will start using the static network configuration. If everything has been configured correctly, you should be able to open the web browser to access the internet.

If you entered an address (such as the DNS address) and then changed it, you probably won't be able to save the settings. If this is the case, cancel the configuration, start over, enter the correct configuration, and then try to save the settings.

Configure IP from Command Prompt

To set a static TCP/IP configuration on Windows 11, use these steps:

In the above command, replace  ADAPTER-NAME  with the name of your network adapter. Change  IP-ADDRESS SUBNET-ADDRESS    DEFAULT-GATEWAY-ADDRESS  with the device IP address, subnet mask, and default gateway addresses you want. For example, this command sets the 10.1.4.90, 255.255.255.0, 10.1.4.1 configuration:  netsh interface ip set address name="Ethernet 10Gb" static 10.1.4.90 255.255.255.0 10.1.4.1

In the command, change  ADAPTER-NAME  with your adapter's name and  DNS-ADDRESS  with the DNS server address of the network. For example, this command sets the local router as the DNS server:  netsh interface ip set dns name="Ethernet 10Gb" static 10.1.4.1

In the command, change  ADAPTER-NAME  with the adapter's name and  DNS-ADDRESS  with an alternate DNS server address. For example, netsh interface ip add dns name="Ethernet 10Gb" 1.1.1.1 index=2

After you complete the steps, the commands will set a static network configuration on Windows 11.

How to set a static TCP/IP network configuration on Windows 10

On Windows 10, you can also use the Settings app and Command Prompt to set up a static IP network configuration.

To assign a permanent TCP/IP configuration on Windows 10, use these steps:

Once you complete the steps, Windows 10 will start using the static IP configuration. If you lose network connectivity, restart the computer to regain access to the local network and internet.

To change from dynamic to static IP address with commands on Windows 10, use these steps:

In the command, change  ADAPTER-NAME  with your adapter's name and  DNS-ADDRESS  with the DNS server address of the network. For example, this command sets the local router as the DNS server:  netsh interface ip set dns name=" Ethernet 10Gb" static 10.1.4.1

In the command, change  ADAPTER-NAME  with the adapter's name and  DNS-ADDRESS  with an alternate DNS server address. For example, netsh interface ip add dns name="Ethernet0" 1.1.1.1 index=2

After you complete the steps, the network configuration will switch from dynamic to static on Windows 10.

Windows Central Newsletter

Get the best of Windows Central in your inbox, every day!

Mauro Huculak is technical writer for WindowsCentral.com. His primary focus is to write comprehensive how-tos to help users get the most out of Windows 10 and its many related technologies. He has an IT background with professional certifications from Microsoft, Cisco, and CompTIA, and he's a recognized member of the Microsoft MVP community.

Thank you for signing up to Windows Central. You will receive a verification email shortly.

There was a problem. Please refresh the page and try again.

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

How to change the IP address of a network adapter

This article provides some information about how to change the IP address of a network adapter.

Applies to:   Windows Server 2012 R2 Original KB number:   323444

This article describes how to change the Internet Protocol (IP) address that is assigned to a network adapter. An IP address may be assigned automatically if your network has a Dynamic Host Configuration Protocol (DHCP) server, or you can specify an IP address.

How to change the IP address assigned to a Network Adapter

How to automatically obtain an IP Address

Follow these steps to configure the computer to obtain an IP address from a DHCP server. You must have a DHCP server.

Click Obtain an IP address automatically .

Click Obtain DNS server address automatically if you do not want to specify the IP address of the Domain Name System (DNS) server.

Click Start, and then click Run.

In the Open box, type cmd, and then click OK.

At the command prompt, type ipconfig /release, and then press ENTER.

Type ipconfig /renew, and then press ENTER.

The network adapter is assigned an IP address by the DHCP server, and a message similar to the following appears:

Type exit, and then press ENTER to quit the command prompt.

How to Specify an IP Address

To assign an IP address to the network adapter, follow these steps:

Troubleshooting

There is an IP address conflict: If you try to assign an IP address that is already in use, you receive the following error message:

The static IP address that was just configured is already in use on the network. Please reconfigure a different IP address.

In this case, assign an unused IP address to the network adapter.

Your computer cannot connect to other computers on the network: If you assign an incorrect subnet mask address to the network adapter, the computer is effectively located on a different network. You cannot connect to other computers on the network.

Your computer cannot connect to other computers by using host names: If you assign an incorrect DNS server IP address, or if you do not use a DNS server, you cannot connect to computers by using their host names. It prevents you from browsing the Internet. You can connect to other computers by using their IP addresses.

To work around this issue in a local network, add host-name-to-IP-address mappings in a Hosts file.

Was this page helpful?

Additional resources

How to change from static to dynamic IP address on Windows 10

Are you using a static IP address? Here are four ways to switch to a dynamic configuration on Windows 10.

Avatar for Mauro Huc

On Windows 10, you can configure a network adapter to use a static IP address manually, or you can use an automatically assigned configuration using the local Dynamic Host Configuration Protocol (DHCP) server.

Although using a static IP address is recommended for devices that provide services to network users, as its configuration never changes, it may come a time when you may no longer need this configuration, and a dynamically assigned network configuration will be more suited.

If you use a static IP address and need to switch to a dynamic configuration, it’s possible to perform this task in several ways, including using the Settings app, Control Panel, Command Prompt, and even PowerShell.

In this guide , you’ll learn the steps to remove a static IP address configuration to obtain a dynamic configuration from the DHCP server on Windows 10 .

Change to dynamic IP address (DHCP) from Settings

Change to dynamic ip address (dhcp) from command prompt, change to dynamic ip address (dhcp) from powershell, change to dynamic ip address (dhcp) from control panel.

To enable DHCP to obtain a TCP/IP configuration automatically on Windows 10, use these steps:

Open Settings on Windows 10.

Click on Network & Internet .

Click on Ethernet or Wi-Fi .

Click the network connection.

Under the “IP settings” section, click the Edit button.

Edit IP settings on Windows 10

Use the Edit IP settings drop-down menu and select the Automatic (DHCP) option.

Enable automatic (DHCP) IP address using Settings app

Click the Save button.

Once you complete the steps, the networking stack configuration will reset, and your device will request an IP address from the DHCP server (usually your router).

To switch from a static TCP/IP configuration to a dynamically assigned configuration using DHCP with Command Prompt, use these steps:

Open Start .

Search for Command Prompt , right-click the top result, and select the Run as administrator option.

Type the following command to note the name of the network adapter and press Enter

Network adapter name using Command Prompt

Type the following command to configure the network adapter to obtain its TCP/IP configuration using DHCP and press Enter :

In the command, make sure to change “Ethernet1” for the adapter’s name that you want to configure.

Enable DHCP on Windows 10 using Command Prompt

After completing the steps, the network adapter will stop using a static IP address, and it’ll obtain a configuration automatically from the DHCP server.

To remove a static IP and DNS addresses to use a dynamic configuration using PowerShell, use these steps:

Search for PowerShell , right-click the top result, and select the Run as administrator option.

Type the following command to note the “InterfaceIndex” number for the network adapter and press Enter :

Network interface information using PowerShell

Type the following command to enable the network adapter to obtain its TCP/IP configuration using DHCP and press Enter :

In the command, make sure to change “Ethernet0” for the adapter’s name that you want to configure.

Type the following command to enable the network adapter to obtain its DNS configuration using DHCP and press Enter :

In the command, change “3” for the InterfaceIndex for the adapter to configure.

Enable DHCP for dynamic IP assignment using PowerShell

Once you complete the steps, the IP and DNS addresses will be reset from the adapter, and your computer will receive a new dynamic configuration from DHCP.

To configure a network adapter to use a dynamic IP address using Control Panel, use these steps:

Open Control Panel .

Click on Network and Internet .

Click on Network and Sharing Center .

On the left pane, click the “Change adapter settings” option.

Network and Sharing Center in Control Panel

Right-click the network adapter and select the  Properties option.

Select the “Internet Protocol Version 4 (TCP/IPv4)” option.

Click the Properties button.

Ethernet1 Properties on Windows 10

Select the “Obtain an IP address automatically” option.

Select the “Obtain the following DNS server address automatically” option.

Enable dynamic IP address (DHCP) using Control Panel

Click the OK button.

After completing the steps, the statically assigned TCP/IP configuration will no longer be available, and the computer will automatically request a dynamic network configuration from the network.

We hate spam as much as you! Unsubscribe any time Powered by follow.it ( Privacy ), our Privacy .

HelloTech How

How to Set a Static IP Address for a Windows 10 PC

There are many reasons why you might want to set a static IP address for your Windows 10 PC. In most cases, your router will assign your computer a dynamic IP address, meaning it changes from time to time. This can make it hard to access your computer remotely, use certain programs, and let other users on your network send you files. Here’s how to set a static IP address on your Windows 10 PC.  

Windows search ip address

network connections wifi status

How to Set a Static IP Address for a Windows 10 PC

Once you set your Windows 10 PC to a static IP address, check out our step-by-step guide on how to port forward , so you can remotely access your computer from anywhere in the world.

Google Nest WiFi Router and 2 Points

HelloTech editors choose the products and services we write about. When you buy through our links, we may earn a commission.

Was this article helpful?

Related articles.

Need to chat with an expert?

Can't find the answer you're looking for? Don't worry, we're here to help.

Techs

Save $5 on any product or service!

modal-img

Subscribe to our newsletter and receive a promo code to save $5 on your next product purchase or service.

Enter your email address below to receive your promo code and stay up to date on the latest tech news and updates.

  Windows OS Hub / PowerShell / Configuring Network Adapter Settings with PowerShell: IP Address, DNS, Default Gateway, Static Routes

Configuring Network Adapter Settings with PowerShell: IP Address, DNS, Default Gateway, Static Routes

Previously, the netsh interface ipv4 command was used to configure Windows network settings from the CLI. In PowerShell 3.0 and newer, you can use the built-in PowerShell NetTCPIP module to manage Windows network settings.

To get the list of cmdlets in this module, run the following command:

get-command -module NetTCPIP

Managing WIndows Network Settings with PowerShell NetTCPIP module

Managing Network Adapters with PowerShell

How to view tcp/ip network adapter settings with powershell, using powershell to set static ip address, set-dnsclientserveraddress: set primary and secondary dns server addresses, how to change static ip address to dhcp using powershell, how to remotely change ip address and dns settings with powershell.

Get-NetAdapter

The cmdlet returns the interface name, its state (Up/Down), MAC address and port speed.

In this example, I have multiple network adapters on my computer (besides the physical connection, Ethernet0 , I have some Hyper-V and VMWare Player network interfaces).

Get-NetAdapter - list connected network adapters

You can refer network interfaces by their names or indexes (the Index column). In our example, to select the physical LAN adapter Intel 82574L, use the command:

Get-NetAdapter -Name "Ethernet0"

Get-NetAdapter -InterfaceIndex 8

powershell Get-NetAdapter select NIC by name

You can change the adapter name:

Rename-NetAdapter -Name Ethernet0 -NewName LAN

To disable a network interface, use this command:

Get-NetAdapter -InterfaceIndex 13| Disable-NetAdapter

Enable-NetAdapter -InterfaceDescription “Hyper-V Virtual Ethernet Adapter"

Using PowerShell to disable a network adapter

If a VLAN is specified for an adapter, you can display it as follows:

Get-NetAdapter | ft Name, Status, Linkspeed, VlanID

Here is how you can get the information about the network adapter driver used:

Get-NetAdapter | ft Name, DriverName, DriverVersion, DriverInformation, DriverFileName

list network adapter used drivers

The information about physical network adapters (PCI slot, bus, etc.):

Get-NetAdapterHardwareInfo

To get current network adapter settings (IP address, DNS, default gateway):

Get-NetIPConfiguration -InterfaceAlias Ethernet0

Get-NetIPConfiguration - Retrieve the IP configuration on WIndows via PowerShell

To display a detailed information about current network adapter TCP/IP configuration, use this command: Get-NetIPConfiguration -InterfaceAlias Ethernet0 -Detailed

In this case, the assigned network profile (NetProfile.NetworkCategory) of the interface, MTU settings (NetIPv4Interface.NlMTU), whether obtaining an IP address from DHCP is enabled  (NetIPv4Interface.DHCP) and other useful information are displayed.

Get-NetIPConfiguration detailed info

To get the interface IPv4 address only:

(Get-NetAdapter -Name ethernet0 | Get-NetIPAddress).IPv4Address

Let’s try to set a static IP address for the NIC. To change an IP address, a subnet mask and default gateway for a network interface use:

New-NetIPAddress –IPAddress 192.168.2.50 -DefaultGateway 192.168.2.1 -PrefixLength 24 -InterfaceIndex 8

You can set an IP address using an array structure (more visually):

$ipParams = @{ InterfaceIndex = 8 IPAddress = "192.168.2.50" PrefixLength = 24 AddressFamily = "IPv4" } New-NetIPAddress @ipParams

If the static IP address has already been configured and you want to change it, the Set-NetIPAddress cmdlet is used:

Set-NetIPAddress -InterfaceIndex 8 -IPAddress 192.168.2.90

To disable obtaining an IP address from DHCP for your adapter, run the command:

Set-NetIPInterface -InterfaceAlias Ethernet0 -Dhcp Disabled

To view the routing table, the Get-NetRoute cmdlet is used. To add a new route, use the New-NetRoute cmdlet:

New-NetRoute -DestinationPrefix "0.0.0.0/0" -NextHop "192.168.2.2" -InterfaceIndex 8

To disable the IPv6 protocol for the network adapter:

Get-NetAdapterBinding -InterfaceAlias Ethernet0 | Set-NetAdapterBinding -Enabled:$false -ComponentID ms_tcpip6

In order to set the primary and secondary DNS server IP addresses in Windows, use the Set-DNSClientServerAddress cmdlet. For example:

Set-DNSClientServerAddress –InterfaceIndex 8 –ServerAddresses 192.168.2.11,10.1.2.11

You can also set nameservers using an array:

$dnsParams = @{ InterfaceIndex = 8 ServerAddresses = ("8.8.8.8","8.8.4.4") } Set-DnsClientServerAddress @dnsParams

After changing your DNS settings, you can clear the resolver cache:

Clear-DnsClientCache

To allow the computer to obtain a dynamic IP address from the DHCP server for the network adapter, run this command:

Set-NetIPInterface -InterfaceAlias Ethernet0 -Dhcp Enabled

Clear the DNS server settings:

Set-DnsClientServerAddress –InterfaceIndex 8 -ResetServerAddresses

And restart your adapter in order to obtain an IP address automatically from the DHCP server:

Restart-NetAdapter -InterfaceAlias Ethernet0

If you previously had a default gateway configured, remove it:

Set-NetIPInterface -InterfaceAlias Ethernet0| Remove-NetRoute -Confirm:$false

You can use PowerShell to remotely change IP address or DNS server settings on multiple remote computers. Suppose, your task is to change DNS settings for all servers in the specific AD container (Organizational Unit). To get the list of computers in the script below, the  Get-ADComputer cmdlet is used, and WinRM is used to connect to computers remotely ( the Invoke-Command cmdlet ):

$Servers = Get-ADComputer -SearchBase ‘OU=Servers,OU=Berlin,OU=DE,DC=woshub,DC=cpm’ -Filter '(OperatingSystem -like "Windows Server*")' | Sort-Object Name ForEach ($Server in $Servers) { Write-Host "Server $($Server.Name)" Invoke-Command -ComputerName $Server.Name -ScriptBlock { $NewDnsServerSearchOrder = "192.168.2.11","8.8.8.8" $Adapters = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.DHCPEnabled -ne 'True' -and $_.DNSServerSearchOrder -ne $null} Write-Host "Old DNS settings: " $Adapters | ForEach-Object {$_.DNSServerSearchOrder} $Adapters | ForEach-Object {$_.SetDNSServerSearchOrder($NewDnsServerSearchOrder)} | Out-Null $Adapters = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.DHCPEnabled -ne 'True' -and $_.DNSServerSearchOrder -ne $null} Write-Host "New DNS settings: " $Adapters | ForEach-Object {$_.DNSServerSearchOrder} } }

How to Allow Non-Admin Users to Start/Stop Windows Service?

Ubuntu/mint/kali boots to initramfs prompt in busybox, related reading, copy/paste not working in remote desktop (rdp) clipboard, how to disable ntlm authentication in windows domain, group policy management in active directory, security tab missing from file/folder properties in windows, export-csv: output data to csv file using powershell.

' src=

Lovely like always! many thanks

' src=

Thanks for the great info. Would you happen to know a way to get the IP from the PC and then set the internet proxy using the 2nd octet from the IP address? So I have multiple schools and each has a proxy server, so I want to be able to set the proxy based on where that PC is. Location 1 gives PC IP address of 100.55.50.100, Proxy at this location is 100.55.100.1:9090 Location 2 gives PC IP address of 100.60.50.26, Proxy at this location is 100.60.100.1:9090 The second octet is what changes between locations for both proxy address and IP schema. I am trying to do a script at login for the user, so that if the device moves locations, it will not need to have the proxy manually re-entered to get back on the internet.

' src=

I think it will be easier for you to configure the Web Proxy Automatic Detection (WPAD) protocol or Proxy Auto-Configuration (PAC) file to automatically configure proxy setting on client computers.

' src=

Double thumbs up, well done.

' src=

Any Idea how to modify the Connection specific DNS suffix for a network adapter via powershell if possible?

' src=

Wow, amazing work! Was wondering if you know a way to set a static ip for a network adapter without it disconnecting UDP/TCP connections?

Leave a Comment Cancel Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Current [email protected] *

Leave this field empty

site logo

Change IP Address and DNS Servers using the Command Prompt

Just because it's more fun

Author avatar

The Command Prompt application, sometimes referred to as command shell, is found in most Windows NT-based operating systems. Its purpose is to execute specific commands for troubleshooting or solving specific Windows issues, performing advanced administrative functions, and automating tasks via batch files and scripts.

That said, you can also use it to change your IP address when you want to spoof it 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 reasons or to make surfing more secure and faster.

how to set static ip address in windows 7 using cmd

In this guide, we’re going to show you how to change your IP address and DNS servers using the Command Prompt in Windows 10.

How To Change IP Address Using Command Prompt

An IP address holds information about your device, location, your internet service provider (ISP), and browser information.

Changing it is useful when you have a malfunctioning router that’s providing addresses used by a different computer on the network or an invalid address is accidentally configured.  It’s also helpful when you want to install a new router and reconfigure your home network to use the default IP address range.

how to set static ip address in windows 7 using cmd

The first step to changing your IP address is to find the network name for the interface you want to change. 

how to set static ip address in windows 7 using cmd

how to set static ip address in windows 7 using cmd

In our case, we’ll be modifying the WiFi interface, but you can pick the correct interface for your case. Make note of the interface name.  

In our example, this command would look like this: netsh interface ipv4 set address name=”Wi-Fi” static 192.168.0.173 255.255.255.0 192.168.0.0

how to set static ip address in windows 7 using cmd

This command will use the Wi-Fi 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” source=dhcp command.

How To Change DNS Servers Using Command Prompt

 A DNS server holds public IP addresses and related hostnames in a database, and is used to resolve or translate the hostnames to IP addresses. The server does this by running special software to communicate with other servers through special protocols based on certain requests from the computer. 

The conversion process is thoroughly vetted and verified, and it happens quickly behind the scenes so as to obtain information corresponding to the server that the computer is looking for, and then tells the original connecting computer where to go so that it can connect to that server.  

how to set static ip address in windows 7 using cmd

There are several reasons why you’d want to change your default DNS server , but the main ones are:

Note : You can change DNS servers individually for your home network on your router or on computers, smartphone, and Chromebook, among other devices

How To Change DNS Servers With Command Prompt

Follow the steps below to learn how to change DNS servers using Command Prompt.

how to set static ip address in windows 7 using cmd

how to set static ip address in windows 7 using cmd

how to set static ip address in windows 7 using cmd

From our example above, we changed the IP address for the “Wi-Fi” interface, so we’ll use the same example to change DNS servers. 

For purposes of this guide, we’ll use Google’s primary public DNS server, 8.8.8.8. The command will look something like this: netsh interface ipv4 set dns name=”Wi-Fi” static 8.8.8.8

how to set static ip address in windows 7 using cmd

how to set static ip address in windows 7 using cmd

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 pick DNS settings from a DHCP server. Continuing with our example, this command would look like this: netsh interface ipv4 set dnsservers name”Wi-Fi” source=dhcp

Command Prompt is a great tool to use when you want to change IP addresses and DNS servers. It’s faster and saves you the hassle of having to click through several windows and dialog boxes from the Control Panel interface just to get to the IPv4 Properties dialog box to do the same thing. 

Was this guide helpful? Let us know by dropping your comment in the section below.

how to set static ip address in windows 7 using cmd

Elsie is a technology writer and editor with a special focus on Windows, Android and iOS. She writes about software, electronics and other tech subjects, her ultimate goal being to help people out with useful solutions to their daily tech issues in a simple, straightforward and unbiased style. She has a BCom degree in Marketing and currently pursuing her Masters in Communications and New Media. Read Elsie's Full Bio

Read More Posts:

how to set static ip address in windows 7 using cmd

Subscribe to Help Desk Geek.

Join 30,000+ others who get daily tips, tricks and shortcuts delivered straight to their inbox. 

Thanks for subscribing!

We will never spam you, unsubscribe at any time.

IMAGES

  1. seller Vague Stern set a static ip windows 10 Guinness fist File

    how to set static ip address in windows 7 using cmd

  2. how to Set Static IP address in windows 7

    how to set static ip address in windows 7 using cmd

  3. How to Set Up a Static IP Address

    how to set static ip address in windows 7 using cmd

  4. How (and why) to set a static IP address in Windows 10

    how to set static ip address in windows 7 using cmd

  5. How to set a static IP address in Windows

    how to set static ip address in windows 7 using cmd

  6. How to Set a Static IP Address on Windows 10

    how to set static ip address in windows 7 using cmd

VIDEO

  1. how to find ip address on windows 10 using command prompt , Control Panel, and Windows Settings

  2. How to configure a static IP address in Windows 10

  3. Find IP address Use Command Prompt (CMD) || Find IP address Without Internet in PC Windows 10 ||

  4. Set IP address manually in Windows PC

  5. How to Configure Your Computer with a static IP Address in Windows Server 2022

  6. how to set static ip

COMMENTS

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

    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. 192.168.3.1

  2. How to Assign a Static IP Address in Windows 10 or 11

    To change the computer's IP address in Windows 7, you'll need to open the "Network Connections" window. Hit Windows+R, type "ncpa.cpl" into the Run box, and then hit Enter. In the "Network Connections" window, right-click the adapter for which you want to set a static IP address, and then select the "Properties" command.

  3. How to set static ip address in windows 7?

    Best answer for this question, how do I set a static IP address in Windows 7 using CMD? Hit Windows+R, type "ncpa. cpl" into the Run box, and then hit Enter. In the "Network Connections" window, right-click the adapter for which you want to set a static IP address, and then select the "Properties" command.

  4. Static IP Configuration

    IP Address and Hostname Management Step 1 Click the Start menu. Next, click on the Control Panel option. Step 2 Click on the Network and Sharing Center option. Step 3 Click on Change adapter settings from the left side menu. Step 4 Right-click on the Local Area Connection icon, then select Properties. Step 5

  5. Configure IP Address and DNS from Command Line

    A static IP address can be set from the command prompt by running the netsh command at an administrative level prompt. Make sure to substitute the parameters in the command below for your environment. netsh interface ip set address name="Local Area Connection" static 123.123.123.123 255.255.255. 123.123.123.1 1

  6. How To Set Static IP Address in Windows 10 using CMD

    netsh interface ip set dns name="Ethernet" static 192.168.1.2 Step 5: Then type the following command to set another DNS server address and press Enter. Again, be sure to change Ethernet to the name of your network adapter and 8.8.8.8 (Google DNS) to another DNS server address (if desired). netsh interface ip add dns name="Ethernet" 8.8.8.8 index=2

  7. Configure Static IP with the Netsh Command-Line Utility

    The IP address order: client IP, subnet mask, and gateway IP. Here's how to configure the DNS addresses: netsh interface ip add dns "connection name" 208.67.222.222 netsh interface ip add dns "connection name" 208.67.220.220 index=2 NOTE: Remember to replace the connection names and IP addresses. Read Next

  8. Setting a Static IP Address in Windows 7

    Setting up a static ip for Windows 7. If you have a printer, before you begin print out this page! Step 1: Open up the start menu, and look for the Search programs and files box. You should now see the following window. Step 2: Type cmd in the Search programs and files box, and press Enter on your keyboard.

  9. Assign a static IP address using PowerShell

    From the properties, you can note down the interface index value. then you can use the below command to set the IP address. If you are setting the IP address first time the use command as. New-NetIPAddress -IPAddress 192.168.10.100 -PrefixLength 24 -DefaultGateway 192.168.10.1 -InterfaceIndex 4 To modify the existing static IP address use below ...

  10. Change TCP/IP settings

    To enable DHCP or change other TCP/IP settings. Select Start, then type settings. Select Settings > Network & internet. Do one of the following: For a Wi-Fi network, select Wi-Fi > Manage known networks. Choose the network for which you want to change the settings. For an Ethernet network, select Ethernet, then select the Ethernet network you ...

  11. Show and Configure IPv4 on the Windows cmd Command Prompt ...

    For example, step 2 may be used to verify the results of steps 3 or 4. Also, it might be strange to set a static IP address (step 3) and then immediately enable DHCP (step 4). Screenshots with sample commands and output are included with each step. Step 7 includes a text-based version of this tutorial. Start with a cmd command prompt as admin.

  12. How do I set a static IP address in Windows?

    Click Change adapter settings. Right-click on Wi-Fi or Local Area Connection. Click Properties. Select Internet Protocol Version 4 (TCP/IPv4). Click Properties . Select Use the following IP address. Enter the IP address, Subnet mask, Default gateway, and DNS server. Click OK. Your computer displays a static IP address.

  13. How To Set Static Ip Address In Windows

    Do note that we're talking about static private IP addresses here, i.e., ones assigned to devices on your local network. This is different from a static public IP, i.e. WAN IP assigned to your router/modem. You'll need to get the details from your ISP and configure the router for the latter. Most routers do support DHCP reservation, which uses a device's MAC Address to assign a static IP ...

  14. How to change IP Address from Command Prompt

    1. Right click on start and select the command prompt (admin). 2. On User Account Control window click on "Yes" to open command prompt. 3. Type command " ipconfig " to check an IP address of your computer. This shows an APIPA IP address.

  15. How to set static IP address on Windows 10

    Type the following command to set a static IP address and press Enter: New-NetIPAddress -InterfaceIndex 5 -IPAddress 10.1.4.220 -PrefixLength 24 -DefaultGateway 10.1.4.1 In the command, replace the InterfaceIndex number (5) with the corresponding number of your adapter. Change IPAddress with the static IP address you want to assign to your device.

  16. Script to change ip address on windows

    Here is how to revert to obtaining an IP address automatically (via DHCP): import wmi # Obtain network adaptors configurations nic_configs = wmi.WMI ().Win32_NetworkAdapterConfiguration (IPEnabled=True) # First network adaptor nic = nic_configs [0] # Enable DHCP nic.EnableDHCP () Note: in a production script you should check the values returned ...

  17. How to configure a static IP on Windows 10 or 11

    To change from dynamic to static IP address with commands on Windows 10, use these steps: Open Start. Search for Command Prompt, right-click the top result, and select the Run as administrator ...

  18. Change IP address of a network adapter

    Click Start, and then click Run. In the Open box, type cmd, and then click OK. At the command prompt, type ipconfig /release, and then press ENTER. Type ipconfig /renew, and then press ENTER. The network adapter is assigned an IP address by the DHCP server, and a message similar to the following appears: Output.

  19. How to configure a static ip address in windows PE (for windows 7)

    Replied on February 4, 2010. Report abuse. Probably the same way as in Windows 7: Control Panel / Network connections / Network adapter / Properties. If you need a more detailed explanation then it would be better to post your question in a Windows PE forum. 7 people found this reply helpful. ·.

  20. How to change from static to dynamic IP address on Windows 10

    Change to dynamic IP address (DHCP) from Command Prompt To switch from a static TCP/IP configuration to a dynamically assigned configuration using DHCP with Command Prompt, use these steps: Open Start. Search for Command Prompt, right-click the top result, and select the Run as administrator option.

  21. How to Set a Static IP Address for a Windows 10 PC

    Here's how to set a static IP address on your Windows 10 PC. Click the magnifying glass icon in the bottom-left corner of your screen. Then type IP Address into the search bar and click Open. You can also hit Enter on your keyboard if you see Ethernet settings. Then click Change adapter options.

  22. Configuring Network Adapter Settings with PowerShell: IP Address, DNS

    Using PowerShell to Set Static IP Address. Let's try to set a static IP address for the NIC. To change an IP address, a subnet mask and default gateway for a network interface use: New-NetIPAddress -IPAddress 192.168.2.50 -DefaultGateway 192.168.2.1 -PrefixLength 24 -InterfaceIndex 8. You can set an IP address using an array structure (more ...

  23. Change IP Address and DNS Servers using the Command Prompt

    Follow the steps below to learn how to change DNS servers using Command Prompt. Open an elevated Command Prompt by typing CMD in the search bar, and clicking Run as Administrator. Type netsh and press Enter. Next, type interface ip show config and press Enter. Find the network interface whose DNS server you want to change, and enter the netsh ...