In Windows, you can easily change the IP address and DNS settings.

Source: Internet
Author: User


Easily convert IP addresses and DNS settings
Problem description:
For people who use laptops, they may often need to use them in different networks, such as the company network, customer network, or home broadband network. For this reason, you often need to set IP addresses and DNS servers based on the no-need network. For example, if you use a general broadband network at home, the IP address is automatically obtained, in the company office or customer office, a fixed IP address and DNS server are usually specified. It is very troublesome to set the location of each change. Therefore, this article describes the use of netsh commands and bat batch files for quick setting.

Code Description:
1. Set the fixed IP address and DNS server of the office or customer office
In notepad, save the following content as office. BAT:
@ Echo start to set the IP address used by the office...
@ Netsh interface IP Set address "Local Connection" static 172.20.128.145 255.255.255.0 172.20.128.1 1
@ Netsh interface IP Set DNS "Local Connection" static 172.16.80.1 primary
@ Netsh interface IP add DNS "Local Connection" 202.96.209.20.
@ ECHO: The current IP address is:
@ Ipconfig/all
@ Echo note: the IP address has been set as the IP address used by the Office. Please press any key to start using it ......
@ Pause

2. Set the method for Automatically Obtaining IP addresses and DNS servers
In notepad, save the following content as autoip. BAT:
@ Echo start to set automatic acquisition of Dynamic IP addresses...
@ Netsh interface IP Set address "Local Connection" DHCP
@ Netsh interface IP Set DNS name = "Local Connection" Source = DHCP
@ ECHO: The current IP address is:
@ Ipconfig/all
@ Echo note: the IP address has been set to automatically obtain the dynamic IP address. This applies to networks with dynamically assigned IP addresses such as home broadband. Please press any key to start using it ......
@ Pause

Usage:
Double-click the preceding file to complete the settings.

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.