ubuntu 10.10永久路由表设置问题
-
- 帖子: 2
- 注册时间: 2010-12-07 21:33
ubuntu 10.10永久路由表设置问题
每次重启电脑时候路由表就被恢复,网上说在/etc/rc.local 下添加,试过了不行.哪位朋友知道的请帮助下.
- sense
- 帖子: 308
- 注册时间: 2007-02-14 13:54
Re: ubuntu 10.10永久路由表设置问题
将设置路由的命令加在 /etc/rc.local 是可以的,或者可以加在 /etc/network/interfaces 中,例:
代码: 全选
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
up route add -net 172.16.0.0 netmask 255.240.0.0 gw 192.168.1.254
down route del -net 172.16.0.0 netmask 255.240.0.0
- photor
- 论坛版主
- 帖子: 11004
- 注册时间: 2008-04-26 12:41
Re: ubuntu 10.10永久路由表设置问题
sense 写了:将设置路由的命令加在 /etc/rc.local 是可以的,或者可以加在 /etc/network/interfaces 中,例:代码: 全选
iface eth0 inet static address 192.168.1.1 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 up route add -net 172.16.0.0 netmask 255.240.0.0 gw 192.168.1.254 down route del -net 172.16.0.0 netmask 255.240.0.0
-
- 帖子: 2
- 注册时间: 2010-12-07 21:33
Re: ubuntu 10.10永久路由表设置问题
改日试下,先谢了
- Crazier
- 帖子: 1051
- 注册时间: 2007-09-23 17:06
- 联系:
Re: ubuntu 10.10永久路由表设置问题
sense 写了:将设置路由的命令加在 /etc/rc.local 是可以的,或者可以加在 /etc/network/interfaces 中,例:代码: 全选
iface eth0 inet static address 192.168.1.1 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 up route add -net 172.16.0.0 netmask 255.240.0.0 gw 192.168.1.254 down route del -net 172.16.0.0 netmask 255.240.0.0
对同一个IP 172.16.0.0 ,为什么要先UP了之后,再down呢,不是到最后等于什么都没做吗?up route add -net 172.16.0.0 netmask 255.240.0.0 gw 192.168.1.254
down route del -net 172.16.0.0 netmask 255.240.0.0