macos添加静态路由
1、添加基于网络接口的路由
wahaha@wahahadeMacBook-Pro ~ % sudo route add -host 172.30.30.30 -iface lo0
wahaha@wahahadeMacBook-Pro ~ % sudo route add -net 172.30.30.0/24 -iface lo0
2、添加基于网关的路由
wahaha@wahahadeMacBook-Pro ~ % sudo route add -net 172.30.30.0/24 192.168.1.1
wahaha@wahahadeMacBook-Pro ~ % sudo route add -host 172.30.30.30 172.30.30.254
3、删除静态路由
wahaha@wahahadeMacBook-Pro ~ % sudo route delete 172.30.30.0/24
wahaha@wahahadeMacBook-Pro ~ % sudo route delete 172.30.30.30
4、查看路由表
wahaha@wahahadeMacBook-Pro ~ % netstat -rn