How to configure TCP/IP settings from the Command Prompt in Windows

In order to configure TCP/IP settings such as the IP address, Subnet Mask, Default Gateway, DNS and WINS addresses and many other options you can use Netsh.exe.

With Netsh.exe you can easily view your TCP/IP settings. Type the following command in a Command Prompt window (CMD.EXE):

netsh interface ip show config

With Netsh.exe, you can easily configure your computer’s IP address and other TCP/IP related settings. For example:

The following command configures the interface named Local Area Connection with the static IP address 10.0.0.100, the subnet mask of 255.255.255.0, and a default gateway of 10.0.0.1:

netsh interface ip set address name=»Local Area Connection» static 10.0.0.100 255.255.255.0 10.0.0.1 1 (The above is one long line)

If you want to export your current ip settings:

netsh -c interface dump > c:mySettings.txt 

If you want to import your ip settings:

netsh -f c:mySettings.txt

or instead of -f

netsh exec c:mySettings.txt

To automatically obatin an IP address using DHCP:

netsh interface ip set address «Local Area Connection» dhcp

DNS settings:

netsh interface ip set dns «Local Area Connection» static 10.0.0.254

WINS settings:

netsh interface ip set wins «Local Area Connection» static 10.0.0.254

Auto DNS settings:

netsh interface ip set dns «Local Area Connection» dhcp

Usefull links:

Link one and Link two