我需要向 Solaris 10 框添加几个静态路由。在 Solaris 9 上,我总是通过添加 init 脚本来重新应用路由,使这些路由在重新启动后仍然有效。在 Solaris 10 中,向 SMF 添加服务似乎有些过头了。如何添加在重新启动后仍然有效的路由的最佳实践是什么?
答案1
该route
命令-p
在 OpenSolaris 中有该选项,我相信 Solaris 10 中也有。来自man route
:
-p Make changes to the network route tables per-
sistent across system restarts. The operation
is applied to the network routing tables
first and, if successful, is then applied to
the list of saved routes used at system
startup. In determining whether an operation
was successful, a failure to add a route that
already exists or to delete a route that is
not in the routing table is ignored. Particu-
lar care should be taken when using host or
network names in persistent routes, as
network-based name resolution services are
not available at the time routes are added at
startup.
我相信/etc/inet/static_routes
如果它们应用成功,它会将它们写入文件中。