netsh int ip 添加/删除 TCP 协议 excludedportrange 的方法

本文参考Many excludedportranges how to delete - hyper-v is disabled
以管理员身份运行命令提示符,运行:

netsh int ip show excludedportrange protocol=tcp

查看当前协议为 TCP 的 excludedportrange 为:

协议 tcp 端口排除范围

开始端口 结束端口
---------- --------
80 80
1057 1156
1190 1289
1290 1389
1390 1489
1490 1589
1590 1689
2544 2643
2644 2743
2744 2843
2844 2943
2944 3043
3044 3143
3144 3243
3986 4085
4086 4185
4186 4285
4286 4385
6490 6589
6590 6689
6790 6889
6890 6989
12711 12810
12911 13010
13011 13110
13117 13216
13317 13416
13417 13516
13524 13623
13758 13857
13858 13957
14394 14493
14532 14631
14632 14731
14732 14831
14832 14931
50000 50059 *

* - 管理的端口排除。

执行

net stop winnat

停止 WinNAT 服务。这时协议为 TCP 的 excludedportrange 会被自动重置为 80 - 80 等范围。执行

netsh int ip add excludedportrange protocol=tcp numberofports=1 startport=3121
netsh int ip add excludedportrange protocol=tcp numberofports=3 startport=3001

添加范围 3121 - 3121 与 3001 - 3003。执行

netsh int ip reset

重置 IP Interface。重启计算机。此时查看当前协议为 TCP 的 excludedportrange 为:
img
可以看到我们需要的两段范围已标星号。执行

netsh int ip delete excludedportrange protocol=tcp numberofports=1 startport=3121
netsh int ip delete excludedportrange protocol=tcp numberofports=3 startport=3001

此时查看当前协议为 TCP 的 excludedportrange 为:
img
成功删除范围 3121 - 3121 与 3001 - 3003。

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Ayka

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值