How to quickly set IP addresses
Sometimes it takes your PC to another place for use. If you want to access the Internet, you need to configure the IP address, gateway, DNS, and so on as required. However, you need to change it back to the default or other address when using it elsewhere, if you change the IP address back and forth between the two places, it is very troublesome. The following shows you a simple method to quickly set the IP address.
Tools/Raw Materials
Method/step 1
- 1
Open notepad and create a text file named IP. bat.
- 2
Right-click IP. BAT and choose Edit from the context menu.
- 3
Enter the following code in the open file:
Set ADDR = 192.168.101.26
Set mask = 255.255.255.0
Set gateway = 192.168.101.252
Set DNS = 211.144.101.146
Netsh interface IP Set address name = "Local Connection" Source = static ADDR = % ADDR % mask = % mask % gateway = % gateway %
Netsh interface IP Set DNS "Local Connection" Source = static ADDR = % DNS %
Here, ADDR, mask, gateway, and DNS are the IP address, subnet mask, gateway, and DNS to be set. You only need to modify the IP address to the IP address you want to change and save it.
- 4
Double-click the IP. BAT file and check the IP address in the local connection. You will find that the IP address has been changed to the address you want to change.
- 5
If you want to change back to the default IP address, create a new notepad file named restore. bat in the same way as above. Enter the following content and save it:
Netsh interface IP Set address name = "Local Connection" Source = DHCP
Netsh interface IP Set DNS name = "Local Connection" Source = DHCP
- 6
Double-click the Restore. BAT file to run it. Then, check the IP address and change it back to the default one.
End
Notes