network configuration windows command line

NetSH Network Configuration command-line tool

netsh (Network Shell) 是一个 windows 系统本身提供的功能强大的网络配置命令行工具。
导出配置脚本:netsh -c interface ip dump > c:\interface.txt
导入配置脚本:netsh -f c:\interface.txt。

netsh interface ip show address - the IP address
netsh interface ip show config - display more details
netsh interface ip show ipaddress - Displays the IP address type
netsh interface ip show ipnet - show the network to the media item
netsh interface ip show route - Displays the current routing information

netsh interface ip show interface - Display interface information
netsh interface ip set address "Ethernet" dhcp - Set IP address via DHCP
setting Ethernet IP address - netsh interface ip set address "Ethernet" static 10.1.2.10 255.255.255.0 10.1.2.254

netsh interface ip show dns - 显示 DNS 地址
netsh interface ip set dns "以太网" dhcp - 通过 DHCP 设置 DNS 地址
netsh interface ip set dns "以太网" static 10.0.12.8 - 设置以太网 DNS 地址,清除原有 DNS 设置
netsh interface ip add dns "以太网" 114.114.114.114 index=2 - 添加以太网 DNS 地址,index 为自定义排序
netsh interface ip add dns "以太网" 8.8.8.8 index=3 - 添加以太网 DNS 地址,index 为自定义排序
netsh interface ip add dns "以太网" 1.1.1.1 index=4 - 添加以太网 DNS 地址,index 为自定义排序
netsh interface ip add dns "以太网" 223.5.5.5 index=5 - 添加以太网 DNS 地址,index 为自定义排序

netsh -c interface dump> d: \ 1.txt export configuration to the D drive named 1.txt
the netsh -fd: \ 2.txt import configuration file named in 2.txt disk D

C:\Users\Administrator>netsh

abort - to discard the changes made in offline mode.
add - add a configuration item on the list of items.
advfirewall - Change to `netsh advfirewall 'context.
alias - add an alias
branchcache - change to `netsh branchcache 'context.
bridge - Change to `netsh bridge 'context.
bye - Exits the program.
commit - commit the changes made in offline mode.
delete - delete a configuration item on the list of items.
dhcpclient - Change to `netsh dhcpclient 'context.
dnsclient - Change to `netsh dnsclient 'context.
dump - Displays a configuration script.
exec - run a script file.
exit - exit the program.
firewall - to change the `netsh firewall 'context.
help - displays a list of commands.
http - Change to the `netsh http 'context.
interface - Change to `netsh interface 'context.
ipsec - Change to `netsh ipsec 'context.
lan - Change to `netsh lan 'context.
mbn - Change to `netsh mbn 'context.
namespace - Change to `netsh namespace 'context.
netio - Change to `netsh netio 'context.
offline - Sets the current mode to offline.
online - the current mode is set to online.
p2p - Change to `netsh p2p 'context.
popd - opens a context from the stack.
pushd - The current context on the stack.
quit - Exits the program.
ras - Change to `netsh ras' context.
rpc - Change to `netsh rpc 'context.
set - Updates configuration settings.
show - Displays information.
trace - Change to `netsh trace 'context.
unalias - delete an alias.
wcn - Change to `netsh wcn 'context.
wfp - Change to `netsh wfp 'context.
winhttp - Change to `netsh winhttp 'context.
winsock - Change to `netsh winsock 'context.
wlan - Change to `netsh wlan 'context.

>netsh winsock

audit - the display has been installed and removed Winsock LSP list.
dump - Displays a configuration script.
help - displays a list of commands.
remove - delete the Winsock LSP from the system.
reset - reset the Winsock catalog is cleared.
set - Sets Winsock options.
show - Displays information.

>netsh interface

6to4 - Change to `netsh interface 6to4 'context.
? - Displays a list of commands.
dump - Displays a configuration script.
help - displays a list of commands.
httpstunnel - Change to `netsh interface httpstunnel 'context.
ipv4 - Change to `netsh interface ipv4 'context.
ipv6 - Change to `netsh interface ipv6 'context.
isatap - Change to `netsh interface isatap 'context.
portproxy - Change to `netsh interface portproxy 'context.
set - Sets configuration information.
show - Displays information.
tcp - Change to `netsh interface tcp 'context.
teredo - Change to `netsh interface teredo 'context.

>netsh interface ipv4

add - Adds a configuration item in a table.
delete - delete a configuration item from a table.
dump - Displays a configuration script.
help - displays a list of commands.
install - Install IP protocol.
reset - resets IP configuration.
set - Sets configuration information.
show - Displays information.
uninstall - Uninstall IP protocol.

>netsh interface ipv4 set

set address - set the IP address leading to the interface or the default gateway.
set compartment - segment modify configuration parameters.
set dnsservers - set the DNS server mode and addresses.
set dynamicportrange - repair port assignment state change range of ports used.
set global - General Review global configuration parameters.
set interface - interface to modify the IP configuration parameters.
set neighbors - Setting neighbor address.
set route - modify route parameters.
set subinterface - Modify sub interface configuration parameters.
set winsservers - Setting WINS server mode and addresses.

>netsh interface ipv4 show

show addresses - Displays the IP address configuration.
show compartments - segment display parameters.
show config - Displays the IP address and other information.
show destinationcache - displays the target cache entries.
show dnsservers - Displays the DNS server address.
show dynamicportrange - display dynamic range port configuration parameters.
show excludedportrange - display all port ranges exclude.
show global - global configuration general parameters display.
show icmpstats - display ICMP statistics.
show interfaces - Display Interface parameters.
show ipaddresses - Displays the current IP address.
show ipnettomedia - Displays the IP network to the media mapping.
show ipstats - Displays the IP statistics.
show joins - Displays multicast group to join.
show neighbors - show neighbor cache entries.
show offload - displays the uninstall information.
show route - displays routing table entries.
show subinterfaces - sub-display interface parameters.
show tcpconnections - Display the TCP connection.
show tcpstats - display TCP statistics.
show udpconnections - display UDP connections.
show udpstats - display UDP statistics.
show winsservers - show WINS server addresses.

>netsh interface ipv4 add

add address - to add a static IP address or default gateway to the specified interface.
add dnsservers - add a static DNS server address.
add excludedportrange - continuous negative add port block.
add neighbors - neighbors add the address.
add route - add routes on the interface.
add winsservers - add a static WINS server address.

Guess you like

Origin www.cnblogs.com/jodyccf/p/12586741.html