guide · static export
PC · network

Set a Static IP Address and a Fixed DNS Server

A printer, a NAS or a port forward needs an address that does not move. Pick one outside the DHCP pool, set it per adapter, and keep the path back to DHCP open.

by@guidox updated:10/31/26 time:20 min level:Intermediate tested on:Windows 11 24H2 works on:Windows 10, Windows 11, Windows Server 2019 tools:PowerShell as administrator, Router access
TL;DR

Note the DHCP values, pick an address **outside the router's DHCP pool**, then set it with **New-NetIPAddress** and **Set-DnsClientServerAddress**. One command pair puts the adapter back on DHCP.

Before you start

Requirements

  • Admin rights
  • Access to the router's DHCP range
  • 20 minutes
Step by step

Instructions

01

Write down what DHCP gave you

**Get-NetIPConfiguration** shows address, prefix, gateway and DNS in one block. Save that output before changing anything — it is the fastest way back when a value is wrong.

Get-NetIPConfiguration -InterfaceAlias 'Ethernet' -Detailed
Get-DnsClientServerAddress -InterfaceAlias 'Ethernet' -AddressFamily IPv4
02

Pick an address outside the DHCP pool

The router hands out roughly .100 to .200 on most home networks. Take something below that, and confirm nothing answers on it before you claim it.

ping -n 2 192.168.1.50
arp -a | findstr 192.168.1.50
⚠ warningA duplicate address breaks both machines, not only yours. A DHCP reservation on the router is the safer variant if the router supports it.
03

Disable DHCP on that adapter and set the address

An existing DHCP lease and a static address on the same interface produce a conflict, so turn DHCP off first. **PrefixLength 24** equals the 255.255.255.0 you know from the dialog.

Set-NetIPInterface -InterfaceAlias 'Ethernet' -Dhcp Disabled
New-NetIPAddress -InterfaceAlias 'Ethernet' -IPAddress 192.168.1.50 -PrefixLength 24 -DefaultGateway 192.168.1.1
04

Set the DNS servers explicitly

A static address without static DNS inherits nothing and falls back to nothing. Two resolvers keep name resolution alive when one is down.

Set-DnsClientServerAddress -InterfaceAlias 'Ethernet' -ServerAddresses 1.1.1.1,9.9.9.9
Resolve-DnsName example.com -Server 1.1.1.1 | Select-Object -First 3
tipEncrypted DNS is a separate switch and only applies to resolvers Windows knows. Check the DNS client settings if you want DoH on top of this.
05

Test the whole chain, not only the ping

Gateway reachable, DNS answering and a real TCP connection are three different tests. Run all three so a DNS failure does not look like a broken network.

Get-NetIPConfiguration -InterfaceAlias 'Ethernet'
Test-NetConnection 192.168.1.1 -InformationLevel Quiet
Test-NetConnection 1.1.1.1 -Port 443 -InformationLevel Quiet
06

Keep the way back to DHCP

Two commands undo the change completely. Run them before you move the machine to another network, otherwise the old subnet follows you.

Set-NetIPInterface -InterfaceAlias 'Ethernet' -Dhcp Enabled
Remove-NetIPAddress -InterfaceAlias 'Ethernet' -IPAddress 192.168.1.50 -Confirm:$false
Set-DnsClientServerAddress -InterfaceAlias 'Ethernet' -ResetServerAddresses
ipconfig /renew
Troubleshooting

Common issues

Windows reports a duplicate address

Another device already holds it, usually a printer with a fixed address nobody documented. Pick a different one and confirm with ping before you set it.

The gateway answers but nothing else does

That is DNS. Compare Set-DnsClientServerAddress output with the values you wrote down, and remember VPN adapters can override the per-adapter list.

The adapter name is different

Interface aliases change with language and with every reinstall. Use Get-NetAdapter to read the exact alias or address the adapter by InterfaceIndex.

No internet after moving to another network

The static address still points at the old subnet. Set the adapter back to DHCP, renew, and only then configure a new static address.

FAQ

Frequently asked

Static address or DHCP reservation?

A reservation is cleaner: the router keeps the bookkeeping and you cannot create a conflict. Use a static address when the router has no reservation feature or the device must work without it.

Does a static address survive a Windows update?

Yes. It is stored in the network profile and stays until you change the adapter or reset the network stack.

How to undo this

Set the interface back to DHCP with Set-NetIPInterface -Dhcp Enabled, remove the static address with Remove-NetIPAddress, reset DNS with -ResetServerAddresses and run ipconfig /renew.

Changelog · 1 entry
  1. 2026-10-31
    First version
Interactive version: checklist, feedback, related guides →

Free · no account needed · tracks your progress