16 февр. 2012 г.

Change IP settings from command line on Windows

I writing this post just as a reminder to myself, but maybe it also helps to someone else.

So to change IP settings from command line on Windows follow these steps:

1. Get name of your network interface:

> ipconfig



in this case interface has the name "Local Area Connection 3"

2. If you want to setup IP and DNS to be resolved by DHCP run following command:


> netsh interface ip set address "<interface name>" dhcp
> netsh interface ip set dns " <interface name> " dhcp


3. If you want to use static IP and DNS use following commands:

> netsh interface ip set address " <interface name> " static 192.168.0.2 255.255.255.0 gateway=192.168.0.1 gw=1

This will set static IP and gateway, then you can add any number of DNS servers:

> netsh interface ip add dns " <interface name> " 192.168.0.1
> netsh interface ip add dns " <interface name> " 8.8.8.8

Thats all,
enjoy :)

Комментариев нет:

Отправить комментарий