netsh是windows自带的网络设置管理工具,不用额外的安装
查询当前网络连接的信息
netsh interface show interface
显示路由信息
netsh interface ip show route
禁用网络适配器
netsh interface set interface name="${接口名称}" admin=disabled
启用网络适配器
netsh interface set interface name="${接口名称}" admin=enable
端口转发
添加端口转发
// 这个命令的意思就是将本地的TCP流量从本地端口7777传递到远程11主机的80端口,
// add v4tov4就是添加要给ipv4的端口代理,listenport=7777就是监听本地7777端口,后面的就是连接的远程地址
netsh interface portproxy add v4tov4 listenport=7777 connectaddress=192.168.9.11 connectport=80
取消端口转发
netsh interface portproxy delete v4tov4 listenport=7777
查看现有的转发规则
netsh interface portproxy show all
清除所有转发规则
netsh interface portproxy reset
<<<<<<[完]>>>>>>