码迷,mamicode.com
首页 > Windows程序 > 详细

windows的网络配置命令行

时间:2020-03-28 13:03:13      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:表格   title   ali   配置文件   导入   显示   列表   dex   wlan   

NetSH 网络配置命令行工具

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

netsh interface ip show address - 显示 IP 地址
netsh interface ip show config - 显示更多详情
netsh interface ip show ipaddress - 显示 IP 地址类型
netsh interface ip show ipnet - 显示网络到媒体项目
netsh interface ip show route - 显示当前路由信息

netsh interface ip show interface - 显示接口信息
netsh interface ip set address "以太网" dhcp - 通过 DHCP 设置 IP 地址
netsh interface ip set address "以太网" static 10.1.2.10 255.255.255.0 10.1.2.254 - 设置以太网 IP 地址

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 导出配置到 D 盘并命名为 1.txt
netsh -f d:\2.txt 导入在 D 盘命名为 2.txt 的配置文件

C:\Users\Administrator>netsh

abort – 丢弃在脱机模式下所做的更改。
add – 在项目列表上添加一个配置项目。
advfirewall – 更改到 `netsh advfirewall’ 上下文。
alias – 添加一个别名
branchcache – 更改到 `netsh branchcache’ 上下文。
bridge – 更改到 `netsh bridge’ 上下文。
bye – 退出程序。
commit – 提交在脱机模式中所做的更改。
delete – 在项目列表上删除一个配置项目。
dhcpclient – 更改到 `netsh dhcpclient’ 上下文。
dnsclient – 更改到 `netsh dnsclient’ 上下文。
dump – 显示一个配置脚本。
exec – 运行一个脚本文件。
exit – 退出程序。
firewall – 更改到 `netsh firewall’ 上下文。
help – 显示命令列表。
http – 更改到 `netsh http’ 上下文。
interface – 更改到 `netsh interface’ 上下文。
ipsec – 更改到 `netsh ipsec’ 上下文。
lan – 更改到 `netsh lan’ 上下文。
mbn – 更改到 `netsh mbn’ 上下文。
namespace – 更改到 `netsh namespace’ 上下文。
netio – 更改到 `netsh netio’ 上下文。
offline – 将当前模式设置成脱机。
online – 将当前模式设置成联机。
p2p – 更改到 `netsh p2p’ 上下文。
popd – 从堆栈上打开一个上下文。
pushd – 将当前上下文放入堆栈。
quit – 退出程序。
ras – 更改到 `netsh ras’ 上下文。
rpc – 更改到 `netsh rpc’ 上下文。
set – 更新配置设置。
show – 显示信息。
trace – 更改到 `netsh trace’ 上下文。
unalias – 删除一个别名。
wcn – 更改到 `netsh wcn’ 上下文。
wfp – 更改到 `netsh wfp’ 上下文。
winhttp – 更改到 `netsh winhttp’ 上下文。
winsock – 更改到 `netsh winsock’ 上下文。
wlan – 更改到 `netsh wlan’ 上下文。

>netsh winsock

audit – 显示已经安装和删除的 Winsock LSP 列表。
dump – 显示一个配置脚本。
help – 显示命令列表。
remove – 从系统中删除 Winsock LSP。
reset – 重置 Winsock 目录为清除状态。
set – 设置 Winsock 选项。
show – 显示信息。

>netsh interface

6to4 – 更改到 `netsh interface 6to4′ 上下文。
? – 显示命令列表。
dump – 显示一个配置脚本。
help – 显示命令列表。
httpstunnel – 更改到 `netsh interface httpstunnel’ 上下文。
ipv4 – 更改到 `netsh interface ipv4′ 上下文。
ipv6 – 更改到 `netsh interface ipv6′ 上下文。
isatap – 更改到 `netsh interface isatap’ 上下文。
portproxy – 更改到 `netsh interface portproxy’ 上下文。
set – 设置配置信息。
show – 显示信息。
tcp – 更改到 `netsh interface tcp’ 上下文。
teredo – 更改到 `netsh interface teredo’ 上下文。

>netsh interface ipv4

add – 在一个表格中添加一个配置项。
delete – 从一个表格中删除一个配置项。
dump – 显示一个配置脚本。
help – 显示命令列表。
install – 安装 IP 协议。
reset – 重置 IP 配置。
set – 设置配置信息。
show – 显示信息。
uninstall – 卸载 IP 协议。

>netsh interface ipv4 set

set address – 设定通向接口的 IP 地址或默认网关。
set compartment – 修改分段配置参数。
set dnsservers – 设置 DNS 服务器模式和地址。
set dynamicportrange – 修更改态端口分配所使用端口的范围。
set global – 修改全局配置常规参数。
set interface – 修改 IP 的接口配置参数。
set neighbors – 设置邻居地址。
set route – 修改路由参数。
set subinterface – 修改子接口配置参数。
set winsservers – 设置 WINS 服务器模式和地址。

>netsh interface ipv4 show

show addresses – 显示 IP 地址配置。
show compartments – 显示分段参数。
show config – 显示 IP 地址和其他信息。
show destinationcache – 显示目标缓存项目。
show dnsservers – 显示 DNS 服务器地址。
show dynamicportrange – 显示动态端口范围配置参数。
show excludedportrange – 显示所有排除的端口范围。
show global – 显示全局配置普通参数。
show icmpstats – 显示 ICMP 统计。
show interfaces – 显示接口参数。
show ipaddresses – 显示当前 IP 地址。
show ipnettomedia – 显示 IP 的网络到媒体的映射。
show ipstats – 显示 IP 统计。
show joins – 显示加入的多播组。
show neighbors – 显示邻居缓存项。
show offload – 显示卸载信息。
show route – 显示路由表项目。
show subinterfaces – 显示子接口参数。
show tcpconnections – 显示 TCP 连接。
show tcpstats – 显示 TCP 统计。
show udpconnections – 显示 UDP 连接。
show udpstats – 显示 UDP 统计。
show winsservers – 显示 WINS 服务器地址。

>netsh interface ipv4 add

add address – 将静态 IP 地址或默认网关添加到指定接口。
add dnsservers – 添加一个静态 DNS 服务器地址。
add excludedportrange – 为连续的端口块添加排除。
add neighbors – 添加邻居地址。
add route – 在接口上添加路由。
add winsservers – 添加一个静态 WINS 服务器地址。

windows的网络配置命令行

标签:表格   title   ali   配置文件   导入   显示   列表   dex   wlan   

原文地址:https://www.cnblogs.com/jodyccf/p/12586741.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!