千家信息网

利用netsh工具配置Windows系统TCP/IP

发表于:2025-12-01 作者:千家信息网编辑
千家信息网最后更新 2025年12月01日,在特定场合有时需要使用netsh工具配置Windows系统TCP/IP,下面简要说明常用配置命令。1.设置固定IP地址、子网掩码:netsh interface ip set address name
千家信息网最后更新 2025年12月01日利用netsh工具配置Windows系统TCP/IP

在特定场合有时需要使用netsh工具配置Windows系统TCP/IP,下面简要说明常用配置命令。

1.设置固定IP地址、子网掩码:

netsh interface ip set address name="本地连接"source=static addr=192.168.0.12 mask=255.255.255.0

2.设置默认网关:

netsh interface ip set address name="本地连接"gateway=192.168.0.254 gwmetric=0

3.设置首选DNS:

netsh interface ip set dns name="本地连接"source=static addr=192.168.0.1 register=primary

4.设置备用DNS:

netsh interface ip add dns name="本地连接"addr=114.114.114.114 index=2

5.设置WINS:

netsh interface ip set wins name="本地连接"source=static addr=none

6.设置自动获取IP地址:

netsh interface ip set address name="本地连接"source=dhcp

7.设置自动获取DNS地址:

netsh interface ip set dns name="本地连接"source=dhcp

8.导出导入配置:

导出TCP/IP配置:netsh -c interface ip dump > c:\tcpip.txt
导入TCP/IP配置:netsh -f c:\tcpip.txt

备注:

上述命令1,2可合并简写为:netsh interface ip set address "本地连接" static 192.168.0.12 255.255.255.0192.168.0.254 0

上述命令3可简写为:netshinterface ip set dns "本地连接" static 192.168.0.1 其它命令简写类似。

0