Set IP Address / DNS / Route in CMD

I know once in a while we all have to use our CMD skill to set some stuff up in machines. So here is some command to get windows machine online via CMD.

****First you need to locate the name of the network interface

netsh interface ipv4 show interfaces

***Assume that you want to setup a static IP such as below

  • IP:
  • sub:
  • GW:

netsh interface ip set address name=”Local Area Connection” static 1

Note that ” local area connection” is the one I found when I ran very first command and “1” in the end is the metric for route.

If you want to forget about the static rout and want to get DHCP,

netsh interface ip set address name=”Local Area Connection” dhcp

****Now if you want to set a static DNS,

netsh interface ip set dns name=”Local Area Connection” static

Second DNS

netsh interface ip add dns name=”Local Area Connection” index=2

Again if you want to get DNS via DHCP

netsh interface ip set dnsservers name=”Local Area Connection” source=dhcp

DONE,your PC will be one line!!. Yes of course you need to plug the network cable 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s