IP config with netsh under windows

rgqancy發表於2015-07-27

=================================================

CHINAUNICOME.bat

route delete 0.0.0.0 mask 0.0.0.0 10.125.22.254
REM (刪除內網閘道器)

route change 0.0.0.0 mask 0.0.0.0 111.195.179.64 metric 2
REM (改變預設外網閘道器優先權為2,111.195.179.64為外網分配的ip地址)

route add 10.0.0.0 mask 255.0.0.0 10.125.22.254 metric 1
REM (新增內網路由點,且優先權設定為1)

 

=================================================

rem MAC 18-A9-05-87-0A-71
ipconfig /all >ipconfig.log
netsh interface ip set address "本地連線" static 10.118.48.84 255.255.255.0 10.118.48.254 1
netsh interface ip set dns "本地連線" static 10.118.1.1 primary
netsh interface ip add dns "本地連線" 10.118.5.1
ipconfig /all

 

=================================================

rem Local Area Connection
ipconfig /all >ipconfig.log
netsh interface ip set address "本地連線" static 10.120.20.251 255.255.255.0 10.120.20.254 1
ipconfig /all

 

=================================================

rem Local Area Connection
ipconfig /all >ipconfig.log
netsh interface ip set address "本地連線" static 10.125.22.170 255.0.0.0 10.125.22.254 1
netsh interface ip set dns "本地連線" static 219.141.136.10 primary
netsh interface ip add dns "本地連線" 8.8.8.8
ipconfig /all

 

=================================================

自動.bat

rem Local Area Connection
ipconfig /all >ipconfig.log
netsh interface ip set address "本地連線" source=dhcp
netsh interface ip set dns "本地連線" source=dhcp
rem ipconfig /all

 

相關文章