How to configure a static IP Address in Windows
An internet protocol address, commonly known as IP address refers to a unique identifier assigned to a device that is connected to a specific network. Other devices in the network can then use this IP address to communicate with the device, share files, etc.
Once you connect a device to a specific network, it is assigned a unique identifier that allows other devices to locate and communicate with it. The work of locating and assigning IP addresses within a network is carried by a DHCP server.
The work of a DHCP server is to monitor the network for any new connections. It will then find an IP address that is not used by other devices in that network and assign it to the connected device. Once the device disconnects, the DHCP server can take that IP address and assign it to another device.
Since the IP address assigned to a device by DHCP server depends on its availability, this value can change from time to time.
Although a DHCP server is incredibly useful in a environment with lots of devices. It may not always be the best solution. For example, if you have a network storage whose IP address keeps changing, it can be tiresome as you will need to figure out its IP address every time you need to connect to it.
You can resolve this by using a static IP address.
What is a Static IP Address?
A static IP address is the exact opposite of a dynamic IP address. Once you assign a static IP address to a device, it will not change even after a reboot. The IP is reserved for that device and cannot be assigned to other devices in the network.
Static IP address are very useful as they can help you reduce network conflicts, enable file and printer sharing, port forwarding and more.
Let us learn how we can configure a static IP address on a Windows machine.
Keep in mind that this tutorial has been tested on Windows 7, Windows 10 and Windows 11
Method 1 - Windows Set Static IP using the Control Panel
The most common method of setting a static IP on your Windows machine is using the Control Panel. This method will work for Windows 7, 8, 10 and 11.
Open the start menu and launch the control panel.
Next, click on the Network and Internet
section.
Next, select Network and Sharing Center
option.
Next, on the navigation pane, select Change Adapter Setting
.
This will open the Network Connections
window allowing you to select the network you wish to use. For example, you can select your Wi-Fi or Ethernet adapter depending on which connection your device is using.
Select the Properties
option to launch the adapter properties section.
Next, under Networking
Tab, select Internet Protocol Version 4 (TCP/IPv4)
and click on Properties.
In the Internet Protocol Version 4 (TCP/IP) Properties
window,select Use the following IP address
.
Next, specify the static IP address for your device, followed by the subnet mask and default gateway. The default gateway refers to the IP address of your router.
Next, navigate to the DNS section and set Use the following DNS Server addresses
. Set the preferred DNS. For example, set the preferred DNS to your router IP address. You can also specify a custom DNS server in this section.
Once completed, click on OK to save the changes.
Method 2 - Windows Set Static IP Using the Command Prompt
One of the quickest and efficient method of assigning a static IP to your machine is using the command prompt. If you are comfortable with the Windows terminal, this is the best method to do so.
Launch the Windows start menu and search for Command Prompt. Right click and select Run as Administrator.
In the command prompt, run the command below to get the network configuration information:
ipconfig /all
The command should return detailed information about the installed network adapters as shown:
Wireless LAN adapter Wi-Fi:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Killer(R) Wi-Fi 6 160MHz Wireless Network Adapter (201NGW)
Physical Address. . . . . . . . . : E4-5E-37-13-A4-AC
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 192.168.0.100(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1
DNS Servers . . . . . . . . . . . : 1.1.1.1
8.8.8.8
NetBIOS over Tcpip. . . . . . . . : Enabled
From the output above, we are interested in the:
- Subnet Mask
- DNS Servers
- Default Gateway
Once you have these values noted down, run the command below to set a static IP to your machine.
netsh interface ip set address name="Wifi" static 192.168.0.100 255.255.255.0 192.168.0.1
Replace the value of the name parameter with the name of your network adapter. Ensure to replace the value 192.168.0.100
with your static IP for your machine, 255.255.255.0
with the subnet mask for your machine, and 192.168.0.1
with your Gateway address.
To set custom DNS Servers, run the command:
netsh interface ip set dns name="Wifi" static 8.8.8.8
Replace the name with the name of your network adapter and the value 8.8.8.
with the IP address of your preferred DNS server.
Once completed, run the ipconfig command to verify the changes.
Method 3 - Windows Set Static IP using the NetTCPIP Tool
Unfortunately, Microsoft has laid out plans to deprecate the netsh
utility. Hence, depending on the time of reading, the commands above may not work.
The alternative is using the NetTCPIP
tool provided in the latest version of Microsoft PowerShell.
To use this tool, run the PowerShell as Administrator.
Run the command below to fetch the current network configuration
Get-NetIPConfiguration
The command should return the information of the available network adapters in your system. Note down the configuration value of the adapter whose IP you wish to change.
The following are the properties you will need to note down:
InterfaceIndex
IPvAddress
IPv4DefaultGateway
DNSServer
InterfaceAlias : Wi-Fi
InterfaceIndex : 17
InterfaceDescription : Killer(R) Wi-Fi 6 160MHz Wireless Network Adapter (201NGW)
NetProfile.Name : xxxx
IPv4Address : 192.168.0.100
IPv4DefaultGateway : 192.168.0.1
DNSServer : 1.1.1.1
8.8.8.8
Next, to set a static IP of your network adapter, run the command:
New-NetIPAddress -InterfaceIndex 17 -IPAddress 192.168.0.100 -PrefixLength 24 -DefaultGateway 192.168.0.1
Replace the above command values with the InterfaceIndex
, IPAddress
and DefaultGateway
you noted down earlier. The command will return an output as shown:
IPAddress : 192.168.0.100
InterfaceIndex : 17
InterfaceAlias : Wi-Fi
AddressFamily : IPv4
Type : Unicast
PrefixLength : 24
PrefixOrigin : Manual
SuffixOrigin : Manual
AddressState : Tentative
ValidLifetime : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource : False
PolicyStore : ActiveStore
IPAddress : 192.168.0.100
InterfaceIndex : 17
InterfaceAlias : Wi-Fi
AddressFamily : IPv4
Type : Unicast
PrefixLength : 24
PrefixOrigin : Manual
SuffixOrigin : Manual
AddressState : Invalid
ValidLifetime : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource : False
PolicyStore : PersistentStore
To set a custom DNS server, run the command:
Set-DnsClientServerAddress -InterfaceIndex 17 -ServerAddresses 8.8.8.8
Replace the -ServerAddresses
Parameter wit the IP Address of your Desired DNS Server. You can specify multiple DNS Servers by separating each address with a comma.
Termination
In this article, you explored how you can configure a static IP address on your Windows machine using the control panel, the netsh
command and PowerShell NetTCPIP
utility.
We hope you enjoyed this tutorial. If you did, share with your friends and show some love in the comments below.
Feel free to contact us if you need help regarding the concepts discussed in this article.
Thanks for reading && See you in the next one!!!