添加路由时如果想服务器重启时也能有效,则同时将命令写到/etc/rc.local中。但路由操作在linux和freebsd中是不一样的,区别如下:
linux:
以下是代码片段:
查看路由: /sbin/route 增加路由: /sbin/route add -host 172.16.78.226 gw 10.55.40.1 /sbin/route add -net 172.16.20.0/24 gw 10.55.40.1 删除路由 /sbin/route del -host 172.16.78.226 gw 10.55.40.1 /sbin/route del -net 172.16.20.0/24 gw 10.55.40.1
|
freebsd:
以下是代码片段:
查看路由: netstat -nr 增加路由 /sbin/route add -host 172.16.78.226 10.55.40.1 /sbin/route add -net 172.16.20.0/24 10.55.40.1 删除路由 /sbin/route delete -host 172.16.78.226 10.55.40.1 /sbin/route delete -net 172.16.20.0/24 10.55.40.1
|