In-depth exploration of network command Netsh "potential"

Source: Internet
Author: User

Setting network parameters is actually a very easy task. However, it is easier to set network parameters. In special cases, it may also become troublesome. This is not the case. Once your system is "suffering", it cannot open the system's TCP/IP Parameter Setting window (this unfortunate phenomenon has occasionally happened ), modifying the network parameters becomes abnormal. However, in Windows 2000 or later versions, you can use the built-in network configuration command Netsh to modify network configuration parameters in the DOS environment. To help you better use the Netsh command, this article specifically summarizes some configuration skills for this command, and I believe it can help network administrators!

1. Save network settings

To avoid sudden computer system failures and cause loss of network parameters, you can save the network parameters as text files when the system goes online normally, so that the system can be restored quickly. When saving the current network configuration parameters, You can first run the "run" command in the Start Menu, open the "run" dialog box, and enter the "cmd" string command, click OK to switch the screen to the MS-DOS State; on the doscommand line, enter the string command Netsh-c interface dump> c: config.txt (note, in this command, the "> hosts text file is in. Of course, you can also specify other storage locations. Open the Resource Manager interface, find the config.txt text file in the C drive, and double-click it to view the current specific network parameters, as shown in 1. Here, you can view the static IP address, mask address, WINS server address, DNS server address, and other configuration information of the current workstation.


If you need to restore the previous configuration parameters in the future, you can directly execute the "netsh exec c: config.txt" command in the doscommand line, you can import the previous static IP address, mask address, WINS server address, DNS server address, and other configuration information to the system's TCP/IP parameter settings window. Once the import operation is successful, run the "IPCONFIG" command in the doscommand line to check the new network parameters of the system and see if they are restored to the previous values!

2. Modify the Host IP Address

Now, I only want to modify the IP address of the Temporary Folder. In addition to the corresponding folder, I want to modify the config.txt file to save it, change the IP address in the file to a new value, save it again, and import the file to the TCP/IP Parameter Setting window again. There is also a simpler method, that is, you can directly enter the Netsh status and modify the IP address settings.

When using this method to modify the host's IP address, first you need to follow the previous method, switch the screen to MS-DOS mode, and execute the "Netsh" command in the command line, in this way, the DOS prompt will change to "netsh>". In the Netsh state, enter the "Interface" command and click the Enter key to enter the NIC parameter setting mode. Because you only need to modify the IP address of the host at this time, you need to continue to execute the "ip" command and change the DOS prompt to "Interface IP>" to set the ip address of the host.

At the "Interface ip>" prompt, enter a string command in the format of "set address name static [addr] [mask] [gateway] [gwmetric, you can set the IP address, network mask address, or gateway address for the specified Nic. The "set address" character in this command is actually the IP address Setting command. The "name" string is used to specify the network interface name of the current system. in Windows 2000, the "name" string should be "Local Connection", and the "name" string in Windows XP and Windows 2003 should be changed to "Internet connection ";

In this command, "static" is used to specify that the IP address must be set to static. "[addr]" indicates the specific address to be set, and "[mask]" indicates the specific mask address to be set, "[gateway]" indicates the workstation gateway address to be set, and "[gwmetric]" is used to specify the specific number of hops. By default, this value can only be "1 ".
After understanding the meaning of the parameters of the preceding string command, I will introduce how to set the IP address of the workstation as an example. For example, you need to change the IP address of a workstation in Windows 2000 to "10.168.160.2" and change its network mask address to "255.255.255.255.128 ", modify the gateway address to "10.168.160.1". At this time, enter the "set address local connection static 10.168.160.2 255.255.255.128 10.168.160.1 1" string command at the "Interface ip>" prompt, after you click the Enter key, the system will not be able to return the result of command execution for a long time. If the result is displayed as "OK", as shown in 2, it indicates that the IP address of the workstation has been modified successfully.


 

3. Use the DHCP service

In a LAN, a static IP address is usually assigned to the workstation. However, if you use the broadband dial-up method to access the Internet, you must set the network parameters of the workstation in advance, to automatically obtain a dynamic IP address. To enable the workstation to automatically obtain a dynamic ip address, you must specify the workstation to use the DHCP service. In this case, you can go to the "Interface ip>" prompt according to the above method, then run the "set address local connection source = dhcp" string command. Once the system returns the "OK" result, it indicates that the setting is successful. Once your workstation is successfully dialing, it automatically obtains a dynamic IP address.

4. View Network Parameters

Directly at the "C:>" DOS prompt, run the "Ipconfig/all" string command to clearly view all network setting parameters of the current workstation, such as the IP address, network mask address, DNS server address, gateway address, and WINS server address of the workstation. In fact, the specific information above can be viewed using the network command Netsh. For example, first run the "Netsh" command in the doscommand line to enter the DOS network setting mode, and then run the "Interface" and "IP" commands in sequence to switch the screen to the IP setting status, then, enter the "show address" string command at the "Interface ip>" prompt. in Figure 3, you can view the IP address, subnet mask address, gateway address, and number of hops of the local workstation.


 

5. Modify DNS Parameters

In the DOS Status, you can also modify the DNS server parameters used when the workstation accesses the internet. When you modify this parameter, you also need to enter the ip setting status, and then at the "Interface ip>" prompt, enter a string command in the format of "set dns name static [addr]", and click the Enter key to specify the DNS server address for the local connection. The "set dns" string in the above command is actually a specific command used to modify the DNS server address, and "static" is used to specify that the DNS server to be set is static, "[addr]" indicates the specific IP address value.

For example, if you want to change the DNS server address of the local workstation to "210.73.128.10", you can first enter the ip setting status in the previous method, and then at the "Interface ip>" prompt, run the "set dns local connection static 210.73.128.10" command directly. When the system execution result shows "OK", it means that the IP address of the DNS server of the current workstation has been changed to 210.73.128.10. If you do not believe it, you may wish to return to the doscommand line status and execute the "Ipconfig/all" command. You will see that the DNS server address of the current workstation has indeed been changed to 210.73.128.10.

6. view route table information

In general, to view the route table information in the local network, you must first log on to the vro and then use the relevant command to access the local route table information. However, using the network command Netsh, You can conveniently view the route table information in the local network. To view route information in a route table, run the "Netsh" command in the doscommand line and then run the "ras" command at the "Netsh>" prompt, then run the "Routing" and "IP" commands in sequence, switch the screen to the "Routing IP>" prompt, and then run the "show rtmroutes" command (4 ), the system can display the routing information in the local route table. However, if the local workstation does not start "Routing And Remote service", you cannot view the information in the route table.


The above are just some common applications in the Netsh mode. In fact, there are many commands in this mode, which can be used to almost implement various complex network parameter configuration operations. If you are interested in this, if you are not familiar with this, you can use the help command to get help!

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.