macOS Windows添加静态路由

mac route命令同时访问内外网
sudo route -n add -net 192.168.0.0 -netmask 255.255.255.0 192.168.5.254
sudo route -n add -net 192.168.3.0 -netmask 255.255.255.0 192.168.5.254
sudo route -n add -net 192.168.2.0 -netmask 255.255.255.0 192.168.5.254

 

Windows route命令同时访问内外网
route add -p 192.168.3.0 mask 255.255.255.0 192.168.5.254
route add -p 192.168.0.0 mask 255.255.255.0 192.168.5.254
route add -p 192.168.2.0 mask 255.255.255.0 192.168.5.254

 

Windows批处理添加静态路由命令:

@echo off
cd /d %~dp0
%1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit
for /f %%i in (d:\out.txt) do echo %%i
ipconfig
for /f "tokens=2 delims=:" %%i in ('ipconfig^|findstr /i "172.18 "')do set ip=%%i        #查找本地网卡有 172.18.*.* 地址的物理网卡
route add 120.53.128.23 mask 255.255.255.255 %ip% -p       #添加静态路由,并将下一跳ip地址配置为上条命令查找的 172.18.*.* 
echo %ip%
pause

 

posted @ 2022-01-07 20:35  凡是過往;皆為序章  阅读(409)  评论(0编辑  收藏  举报