netsh常用命令
0.netsh介绍
netsh(Network Shell)是一个windows系统本身提供的功能强大的网络配置命令行工具 1.修改IP地址addr和子网掩码mask
netsh interface ip set address name="本地连接" source=static addr=192.168.0.106 mask=255.255.255.0 2.修改默认网关gateway
netsh interface ip set address name="本地连接" gateway=192.168.0.1 gwmetric=0 3.修改首选(PRIMARY)的DNS
netsh interface ip set dns name="本地连接" source=static addr=202.96.128.66 register=PRIMARY 4.禁用无线网卡
netsh interface set interface wlan0 disabled 5.启用无线网卡
netsh interface set interface wlan0 enabled 4.开启转发
netsh interface portproxy add v4tov4 listenaddress=192.168.1.127 listenport=8089 connectaddress=10.125.8.169 connectport=3306 5.删除转发
netsh interface portproxy delete v4tov4 listenaddress=192.168.1.127 listenport=8089 6.显示所有端口代理
netsh interface portproxy show all 7.判断一个端口是否开启
netstat -ano -p tcp | findstr "7778" >nul 2>nul && echo 7778端口已开启 || echo 7778端口未开启