Windows 单网卡配置多 IP 地址

可能需要的命令
1 允许同时开启DHCP和静态地址:
netsh int ipv4 set interface "Ethernet" dhcpstaticipcoexistence=enabled
2 添加一个新的IP地址和网关:
netsh interface ip add address "网卡名称" IP 掩码 网关
3 获取网络连接的名称?netsh interface ip show interfaces
4 删除网关:netsh interface ip delete address "Ethernet" gateway=192.168.1.1
注:(1)如果 gateway = all 则会删除所有网关
(2)删除IP和网关可以合并为一条命令:netsh interface ip delete address "Ethernet" address=192.168.1.11 gateway=192.168.1.1
常见流程
1 重置IP地址:netsh interface ip set address "Ethernet" static 192.168.1.10 255.255.255.0 192.168.1.1 0 # 最后的0表示跃点数是自动
2 添加IP地址:
netsh interface ip add address "Ethernet" 192.168.61.20 255.255.255.0 192.168.1.1
netsh interface ip add address "Ethernet" 192.168.1.11 255.255.255.0 # 如果要添加的IP的网关已存在,则可不用再注明网关
3 删除IP地址:netsh interface ip delete address "Ethernet" address=192.168.7.20




