In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, the editor will bring you a powerful functional analysis of how to carry out netsh. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
Netsh
The netsh command describes the scheme
This blog system automatically shields the right slash of the path separator in windows, so I have to use / instead. Please pay attention when reading)
Netsh is a powerful command line tool for network configuration provided by the windows system itself. Export configuration script: netsh-c interface ip dump > c:/interface.txt import configuration script: after netsh-f c:/interface.txt enters the netsh environment, you can also load a configuration script with the exec command in the root directory. The configuration of wins, route, ras and other network services can also be operated through the built-in commands of Netsh.
The following is a sample configuration:
C:/Documents and Settings/Administrator > netsh /?
Usage: netsh [- an AliasFile] [- c Context] [- r RemoteMachine] [- u [DomainName] UserName] [- p Password | *] [Command |-f ScriptFile] the following instructions are valid: commands in this context:?-displays a list of commands.
Aaaa-change to the `netsh aaaa' context.
Add-add a configuration item to the list of projects.
Delete-removes a configuration item from the project list.
Dhcp-change to the `netsh dhcp' context.
Diag-change to the `netsh diag' context.
Dump-displays a configuration script.
Exec-run a script file.
Help-displays a list of commands.
Interface-change to the `netsh interface' context.
Ipsec-change to the `netsh ipsec' context.
Ras-change to the `netsh ras' context.
Routing-change to the `netsh routing' context.
Rpc-change to the `netsh rpc' context.
Set-updates the configuration settings. Show-displays information.
Wins-change to the `netsh wins' context.
The following subcontexts are available: aaaa dhcp diag interface ipsec ras routing rpc wins Home Network Auto configuration: home.cmd ip-home.txt home.cmd:@echo offecho. Echo * Ip switch By Jiang Jinping * echo. Echo is being set up as a home network IP, please wait a moment. . . & netsh-f c:/iphome.txtecho successfully set up and can now use the home network echo.echo * August 30, 2004 * echo. Pauseexitip-home.txt: #-# Interface IP configuration #-- pushd interface ip# "Local connection" interface IP configuration set address name= "Local connection" source=static addr=192.168.0.10 Mask=255.255.255.0set address name= "Local connection" gateway=192.168.0.1 gwmetric=0set dns name= "Local connection" source=static addr=211.99.129.210 register=NONEadd dns name= "Local connection" addr=211.99.129.211 index=2set wins name= "Local connection" source=static addr=nonepopd# interface IP configuration ends
Overview of Netsh
Netsh is a command-line scripting utility that allows the network configuration of a currently running computer to be displayed or modified locally or remotely. Netsh also provides a scripting feature that allows you to run a set of commands in batch mode for specified computers. To archive or configure other servers, Netsh can also save the configuration script in a text file.
No one would doubt the power of the netsh command, and experienced administrators will know it deeply; there have been many articles about the netsh command in the past, but today we take a look at the magic of the netsh command in another way.
The author manages two computer rooms in the school, each with 50 machines, each equipped with a restore card, and each restart system will automatically restore; pull an ADSL to access the Internet through ISA, and the school stipulates that the student account login can not access the Internet, while the teacher can access the Internet through his own account; the computer room is generally used by students in class during the day, and teachers are left to check the Internet at night.
It is really difficult to complete the tasks of the school. We all know that the control of access to the Internet is achieved through IP addresses in most cases (of course, with the support of AD, ISA can be controlled through accounts, which is beyond the scope of this article). That is to say, if the teacher wants to internet, he must change the IP address of the computer through the properties of network neighbors, about 100 machines. If I had to change it manually every day, it wouldn't kill me. If you let those rookie teachers change, you might as well kill me. I've been taught N times, but I still won't. Netsh has been a great help. Let's take a look at his magic.
Network environment: win2ks+isa2k as an Internet server
IP:192.168.0.1,subnetmask::255.255.255.0,DNS is the DNS IP:202.101.10.10 of ISP
Client all win2kpro IP:192.168.0.2---192.168.0.102 subnetmask:255.255.255.0 gateways and DNS are IP:192.168.0.1 of proxy server and are installed with ISA firewall client software.
By default, all clients cannot go to internet. The rule of ISA is to prohibit internet on the IP of 192.168.0.2Murray 192.168.0.102, and create another rule on ISA that allows internet on 192.168.0.103-192.168.0.203 (this is not the focus of this article. If necessary, you can check the relevant materials).
Now that netsh comes in handy, run CMD on our client PC18 to enter MS-DOS, enter
Netsh interface ip dump > c:pc1.txt
This command displays the current "locally connected" interface IP configuration and is saved in the pc1.txt text file
Let me check the c:pc1.txt file.
This shows the IP configuration of the current "locally connected" interface. Let's use the command ipconfig/all to see if the configuration of the current interface is the same as the pc1.txt file.
You can see that the two are the same. We open the PC1.TXT file, change the IP 192.168.0.18 of "set address name =" Local connection "source = static addr = 192.168.0.18" to 192.168.0.118, and then save it. Then, we create a new file with notepad and type netsh-f c:pc1.txt
Pay attention to the path of the file. We just put pc1.txt in the root directory of C disk, save it as ip.bat, and put it on the desktop of the teacher's account, and grant the teacher's account read and run permissions. Other accounts are prohibited.
. After the teacher logs in with his own account, double-click the ip.bat icon on the desktop, and we use ipconfig/all to see the results.
Show that the IP address has been changed to 192.168.0.118, other configurations have not changed, can be compared with figure 3. We know that the IP address of 192.168.0.103 Murray 192.168.0.203 is accessible to the Internet. In other words, if the teacher wants to surf the Internet, just double-click the IP.BAT file. The above settings are made on the PC18 machine. If we want to set them on another machine, we only change the IP address in the PC1.TXT file to the IP in the range of 192.168.0.103-192.168.0.203 (of course, make sure that the IP used is unique, so as to avoid IP conflicts), and then create a new ip.bat file with the same content, but pay attention to the path of the pc1.txt file. To supplement this point, the teacher account is the administrator group and the student account is the ordinary user group.
Through the above settings, we basically achieve our goal. When the teacher gets on the computer at night, as long as he double-clicks the ip.bat file on the desktop, the IP address will be changed to the IP of 192.168.0.103, 192.168.0.203, that is to say, the Internet can be accessed, and the computer will restart the next day. Because there is a restore card, the machine will be changed to the IP of 192.168.0.102. You can't surf the Internet. Through the command of netsh, we can feel his strength and save us some annoying things.
[@ more@] you can display the configuration script directly through the dump command in Netsh. The configuration script can be exported through netsh-c interface ip dump > c:interface.txt. Then you can export the exported configuration script back in the way of netsh-f c:interface.txt. Between coming and going, it is easy to modify the network configuration. There are many commands in Netsh, such as loading a configuration script with the exec command in the root directory after you can enter the netsh environment. In addition, the configuration of wins, routing, ras and other network services can also be operated directly through the built-in commands of Netsh.
The above is the editor for you to share how to analyze the powerful functions of netsh, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.