How to quickly set IP addresses

Source: Internet
Author: User
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
  • Computer

  • Notepad

Method/step 1
  1. 1

    Open notepad and create a text file named IP. bat.

  2. 2

    Right-click IP. BAT and choose Edit from the context menu.

  3. 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. 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. 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. 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
  • "Local Connection" in the script refers to the name of the network connection you want to modify

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.