My workplace has two internet lines wired and wireless and me roaming all over office for meetings, discussions with my laptop greedy for bandwidth. Initially I use to set my IP address manually and reset them back to point to DHCP servers hopping over wireless network and plugging LAN cables. Its really boring to go to IP address window in my Vista and set the IP address. I am sure many of us had spending time (time=money) setting and resetting the IP addresses. So let me show you how you can Automate setting up your IP.
Windows comes with command line tool Netsh which lets you set the network details.
So lets start setting up LAN adapter with IPv4.
Go to your command prompt and type in
netsh interface ipv4 set address name = "Local Area Connection" source=static address= {ip you intend to assign to your machine} mask=255.255.255.0 gateway={your gateway ip address} gwmetric=1
Here is what you are doing
"nestsh interface ipv4 " we are going to set the IPV4 address and not IPV6.
"set address " ordering nestsh command to set the ip address.
"name="Local Area Connection" " Ordering netsh command to set the ip address of adapter with name as Local Area Connection which is your wired adapter on your machine.
"source= static" ordering nestsh to set the ip address manually and not from dhcp
"address=" your intended ipv4 address
"mask=" your subnet mask ip
"gateway=" your gateway ip address. The address of your or proxy
"gwmetric=1" its a metric for default gateway and should be set if you are specifying gateway
Press enter and you have set your Ip address. But all is not over yet. You may also want to set your primary and secondary dns addresses
So lets set our primary dns address. Type in
netsh interface ipv4 set dnsserver name = "Local Area Connection" source = static address= {your primary dns address}
once again we are telling netsh to set primary dns server with ipv4 ip address for interface named "Local Area Connection" manually
Lets set our secondary dns address
netsh interface ipv4 add dnsserver name = "Local Area Connection" address= {your secondary dns
address}
here we are telling netsh to add secondary dns server address.
You can create such scripts in file with .bat extension and whenever you want to set the addresses just run the scripts with elevated rights