Change IP and DNS by command in Windows

Change IP and DNS by command in Windows
Photo by Marvin Meyer / Unsplash
  1. Run command prompt as administrator

FixedIPCom_202409_000.jpg

  1. Check interface name
netsh interface show interface

FixedIPCom_202409_001.jpg

  1. Check you current network information
netsh interface ipv4 show config

FixedIPCom_202409_002.jpg

  1. Now use the belows command change your IP and DNS (For this example change on interaface Wi-Fi).
netsh interface ipv4 set address name="YOUR INTERFACE NAME" static IP_ADDRESS SUBNET_MASK GATEWAY

FixedIPCom_202409_003.jpg

  1. Recheck your IP and DNS was changed by run command on No.3 again.
netsh interface ipv4 show config

FixedIPCom_202409_004.jpg

Change Only DNS command

netsh int ipv4 set dns name="Ethernet" static 8.8.8.8 primary validate=no
netsh int ipv4 add dns name="Ethernet" 8.8.4.4 index=2

Ref: howtogeek.com