Win+r
Cmd
Route-f #首先清本机路由
Netsh #准备设置
Interface #进入接口模式
IP #进入ipv4设置
Add address "Local Area Connection 2" 172.16.168.44 255.255.0.0 gateway 172.16.168.2 gwmetric 1 #指定设备并对其设置ip, routing
Add DNS "Local Area Connection 2" 8.8.4.4 index=1 #指定设备并对其设置首选dns
Add DNS "Local Area Connection 2" 202.106.46.151 index=2 #指定设备并对其设置备用dns
In Netsh, return to the previous level as input:
The whole company can omit gateway and gwmetric, so write
netsh interface ip add address "Local Area Connection 2" 172.16.168.44 255.255.0.0 172.16.168.2 1
corresponding to "command, interface, IP protocol, add address, interface name, IP, mask, gateway, PATH spending metric value"
DNS settings can also be joined together into a netsh interface ip add DNS "Local Area Connection 2" 8.8.4.4 index=1
Note the quotation marks around "Local Area Connection 2" are half-width
The default route can also be set using the route add 0.0.0.0 mask 0.0.0.0 172.16.168.2 if XXX. where xxx is the device number shown in a Device interface table that you see after you route print, such as 0x2