If your computer is connected to both the extranet and intranet, you will surely encounter the need to frequently switch between dynamic IP addresses and static IP addresses. The author is this situation, the computer through ADSL connection extranet, with the automatic allocation of IP address mode, but also connected to the intranet, with a fixed IP address, so often need to modify the IP address in the Local Area Connection Properties window. Each time through the "Network Neighborhood → properties → local connection →internet protocol →tcp/ip→ Properties" Selection, and then click the desired IP address format, very cumbersome. So, is there a simpler way? After careful groping, but also really found a convenient way to see the implementation process together:
1. Create a switch from a static IP address to a dynamic IP address of a batch file
Open Notepad and input the following:
Echo off
Netsh interface IP Set Address "Local Area Connection" DHCP
Echo has switched the IP address from static to dynamic, after pressing any key, you can use the extranet ...
Pause
Input finished, after checking correctly, save as "Godhcpip.bat". The file name can be taken as a good record, and the extension must be "bat".
Tip: The "Local Area Connection" in the batch file is the default network connection name for the system, and if you have uninstalled and installed the NIC, it may become "local connection 2", "Local connection 3", and so on. The word "Local Area Connection" in a batch file must be consistent with the network connection icon name in the desktop Network Places → Properties window. Also, note that there is a space between the "local Area Connection" and the following number.
2. Create a batch file that toggles dynamic IP to static IP
Open Notepad and input the following:
Echo off
Netsh interface IP Set Address "Local Area Connection" Static 192.168.xxx.xxx 255.255.255.0
Echo has switched the IP address from dynamic to static: 192.168.xxx.xxx, after pressing any key, you can use the intranet ...
Pause
Input finished, after checking correctly, save as "Gostaticip.bat".
Tip: The "local connection" in the batch file has the same meaning, "192.168.xxx.xxx" is the static IP address you want to switch to, please replace it with your actual IP address. "255.255.255.0" is a subnet mask.
3. Use
When you need to use the extranet, simply double-click the "Godhcpip.bat" batch file and press any key to switch the IP address from static to dynamic, and you can start using the extranet without restarting your computer.
When you need to use the intranet, just double-click the "gostaticip.bat" batch file, according to the prompts, press any key, you can switch the IP address from dynamic to static fixed IP address, and without restarting the computer, you can start using the intranet.
Tip: This method applies to Windows 2000/xp/2003. Also, in the Windows xp/2003 operating system, manually changing the IP address through the Network Neighborhood attribute requires no restart of the computer, but in the Windows 2000 operating system, you must restart the computer for the IP that is manually changed to take effect. Using this method eliminates the need to restart the computer, which is quick and easy.