Linux can make you feel like a true nerd, by typing in all those fancy commands on a black & white terminal, and seeing it take effect on your computer/server. It's a sense of accomplishment, once it works -- you'll definitely pat yourself on the back! In windows, even a dummy can change network settings. It's a click-and-play thing. So how do you show off your Windows knowledge? By doing it command line style!
It's as kinky as it sounds too. Changing network-settings (like IP, netmask, gateway, ...) through the command line opens up some possibilities. You can place'm in a batch-file, and use it on a portable USB disk for easy switching of IP's, no matter what computer you're on.
So, the basics. The main command to issue here is netsh. If you type netsh /? in the command line, you'll see it all of its great features. It does have one drawback: to change network settings of a NIC (Network Interface Controller), you need to know its name in Windows. This defaults to "Local Area Connection", or "LAN Verbinding" in Dutch. This name (which is a unique identifier for a NIC on Windows) will determine which NIC you'll change.
Enough gibberish, what do I type?
netsh interface ip set address name="Local Area Connection" source=static addr=10.0.0.5 mask=255.255.255.0
The command above will change the IP-address and netmask for a connection called "Local Area Connection" to 10.0.0.5, using netmask 255.255.255.0 .
Alternatively, you can modify the command to place a certain NIC in DHCP mode, so it'll try to retrieve its network settings from a DHCP server, instead of manually typing it.
netsh interface ip set address name="Local Area Connection" dhcp
Doing so, will make sure the computer/server tries to grab the necessary network settings itself, so you won't have to remember the gateway, netmask, IP addresses, nameservers, ... Then again, this'll only work if there is a DHCP server in your network, which handles the leasing of IP addresses.
netsh interface ip set address name="Local Area Connection" gateway=10.0.0.1 gwmetric=0
This command will add a default gateway to your "Local Area Connection"-NIC. Not quite sure what the "gwmetric=0" thing does, but it seems needed. If anyone can clarify it, I'd be happy to know :-)
netsh interface ip set dns name="Local Area Connection" source=static addr=10.0.0.128
Adding a nameserver to your Local Area Connection can be done easily as well, as shown in the command above. In this case, I'll assume 10.0.0.128 is your local nameserver (or you could use the nameservers given to you by your internet provider).
That command will also specify that you will give all the necessary nameservers. The "source=static" determines that any nameserver used, should be explicitely defined. You can add another nameserver (if you want 2, or more), by doing this:
netsh interface ip add dns name="Local Area Connection" addr=10.0.0.129
Note the difference in "netsh interface ip add dns". It assumes you already have a previous command, in which you state "source=static" for your DNS servers.
And we can, ofcourse, combine these to a simple batch-file which you can execute from a USB stick, to automatically set your wanted network connections on a pc of your choice.
Just copy/paste the commands you need to a .bat file you create, and double click it. It'll execute the commands inside, and change your IP/Gateway/Netmask/Nameservers as specified in the commands.
Now all you should do on your fancy Windows, is open a command line, press alt + enter and start showing off your fancy schmancy windows commands :-)