LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 662|回复: 1

双网关问题(已经解决)

[复制链接]
发表于 2008-6-14 09:19:58 | 显示全部楼层 |阅读模式
一台电脑上面有一块网卡,ip地址为172.16.0.100可以通过路由器上网(网关为172.16.0.1),也可以通过Adsl上网(网关为172.16.0.4)。平时哪个快就用哪个,但是经常要通过172.16.0.1访问另外一个网段的一台主机10.1.1.1。现在的作法是:
route add default gw 172.16.0.4
route add -net 10.1.1.1 netmask 255.0.0.0 gw 172.16.0.1
这时网络变的很慢,怀疑是网关互相有冲突。改用下面的办法:
route add default gw 172.16.0.4
route add -host 10.1.1.1/8 eth0
居然可以解决。
想知道最后一条命令应该如何理解?已经man route
 楼主| 发表于 2008-6-18 17:34:11 | 显示全部楼层
看我的解决办法:
cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#allow-hotplug eth0
iface eth0 inet static
        address 10.11.56.220
        netmask 255.255.255.0
        network 10.11.56.0
        broadcast 10.11.56.255
        gateway 10.11.56.1
#       post-up ip route add 10.11.45.10/32 via 10.11.46.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 202.99.160.68


auto eth0:1
iface eth0:1 inet static
        address 10.11.46.220
        netmask 255.255.255.0
        network 10.11.46.0
        broadcast 10.11.46.255
        post-up ip route add 10.11.45.10/32 via 10.11.46.1
#       post-up ip route add 10.11.46.171/32 via 10.11.46.1
        dns-nameservers 202.99.160.68
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表