Netsh (DOS settings IP address) []

Source: Internet
Author: User

Netsh–c Interface ip set address " Local Connection "140.130.0.1 255.255.255.0: modify on Interface "Local Area Connection" IP for 140.130.0.1 , MASK for 255.255.255.0

Netsh–c Interface IP add address " Local Connection "140.130.0.1 255.255.255.0: add a new one to the interface "Local Area Connection" IP 140.130.0.1 , MASK for 255.255.255.0

Netsh–c Interface IP add address " Local Connection "gateway=192.168.0.4 gwmetric=2  : Add a gateway to the interface "Local Area Connection" 140.130.0.1 , metric is 2

Netsh–c Interface IP Delete Address " Local Connection "140.130.0.1: in the interface "Local Area Connection" deletes a IP 140.130.0.1.

-----------------------------------------------------------      Use the netsh of network DOS command to implement the command line mode to modify IP address, subnet mask, gateway address and other information.
Applicable system: 2000/xp/2003
Implementation method:
STEP1: Enter command line mode enter "netsh" into network configuration mode.
STEP2: Enter "interface" into the interface setup mode, and then enter IP into IP address setting mode. At this point, the path before the prompt appears as "interface ip>."
STEP3: At the interface ip> prompt, enter "add address", local area Connection "10.0.0.2 255.0.0.0" To modify the local computer's IP address to 10.0.0.2, and the subnet mask is 255.0.0.0. It is important to note that the local area Connection is the name of the native connection, and in practice, the user can replace the area Connection with the true network connection name.

STEP4: At the interface ip> prompt, enter "add address", local area Connection "gateway=10.0.0.3 gwmetric=1" You can modify the remote computer's gateway address is 10.0.0.3, and the number of gwmetric for the general ADSL user set to 1 can be, if it is the company's local area network users that the value of the remote computer to reach the gateway number of hops, you can ask network management access.
  How to find the real network connection name. You need us to go to the remote computer to view by "start-> set up-> network and dial-up Connection", in practical application if the local connection name is Chinese, pay special attention to "local connection 1" there is a space between, enter the space can not be missing.    --------------------------------------------------------------------

netsh command (Configure Network Neighborhood properties with DOS commands)

Before surfing the Internet, network parameters must be properly configured, and configuration parameters typically need to be done in the TCP/IP Properties window, and if you suddenly find yourself unable to open the TCP/IP Properties window (such as when the system is infected, or accidentally remove the network components), you are not at your wits end. In fact, Win2000 the above version of the operating system, all support in the DOS environment to configure the function of network parameters. As long as the use of Netsh commands, access to the network configuration state under DOS, you can achieve a variety of network configuration.

Enter IP setup mode

In a DOS environment, you must first enter the IP setup mode before setting the network parameters. Open the System Run dialog box, execute the "CMD" command, switch the main interface to a DOS environment, enter the "Netsh" command at the command line, click the Enter key, the DOS command prompt will automatically become "netsh>", followed by "Interface" | IP command, the DOS command prompt becomes "Interface ip>" (as shown in Figure 1), where you enter the IP setup mode. In this mode, you can use the "set" command to set the network IP address, netmask, DNS server, or use the "show" command to view various network parameters, including the various TCP/IP connections established with the computer and so on.

Set IP address

In IP setup mode, execute the Set address name static [addr] [mask] [gateway] [gwmetric] command to assign IP addresses, mask addresses, and gateway addresses to the specified network connection. Where set address is a private command that sets the IP address, name indicates the specified network connection name, and the name under Win2000 should be set to Internet connection, and the name under WinXP, Win2003 should be set to local connection ; Static is the setting of statically addressed, "[addr] refers to the specific IP address," [mask] "refers to the specific mask address," [Gateway] "refers to the specific gateway address," [gwmetric] "refers to the specific gateway metric, in general, this value should be set to "1".

For example, now you want to assign a fixed IP address to "10.192.168.10" for a Win2000 workstation in your local area network, set the workstation's mask address to "255.255.255.0", and set the gateway address to "10.192.168.1". Then you can execute the string command "set address Internet connection static 10.192.168.10 255.255.255.0 10.192.168.1 1" In IP setup mode, and it will not be long before the system returns to "OK" Prompts (as shown in Figure 2), which indicates that the IP address settings were successful.

If you are a dial-up user and need to assign a dynamic IP address to your computer, you must, in IP settings mode, enter the "Set address Internet connection Source=dhcp", and after clicking Enter, if the system returns a "OK" prompt, means that the DHCP service is successfully enabled for this computer, and the IP address of the computer will be automatically acquired later.

setting up a DNS server

In IP setup mode, you can also set up a DNS server for the specified network connection, as long as the set DNS name static [addr] command is executed. Where "Set DNS" is a dedicated command for setting up a DNS server, "Static" means setting up a static DNS server, and "[addr]" is the specific DNS server IP address.

For example, now that you want to set the DNS server for the current computer to "202.100.100.202", you can enter the string command "set DNS Internet connection static 202.100.100.202" in IP setup mode, and then click Return The system returns a "OK" prompt indicating that the configuration of the static DNS server has been successful. At this point, you can perform a show DNS command to see if the current computer's DNS server has been set to the specified IP address, as shown in Figure 3.

If you need to start a dynamic DNS server for your computer, you can perform the set DNS Internet connection source=dhcp command.

Query configuration information

You know in the DOS environment, using the "ipcon-fig" command, you can also see the current computer network configuration information, but the command to see the information is limited, only limited to IP address, mask address, gateway address. In IP setting mode, you can look up various network configuration information. For example, after you execute the show config command, you can see what the Gateway metric is, what the DNS server is, what the WINS server is, and so on, in addition to the information that the "Ipconfig" command can query.

With the show Tcpconn command, you can see which Internet hosts are currently available, connect to the local machine, or see whether the local port is working, off or listening (as shown in Figure 4).

Flexible use of this command, you can promptly find out whether the system has been a foreign intrusion, if there is a strange host with the local host of unfamiliar ports, the system was the most attacks, you must quickly take measures to ensure that the system security.

Of course, Netsh also provides you with a lot of queries to query the network information, such as the command to query the IP statistics, query the command of TCP statistics, query UDP, ICMP statistics commands, etc., these commands are relatively simple to use, here is not a detailed introduction.

quickly modify configuration

If your laptop needs to work in a different network environment, you'll need to rewrite the network parameters before each job, which is too much trouble. Now, you can easily modify the network configuration in Netsh mode with the following steps:

In the DOS command line state, the input string command "Netsh-c interface Dump>c:/net1.txt", after clicking the Enter key, the current workstation's network configuration information, Are all saved to the C-disk Net1.txt file (which holds the Internet parameters in the network 1 environment); below, open the Net1.txt file, you can see the configuration information as shown in Figure 5, including the workstation's IP address, mask IP address, gateway IP address, etc. Now, you can use the configuration parameters in other network environments that your notebook computer may use, replace the corresponding argument here, the remainder remains unchanged, and then save the text file as "Net2.txt" (which holds the Internet parameters in the Network 2 environment); Similarly, you can generate Net3.txt, Net4.txt......netn.txt, let these files save the network 3, network 4 ... Network n environment in the Internet parameters.

Later, no matter which network environment the laptop is connected to, as long as the DOS command line state, the implementation of the "netsh exec c:/netn.txt" command, you can quickly modify the purpose of the network configuration (here "netn.txt" file, must correspond to the specified network environment).

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.