在CentOS linux 下设置永久路由的办法

在CentOS linux 下设置永久路由的办法:
1、在路径 /etc/rc.local添加


内容:
rouet add 0net 172.0.0.0/8 dev eth0
route add -net 172.0.0.0/8 gw 172.10.0.2

route add -net 172.0.0.0 netmask 255.0.0.0 gw 172.10.0.2 dev eth0


2、在/etc/sysconfig/network 里添加,至末尾

办法:GATEWAY=gw-ip 或 GATEWAY=gw-dev


3、在/etc/sysconfig/static-routes 里添加

办法:
any net 172.0.0.0/8 gw 172.10.0.2
any net 172.0.0.0. netmask  255.0.0.0 gw 172.10.0.2

 

如果在rc.local 中添加路由可能会造成NFS 无法自动加载的问题出现,
所以使用static-routes的办法最为稳妥。

posted @ 2012-07-18 14:37  21人  阅读(834)  评论(0编辑  收藏  举报
无觅相关文章插件,快速提升流量