为linux添加永久路由
2008-05-21 16:40
246 查看
前几天放置在IDC 机房的服务器重起后莫名ping不通其他服务器了,检查发现路由因重启被清空~ 于是在网上去找添加永久路由的方法,找到了大众的2种做法:
1.cat /etc/rc3.d/S90route 并在该文件中添加route -nv add -net netip routeip这样每次机器
reboot的时候都会自动执行一次route -nv add -net netip routeip添加路由的操作。
2.首先/etc/init.d下面编辑文件 routefile(名称可以自己起),然后在vi routefile里面添加上
route add -net destination next-hop
(如:route add 目的地址 -netmask 目的地址的子网掩码 默认网关即下一跳地址)
然后再#chmod +X /etc/init.d/routefile使这个文件为可执行文件。
然后在/etc/init.d/下
#ln routefile /etc/rc2.d/S100route
#ln routefile /etc/rc0.d/K100route
#ls /etc/init.d /etc/rc2.d /etc/rc0.d(检查文件在否)
令系统启动以后也启动该路由。
在测试机上测试未通过,不知道原因,现找到一简单做法:
在/etc/rc.d
vi rc.local
在其中添加你所需的路由 如:route add -host 10.1.1.5 gw 17.16.16.1
保存后退出.
重启电脑即可.本文出自 “小白” 博客,谢绝转载!
1.cat /etc/rc3.d/S90route 并在该文件中添加route -nv add -net netip routeip这样每次机器
reboot的时候都会自动执行一次route -nv add -net netip routeip添加路由的操作。
2.首先/etc/init.d下面编辑文件 routefile(名称可以自己起),然后在vi routefile里面添加上
route add -net destination next-hop
(如:route add 目的地址 -netmask 目的地址的子网掩码 默认网关即下一跳地址)
然后再#chmod +X /etc/init.d/routefile使这个文件为可执行文件。
然后在/etc/init.d/下
#ln routefile /etc/rc2.d/S100route
#ln routefile /etc/rc0.d/K100route
#ls /etc/init.d /etc/rc2.d /etc/rc0.d(检查文件在否)
令系统启动以后也启动该路由。
在测试机上测试未通过,不知道原因,现找到一简单做法:
在/etc/rc.d
vi rc.local
在其中添加你所需的路由 如:route add -host 10.1.1.5 gw 17.16.16.1
保存后退出.
重启电脑即可.本文出自 “小白” 博客,谢绝转载!
相关文章推荐
- Linux:添加永久路由
- Linux多个网卡怎么添加永久路由?
- linux 添加永久ip、路由和开启路由功能
- Linux下添加永久路由
- linux系统添加永久路由的几种方法
- linux 添加永久路由
- linux小技巧——添加永久生效的路由
- linux 添加永久路由的几种方法。
- linux下添加永久路由
- Linux添加永久静态路由信息
- 关于linux的添加永久静态路由的static-routes方法
- linux 添加路由
- linux路由添加
- Linux添加路由的两种方法
- linux 下添加 路由
- linux和windows如何添加路由
- linux添加路由
- Linux下route add 命令添加路由列表
- Linux 添加路由
- Linux 添加分区、文件系统和永久挂载