[How To] Change your IP,Subnet and Gateway Automatically

Does your organization or your college provide you static IP address? And your home router uses DHCP for IP address allocation?  Well, in this case you (almost)always end up  right-clicking the bars/* Wi-Fi Signal Strength || The Monitor */ in taskbar, then going to Network and Sharing Center and selecting the right network adapter and selecting properties and going to IPv4 config and entering IP address, subnet mask,default gateway etcetera etcetera ….. Quite the long job eh?

Well, Microsoft (yes, Microsoft; if you’re working with Win7 or higher) provides you a utility called netsh.exe  helps you tweaking around network configurations locally or remotely ie displaying the current configuration, modifying the same.

The KB (knowledge base) on the same said it can be used for


Ad
  • Configure interfaces.
  • Configure routing protocols.
  • Configure filters.
  • Configure routes.
  • Configure remote access behavior for Windows-based remote access routers that are running the Routing and Remote Access Server (RRAS) Service.
  • Display the configuration of a currently running router on any computer.
  • Use the scripting feature to run a collection of commands in batch mode against a specified router.

 Setting the IP: The GeeKy way:

Rush into the elevated CMD!!  Okay. Go into start menu. Type CMD. Right-click and open it As Administrator.

Hit the following command for setting IP, Subnet and Gateway.

netsh int ip set address "Wireless Network Connection" source=static 127.0.0.1 255.255.0.0 127.0.0.1

To set DNS server,both primary and secondary, hit the following

netsh interface ip add dns name="Wireless Network Connection" addr=4.4.2.2 validate=no
netsh interface ip add dns name="Wireless Network Connection" addr=8.8.8.8 index=2 validate=no

And when you’re back home, you would want to reset the setting to DHCP right?

netsh int ip set address "Wireless Network Connection" source=dhcp
netsh interface ip set dns "Wireless Network Connection" source=dhcp

Replace “Wireless Network Connection” with appropriate name. Can be found under Control Panel\Network and Internet\Network Connections

 The Easy Way:

Well,the title said changing the IP Automatically right?

We can add those commands into a BAT file and execute the file. That simple.Just download these two bat files. Modify the appropriate details like addresses, the network connection name.

Download set.bat and reset.bat

Then run them As Administrator by Right-clicking on file.

I’ll repeat : Replace “Wireless Network Connection” with appropriate name. Can be found under Control Panel\Network and Internet\Network Connections

 


Ad

Leave a Reply