Automatic switching machine network configuration

xiaoxiao2021-03-06  60

Author: okcai operating environment: Windows 2000 / XP / 2003 Locale: Chinese Simplified

Sometimes, we always take two laptop companies, customers there, a network configuration, a network configuration, so IP address is always modified to modify, go to the customer, return to the company. Change back. There is also a broadband at home, but also need to be modified. We always find "network neighbors", then right click, select "Properties", then change. Although it is not a lot, but sometimes feel Quite cumbersome.

I write a fixed batch file through the netsh command, and then put a shortcut on the desktop. You need to change to that network configuration, just double-click the icon. The specific steps are as follows.

If I am in the company's IP address is: 10.10.10.123, subnet mask: 255.255.255.0, gateway: 10.10.10.1, DNS: 10.10.10.2, Wins: 10.10.10 I often go to customers, customers The IP address is automatically obtained. DNS is also automatic. My family is telecom broadband, IP address is required to be set to: 192.168.0.1, subnet mask: 255.255.255.0, gateway: None, DNS: None.

1. Establish three batch files Company_IP.BAT, CUSTOMER_IP.BAT, home_ip.bat, represents the company, customer, and home network configuration. The file content is as follows <1> file company_ip.batnetsh -c interface ip set address name = "Local connection" Source = static addr = 10.10.10.123 mask = 255.255.255.0Netsh -c interface ip set address name = "Local connection" GATEWAY = 10.10.10.1 GWMETRIC = 0NetSH -C Interface IP Set DNS Name = "local connection "Source = static addr = 10.10.10.2 register = primarynetsh -c interface ip set wins name =" Local connection "Source = static addr = 10.10.10.3

<2> File Customer_ip.batnetsh -c interface ip set address name = "Source = DHCPNETSH -C Interface IP Set DNS Name =" Local Connection "Source = DHCP Register = PrimaryNetSh-C Interface IP Set Wins Name =" Local Connect "Source = DHCP

<3> file Home_ip.batnetsh -c interface ip set address name = "Local connection" Source = static addr = 192.168.0.1 mask = 255.255.255.0NETSH-C interface ip set address name = "Local connection" Gateway = Nonenetsh -c Interface IP SET DNS Name = "Local Connection" Source = Nonenetsh -c Interface IP Set Wins Name = "Local Connection" Source = NONE

Then create a shortcut to the desktop. When we need to modify the specific configuration, just double-click the BAT batch file, the DOS command execution window will appear. The execution is slightly slow, etc. All execution, the window is automatically shut down. It should be described: the above "local connection", if the operating system is English or traditional Chinese, you need to make a corresponding modification. If you use the Wireless Network Connection, you also need to modify it, you can modify the "local connection" The same operation .2.Netsh is the command line script utility provided by the Windows 2000 / XP / 2003 operating system itself, which allows the user to display or modify the network configuration of the currently running computer locally or remotely or modify. Specific use can refer to the help document.

3. You can also configure the fixed file by the next backup network. It is also possible to recover when it is required. <1> Backup, such as currently in the company, want to put the current configuration, back up to company_ip.txt. Click "Start → Run" In the Run dialog, enter the cmd command and click [OK], then enter the netsh command after the command prompt: Netsh Dump> Company_IP.txt

<2> Recovery If you want to resume in the company's network configuration. Run the netsh command: nesh exec company_ip.txt actually, if this way, our company_ip.bat can also be a command: NESH EXEC Company_IP.txt, no matter How to use, we automatically complete the network configuration with the Netsh command. It is convenient for us.

转载请注明原文地址:https://www.9cbs.com/read-85060.html

New Post(0)