By default, Windows 11 relies on DHCP (Dynamic Host Configuration Protocol) to automatically obtain an IP address from your router. While this is perfect for normal web browsing, it can cause problems if you are hosting a local server, managing network printers, or setting up complex port forwarding rules. For these tasks, you need a Static IP address that never changes.
While you can configure a static IP through the Windows Settings GUI, using PowerShell is significantly faster and allows you to automate the deployment across multiple machines.
Step 1: Identify Your Network Interface
Before you can assign an IP, you must identify the exact name of the network adapter you want to modify (e.g., Ethernet or Wi-Fi).
- Click the Start menu, type PowerShell, right-click the top result, and select Run as administrator.
- Type the following command and press Enter:
Get-NetAdapter
- Note the exact name of your active adapter under the Name column (for example, “Ethernet”). Also, locate its ifIndex number, which is sometimes easier to use in scripts.
Step 2: Assign the Static IP Address
To assign the IP address, you will use the New-NetIPAddress cmdlet. You will need to know your desired IP, the subnet prefix length (24 is standard for a 255.255.255.0 subnet), and your router’s gateway IP.
Execute the following command, replacing the values with your specific network details:
New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress 192.168.1.50 -PrefixLength 24 -DefaultGateway 192.168.1.1
If you receive an error stating the IP address already exists, you must first remove the old DHCP assignment using Remove-NetIPAddress, or simply choose an IP outside your router’s DHCP pool.
Step 3: Configure DNS Servers
A static IP address is useless if your computer cannot resolve domain names. You must manually assign DNS servers using the Set-DnsClientServerAddress cmdlet.
To use Google’s public DNS servers (8.8.8.8 and 8.8.4.4), run this command:
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 8.8.8.8, 8.8.4.4
Your Windows 11 machine is now permanently bound to the static IP address. To verify your new configuration, simply type ipconfig /all in the console.