ubuntu 10.10永久路由表设置问题

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
liusunpan
帖子: 2
注册时间: 2010-12-07 21:33

ubuntu 10.10永久路由表设置问题

#1

帖子 liusunpan » 2011-01-09 11:33

每次重启电脑时候路由表就被恢复,网上说在/etc/rc.local 下添加,试过了不行.哪位朋友知道的请帮助下.
头像
sense
帖子: 308
注册时间: 2007-02-14 13:54

Re: ubuntu 10.10永久路由表设置问题

#2

帖子 sense » 2011-01-09 19:29

将设置路由的命令加在 /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永久路由表设置问题

#3

帖子 photor » 2011-01-09 19:36

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

:em09
liusunpan
帖子: 2
注册时间: 2010-12-07 21:33

Re: ubuntu 10.10永久路由表设置问题

#4

帖子 liusunpan » 2011-01-12 0:51

:em11 改日试下,先谢了
头像
Crazier
帖子: 1051
注册时间: 2007-09-23 17:06
联系:

Re: ubuntu 10.10永久路由表设置问题

#5

帖子 Crazier » 2011-02-23 17:01

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

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呢,不是到最后等于什么都没做吗?
回复