Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Netsh command to modify ip, gateway and DNS of Windows system

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to use the Netsh command to modify the Windows system ip, gateway and DNS, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.

Many people ask me how to use commands to modify the ip of a Windows system. Because this method is a time-saving and labor-saving method for system testers who often need to change ip addresses. I think not only my friends need to solve this problem, but also many netizens need to solve this problem, so I will discuss and share it with you here.

The command 'netsh'' is needed to change ip, gateway, and DNS in command mode on Windows systems. If we search the Internet for the purpose of the Netsh command, Netsh is a command-line scripting utility that allows you to display or modify the network configuration of a currently running computer locally or remotely. Netsh also provides a scripting feature that allows you to run a set of commands in batch mode for a specified computer. To archive or configure other servers, Netsh can also save the configuration script in a text file. From this we can see that Netsh is a very powerful command, and experienced administrators and engineers will not doubt its ability. Today, I will not discuss all the functions of the Netsh command at length in this article, but will only introduce some of the most common and basic uses and uses of Netsh.

* method: manually set the ip, gateway and DNS of the Windows system.

* step, click "start"-"run -", type cmd, and enter enter

The second step is to enter configuration mode by typing "netsh interface ip" at the DOS interface command prompt that opens.

The third step is to enter set address "network card name" static IP mask gateway hops.

(for example: set address "Local connection" static 192.168.0.1 255.255.255.0 192.168.0.254 1) this is the IP address, subnet mask and gateway of the network card.

Step 4: enter the netsh interface ip set dns "network card name" static master DNS

Netsh interface ip set dns "Network Card name" static Secondary DNS number

For example:

Netsh interface ip set dns "static 202.194.40.1netsh interface ip add dns" Local connection "202.194.40.2 2

Note that if you don't need a secondary dns, you don't have to write the second line, just write the main DNS.

At this point, we have manually set up all the basic parameters of the Windows system network card.

The second method: batch setting ip, gateway and DNS of Windows system

* step, create a new txt notepad

The second step is to copy the following into the new notepad and fill in the relevant parameters according to your own actual needs. Please refer to *.

@ echo off

Netsh interface ip set address "Network Card name" static IP Mask Gateway Hops

Netsh interface ip netsh interface ip set dns "Network Card name" static Master DNS

Netsh interface ip netsh interface ip set dns "network card name" static auxiliary DNS number (note that if you do not need auxiliary dns this line can be removed)

The third step is to copy the above content to notepad and modify the relevant parameters, then save it as a .bat format file. In this way, when you need to change the ip, you only need to double-click the batch file to execute the .bat to complete the setting of the parameters related to the network card, which seems to be more convenient than the * method.

The above is about changing the local network card to a fixed parameter. How to set it if you want to change the local command to DHCP to get ip automatically? Now let me give you a brief account.

* step, click "start"-"run -", type cmd, and enter enter

The second step is to enter configuration mode by typing "netsh interface ip" at the DOS interface command prompt that opens.

Step 3, enter netsh interface ip set address "Local connection" dhcp

Netsh interface ip set dns "Local connection" dhcp

For example:

Netsh interface ip set address "dhcpnetsh interface ip set dns" dhcpnetsh interface ip set dns "Local connection" dhcp

After completing these two lines of commands, you can change the status of the local network card to DHCP to automatically obtain ip. Of course, you can also refer to the second method of setting up static ip to make a batch file, which is more convenient! When setting up batch processing, be sure to add @ echo off to the * line of the file.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report