To set a static IP address using the Command Prompt in Windows,
you can use the netsh command. Here's a step-by-step guide:
Note: You must have administrative rights to make these changes.
It's also a good idea to back up your current network configuration before
making any changes.
Open Command Prompt as an administrator:
Press Windows + X and select "Command Prompt (Admin)"
or "Windows PowerShell (Admin)".
View your current network adapters:
netsh interface ipv4 show config
This will display a list of all network interfaces. Identify the name of the network adapter you want to change. For this example, let's say it's named "Ethernet".
Set a static IP address:
netsh interface ipv4 set address name="Ethernet" static 192.168.1.10 255.255.255.0 192.168.1.1
Replace "Ethernet" with the name of your network adapter.
Replace 192.168.1.10 with your desired IP address.
Replace 255.255.255.0 with your desired subnet mask (usually it's 255.255.255.0 for home networks).
Replace 192.168.1.1 with your desired default gateway (usually it's the IP address of your router).
Set the DNS servers (if needed):
netsh interface ipv4 set dnsservers name="Ethernet" static 8.8.8.8 primary
netsh interface ipv4 add dnsservers name="Ethernet" 8.8.4.4 index=2
Here, 8.8.8.8 and 8.8.4.4 are Google's DNS servers. Replace them with your desired DNS servers.
Verify your new settings:
ipconfig /all
Look for your network adapter in the list and confirm that the IP address and DNS servers are set correctly.
To revert to DHCP:
If you want to revert the changes and go back to obtaining an IP address automatically via DHCP, you can use:
netsh interface ipv4 set address name="Ethernet" dhcp
netsh interface ipv4 set dnsservers name="Ethernet" dhcp
Note: Always ensure that the static IP you set isn't in use by any other device and isn't in the DHCP pool of the router to avoid IP conflicts.