ipconfig.co.uk

How to set a static IP address on Windows 11


Pick an address that will not clash, set it three ways, test it, and know when a router reservation is the better answer.

A static IP address keeps a PC at the same address every time it connects, which is what you want for port forwarding, a game server, a shared printer or remote desktop. Windows 11 lets you set one in three places: the Settings app, the old Control Panel dialog, and the command line. The part people get wrong is not the clicking but the choice of address, so start there.

Before you start: should it be a reservation instead?

A DHCP reservation on the router gives the same result without touching Windows at all: the router always hands this PC's MAC address the same IP. The PC stays on automatic settings, so it still works on other networks and still picks up new DNS settings if you change them on the router. For a laptop, a reservation is nearly always better. The reservation steps for common routers are on the main static IP page. If you still want the address set on the PC, carry on.

Step 1: collect the values you need

While the PC is still on automatic settings, open Command Prompt and run:

Windows · Command Prompt
ipconfig /all

From the section for your active adapter (Wi-Fi or Ethernet), write down the Subnet Mask, the Default Gateway and the DNS Servers. A typical home network gives you something like this:

SettingTypical value
Subnet mask255.255.255.0 (also written /24)
Default gateway192.168.1.1, 192.168.0.1 or 192.168.1.254
DNS serversThe gateway address, or your provider's servers

Use your own values, not these. What each line of ipconfig means, and the subnet calculator if your mask is something other than 255.255.255.0.

Step 2: choose an address that will not clash

The router hands out addresses from a range called the DHCP pool. If you pick an address inside it, the router can later give the same address to a phone or a TV and you get an IP address conflict. Log in to the router (how to find the admin page), find the LAN or DHCP settings, and note the start and end of the pool. Pick an address in the same subnet but outside that range.

If the pool covers the whole subnet, shrink it a little so you have room for fixed addresses. Then check the address is free:

Windows · Command Prompt
ping 192.168.1.50
arp -a | findstr 192.168.1.50

The ping should time out and arp -a should show nothing for that address.

Step 3, option A: the Settings app

  1. Open Settings › Network & internet. Choose Ethernet, or Wi-Fi and then your network's properties.
  2. Next to IP assignment, select Edit.
  3. Change Automatic (DHCP) to Manual and switch on IPv4.
  4. Enter the IP address you chose, the subnet mask, the gateway, and a preferred and alternate DNS server.
  5. Select Save.

Some Windows builds ask for a subnet prefix length instead of a mask; 255.255.255.0 is 24.

Step 3, option B: Control Panel

Press Win+R, type ncpa.cpl and press Enter. Right-click the adapter, choose Properties, select Internet Protocol Version 4 (TCP/IPv4) and click Properties. Choose Use the following IP address and Use the following DNS server addresses, fill in the values, and click OK. This edits the same settings as the Settings app.

The same dialog has an Alternate Configuration tab when the adapter is set to obtain an address automatically. It lets a PC use DHCP normally and fall back to a fixed address of your choosing only when no DHCP server answers.

Step 3, option C: the command line

Useful for scripting or for doing it remotely. Both need an administrator prompt. First get the exact adapter name:

Windows · Command Prompt
netsh interface show interface

Then, with netsh:

Windows · Command Prompt
netsh interface ipv4 set address name="Ethernet" static 192.168.1.50 255.255.255.0 192.168.1.1
netsh interface ipv4 set dnsservers name="Ethernet" static 192.168.1.1 primary
netsh interface ipv4 add dnsservers name="Ethernet" 1.1.1.1 index=2

Or with PowerShell, removing the automatic address and route first:

Windows · PowerShell
Remove-NetIPAddress -InterfaceAlias Ethernet -AddressFamily IPv4 -Confirm:$false
Remove-NetRoute -InterfaceAlias Ethernet -DestinationPrefix 0.0.0.0/0 -Confirm:$false
New-NetIPAddress -InterfaceAlias Ethernet -IPAddress 192.168.1.50 -PrefixLength 24 -DefaultGateway 192.168.1.1
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 192.168.1.1, 1.1.1.1

The second line reports an error if there is no default route to remove; that is harmless. The netsh and PowerShell page and the netsh reference cover the other options.

Step 4: check it worked

Windows · Command Prompt
ipconfig /all
ping 192.168.1.1
ping 1.1.1.1
nslookup example.com

ipconfig /all should now show DHCP Enabled: No and your chosen address followed by (Preferred). Then test each layer in turn: the gateway, the internet by number, and a name lookup. If the gateway answers but 1.1.1.1 does not, the gateway value is wrong. If 1.1.1.1 works but nslookup fails, the DNS servers are wrong; see changing DNS servers.

Going back to automatic

In Settings, set IP assignment back to Automatic (DHCP). From an administrator prompt:

Windows · Command Prompt
netsh interface ipv4 set address name="Ethernet" source=dhcp
netsh interface ipv4 set dnsservers name="Ethernet" source=dhcp

Common mistakes

  • Leaving the gateway blank. Local devices work, the internet does not. See no default gateway.
  • Copying the address from another device. Two devices, one address: a conflict.
  • Using a DNS server that only works on another network, such as a work server, then wondering why names fail at home.
  • Setting it on a laptop. A static address only makes sense on the network it was chosen for. Use a reservation for anything that moves.

More from the blog

All articles and guides →

Last reviewed . Command syntax verified against Windows 11, Ubuntu 24.04, macOS 15 and FreeBSD 14 unless noted otherwise.

Spotted a mistake or a switch we have missed? Every page on this site is written to be checked against real output, so please test on your own machine and compare.