Set a static IP address with netsh from CMD
Configure a fixed IPv4 address, subnet mask and default gateway on any adapter in one line — essential for headless servers and remote workstations.
01Command
$ netsh interface ip set address name="Ethernet" static 192.168.1.50 255.255.255.0 192.168.1.102What it does
The name value must match the adapter's connection name exactly (spaces included); list them with `netsh interface show interface` or `Get-NetAdapter`. The command above sets address, mask, and gateway; DNS is a separate call: `netsh interface ip set dns name="Ethernet" static 1.1.1.1`. Verify with `ipconfig /all` or `netsh interface ip show config`, and test the gateway with `ping 192.168.1.1`. Adding a second IP to the same adapter without removing the first uses the `add address` variant instead of `set address`, which would replace the primary IP.
03Risk
04Undo
$ netsh interface ip set address name="Ethernet" dhcp05Sources
- Netsh contexts and commands | Microsoft LearnEvidence: Microsoft documents the netsh interface ipv4 context with set address commands accepting static address, mask and gateway parameters or dhcp.
- Netsh - Network Shell - Windows CMDEvidence: SS64 shows 'netsh interface ip set address name=... static addr mask gateway' syntax and the dhcp variant for reverting.
Last verified: 2026-09-17 · Category: Network
06Related solutions
Use the System File Checker to verify every protected Windows system file against known-good copies and automatically replace the damaged ones.
Use Windows Package Manager to install, search, and upgrade thousands of applications from the community repository in one command.
Robocopy is Windows' built-in robust file copier: use /MIR to keep a destination folder as an exact one-way mirror of a source, resumable and restartable.