There is no doubt that setting up IP in Windows is very convenient because there is a simple and intuitive interface to operate. Setting the IP through the graphical user interface is generally sufficient. However, for those who travel frequently, a person-generated conversion work, such a change in IP is undoubtedly time-consuming and inconvenient. Assume that a set of IP commands in the script file runs quickly.
Set IP steps with the command line (WIN7, set for IPV4):
1. Set up a static IP
netsh interface ipv4 set address name= "Local Area Connection" Source=static addr=192.168.20.11 mask=255.255.255.0 gataway= 192.168.20.1 gwmetric=30
The Gateway Settings section of the black font is optional.
2, set multiple IP, note the difference in red part of the instructions
netsh interface IPv4 set address name= "Local Area Connection" Source=static addr=192.168.20.11 mask=255.255.255.0 gataway= 192.168.20.1gwmetric=30
netsh interface IPv4 add address name= "Local Area Connection" addr=192.168.1.11 mask=255.255.255.0 gwmetric=30
This command sets the 192.168.20.11,192.168.1.11 two IP
3, set up their own active access to IP
netsh interface ipv4 set address name= "Local Area Connection" Source=dhcp
4. Set the domain name
netsh interface ipv4 set DNS name= "Local Area Connection" Source=static addr=202.106.0.20 register=primary
Addr is the domain name server address, primary refers to the primary domain name
Complete sample:
A, office LAN use Beijing-office.bat
netsh interface ipv4 set address name= "Local Area Connection" Source=static addr=192.168.20.11 mask=255.255.255.0 gwmetric=30
netsh interface ipv4 add address name= "Local Area Connection" addr=192.168.1.11 mask=255.255.255.0 gwmetric=30
REM netsh interface ipv4 set DNS name= "Local Area Connection" Source=static addr=202.106.0.20 register=primary
B, the hotel for Internet use, for their own initiative to obtain the IP settings, beijing-hotal.bat
netsh interface ipv4 set address name= "Local Area Connection" Source=dhcp
netsh interface ipv4 set DNS name= "Local Area Connection" Source=static addr=202.106.0.20 register=primary
netsh interface ipv4 add DNS name= "Local Area Connection" addr=202.106.46.151
After creating these two script files, it is very convenient to run the corresponding script file on it only in different environments.
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
Windows Setup Script IP