Changing IP Address through Command Prompt is not a big deal for advance windows users or users with hands on DOS experience. But for some of you out there in industry, it could be a life saver. Especially for those who works on embedded system where sometimes no GUI is available.
To change IP Address “netsh” command is used, the exact command you want to use is the following:
If you are using DHCP:
netsh interface ip set address name=”Local Area Connection” source=dhcp
However changing your IP address manually requires two commands, one for your IP address, subnet mask and default gateway and another for your DNS settings.
1. To set IP Address
netsh interface ip set address name=”Local Area Connection” static 192.168.0.151 255.255.255.0 192.168.0.1
This can be described as:
Local Area Network The name of the interface you want to change the IP address for.
192.168.0.151 The static IP address assigned.
255.255.255.0 The subnet mask.
192.168.0.1 Default Gateway (generally the router`s IP).
2. To set DNS Settings
As far as DNS, you only have two settings to set, a primary DNS server as well as a secondary one. The command to set them is almost identical; to set your primary DNS server you will want to use:
netsh interface ip set dns name=”Local Area Connection” static 8.8.8.8
This can be described as:
Local Area Connection The name of the interface you want to change the primary DNS setting.
8.8.8.8 The IP address of the DNS Server (8.8.8.8 is open or public DNS of Google).
To change the IP address of the secondary DNS server you will need to specify the index parameter:
netsh interface ip add dns name=”Local Area Connection” 8.8.4.4 index=2
The above command would set your network adapter to use a secondary DNS server address of 8.8.4.4 (This is also open or public DNS of Google)