June 16, 2024

How to Set a Static IP Address on Windows

A dynamic IP address is the recommended configuration for most Windows PC users. However, a static IP address is required when a computer provides a service for other PCs. This tutorial walks you through how to quickly set a static IP address on your computer.

Good to know: check out how to find the IP address of a network printer.

Why Do You Need a Static IP Address

A static IP address could be useful in various cases, including:

  • Hosting: if you’re hosting a website, having a dynamic IP address can be a hassle. It’s best to have a static IP address to avoid the need to manually change the router settings every time the computer gets a new IP address.
  • File server: is your computer configured as an FTP or a web server? It is highly recommended to use a static IP address, as your device can be easily accessed by others to download files.
  • Remote access: if you plan on accessing your Windows PC remotely, having a static IP address can provide faster and more reliable access. In contrast, dynamic IP addresses are constantly changing and can create difficulties connecting with remote devices.

1. Set Static IP Address Using Settings

You don’t need to be a pro user to set a static IP address, as you can do that easily with the Settings app on your Windows computer.

  1. Click the Start menu, and launch the Settings app.
  1. Click “Network & Internet” in the left pane. Click “Properties” next to your Wi-Fi network on the right.
Clicking "Network & internet" on the left pane and click Properties on the right pane.
  1. Scroll down and click the “Edit” button next to “IP assignment.”
Clicking "Edit" on the section IP assignment.
  1. Click the drop-down box in the “Edit network IP settings” dialog, and select “Manual.”
Clicking drop-down box to select "Manual" option.
  1. Select the IPv4 or IPv6 format to set the static IP address. In this example, we are selecting IPv4.
Selecting the option IPv4 in "Edit network IP settings."
  1. Fill in all the required details, such as IP address, Subnet mask, and Gateway, and click “Save.”
Fill all the required values of IPv4 and click Save
  1. When entering the IP address, make sure it is a private IP address that can be used on home and other private networks. According to the Internet Assigned Numbers Authority (IANA), the addresses reserved for private networks are as follows:
  • Class A: 10.0.0.0 to 10.255.255.255
  • Class B: 172.16.0.0 to 172.31.255.255
  • Class C: 192.168.0.0 to 192.168.255.255
  1. For any private network that needs to use IP addresses internally, it is permissible to use any address within the specified ranges. These addresses are unique only within the given private network.
  2. Typically, networks with a significant number of total hosts utilize Class A addresses, while medium- to large-sized networks opt for Class B, and small local area networks use Class C.
  1. To fill the Subnet Mask and Gateway fields, make sure you are using the same values that are currently assigned to your router. To find those values, launch the Command Prompt, type the following command, and press Enter. Also, note the “DNS Servers” address, as you’ll need it later.
enter ipconfig /all to get the details of network configuration

Tip: learn how to manage and control wireless networks via the Command Prompt.

2. Using Command Prompt

You can also configure the static IP address from the Command Prompt if you prefer the command line.

  1. Right-click on the Start menu, and click “Run” from the list of options.
Selecting "Run" from WinX menu.
  1. Type cmd.exe in the box, then press Ctrl + Shift + Enter to launch the Command terminal in admin mode.
Typing "cmd.exe" in Run box.
  1. To set a static IP address, use the following command and press Enter. Make sure you replace “X” with the name of your network adapter, as well as [IP address], [Subnet Mask], and [Default Gateway], each with your specific address. The values correspond to Subnet Mask and Default Gateway that you identified using ipconfigin the previous section.
netsh interface ip set address name= "X" static [IP address] [Subnet Mask] [Default Gateway]
Enter the netsh command to set static ip address

Note: to find the name of the network adapter, navigate to “Control Panel -> Network and Internet -> Network and Sharing Center,” and jot down the name next to “Connections.”

  1. To set the DNS server address, use the following command and press Enter. Replace “X” with the name of your network adapter and [DNS server address] with the DNS server address of the network you found earlier using ipconfig.
netsh interface ip set dns name= "X" static [DNS server address]
Setting a DNS server address via Command Prompt.
  1. You will not see a success message but can run the ipconfig command again to check the new configuration.
Typing ipconfig on Command Prompt to view the modified network configuration.

Tip: need the IP address of your router? Learn how to find it.

3. Using PowerShell

Alternatively, use the PowerShell tool to set a static IP address for your Windows PC.

  1. Press Win + X on your keyboard, and click Terminal (Admin) in the menu to launch PowerShell.
Pressing Win + X and select "Terminal (admin)"
  1. To view the details of your current network configuration, type the following command and press Enter. From the results displayed, jot down the values for the following fields: InterfaceIndex, IPv4Address, IPv4DefaultGateway, and DNSServer.
Entering command on PowerShell to get network configuration.
  1. Type the following command to set a static IP address and press Enter. Before executing the command, don’t forget to add the values for InterfaceIndex, IPAddress, and DefaultGateway. As for the PrefixLength, in most cases, it should be set to “24.” The parameter defines the local subnet size or subnet mask. For example, for a subnet mask such as “255.255.255.0,” the prefix length is 24 bits, while a subnet mask of “255.255.0.0” has a prefix length of 16 bits.
New-NetIPAddress -InterfaceIndex [value] -IPAddress [address] -PrefixLength 24 -DefaultGateway [address]
Enter command to set Static IP Address using PowerShell.
  1. To set the DNS server address, use the following command and press Enter. Make sure to add the values for InterfaceIndex and ServerAddresses (DNSServer).
Set-DnsClientServerAddress -InterfaceIndex [value] -ServerAddresses [address]
Enter command to set Dns Address using Powershell

Tip: unable to launch PowerShell? Try these fixes.

Static IP Is Sometimes Handy

Businesses have more use for static addresses than home networks. It’s completely safe to use a static IP address, as errors like “Your IP has been temporarily blocked” happen mostly with dynamic IP addresses. Plus, it is not complicated to set a static IP address if you follow the instructions outlined in this tutorial. Check out our post to troubleshoot Wi-Fi-related issues if you experience any problems with your Internet connection.

Image credit: Unsplash. All screenshots by Meenatchi Nagasubramanian.

Meenatchi Nagasubramanian
Meenatchi Nagasubramanian

Meenatchi is always passionate about learning new technological advancements and would love to try out new gadgets, software, and apps. After quitting her career as an Embedded Software Developer in 2009, she took up a career in content writing.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Leave a Reply

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