LinuxSir.cn,穿越时空的Linuxsir!

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

WEB服务器使用网通,电信 双IP遇到的问题

[复制链接]
发表于 2005-8-27 19:00:58 | 显示全部楼层 |阅读模式
我申请了两个ip 一个是电信的,一个是网通的并分别由两条光线接入,

目的是为了让网通与电信的用户访问都快!

服务器有两快网卡 一个100M 一个 1000M 都是intel 的

在使用中出现了下面的情况,

开始我将2快网卡分别配置了2条线路上的IP 网通的走 100M 的网卡  电信的走 1000M 的网卡

结果在用其他的机器 tracert 其中一个IP 发现 该服务器与上一级之间的速度竟然为400多MS

如果服务器就配置一个IP 而不一起使用2个IP的话,速度就小与10

为什么一起使用2个IP 就变慢呢?

该如何解决?
发表于 2005-8-27 20:31:36 | 显示全部楼层
我在cu上看过类似你的问题,可以完美解决
你可以去cu论坛搜索下
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-8-27 21:24:48 | 显示全部楼层
我都找翻天了哦,就是没有找到!
指点个.......
回复 支持 反对

使用道具 举报

发表于 2005-8-28 00:31:50 | 显示全部楼层
不会用搜索吗?,在cu的linux版,搜索“网通 电信”可以出一堆文章,其中有你要的   
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-8-28 13:14:31 | 显示全部楼层
Post by meteoren
不会用搜索吗?,在cu的linux版,搜索“网通 电信”可以出一堆文章,其中有你要的   



终于在看了所有的与电信网通有关的贴,但都是讲双线代理的,帮帮我吧,大侠!
回复 支持 反对

使用道具 举报

发表于 2005-8-29 00:39:22 | 显示全部楼层
routing policy database Next

----------------------------------------------------------------------

4.2. Routing for multiple uplinks/providers
A common configuration is the following, in which there are two  
providers that connect a  local network (or even a single
machine) to the big Internet.
代码

                                          +------------+        /
                                          |            |       |
                            +-------------+ Provider 1 +-------
        __                  |             |            |     /
    ___/  _         +------+-------+     +------------+    |
  _/        __      |     if1      |                      /
/                  |              |                      |
| Local network -----+ Linux router |                      |  Internet
_           __/    |              |                      |
   __     __/       |     if2      |                     
      ___/          +------+-------+     +------------+    |
                            |             |            |     
                            +-------------+ Provider 2 +-------
                                          |            |       |
                                          +------------+        _____





There are usually two questions given this setup.

4.2.1. Split access
The first is how to route answers to packets coming in over a
particular provider, say Provider 1, back out again over that
same provider.

Let us first set some symbolical names. Let $IF1 be the name of
the first interface (if1 in the picture above) and $IF2 the name
of the second interface. Then let $IP1 be the IP address
associated with $IF1 and $IP2 the IP address associated with
$IF2. Next, let $P1 be the IP address of the gateway at Provider
1, and $P2 the IP address of the gateway at provider 2. Finally,
let $P1_NET be the IP network $P1 is in, and $P2_NET the IP
network $P2 is in.

One creates two additional routing tables, say T1 and T2. These
are added in /etc/iproute2/rt_tables. Then you set up routing in
these tables as follows:
代码

ip route add $P1_NET dev $IF1 src $IP1 table T1
ip route add default via $P1 table T1
ip route add $P2_NET dev $IF2 src $IP2 table T2
ip route add default via $P2 table T2



Nothing spectacular, just build a route to the gateway and build
a default route via that gateway, as you would do in the case of
a single upstream provider, but put the routes in a separate
table per provider. Note that the network route suffices, as it
tells you how to find any host in that network, which includes
the gateway, as specified above.

Next you set up the main routing table. It is a good idea to
route things to the direct neighbour through the interface
connected to that neighbour. Note the `src' arguments, they make
sure the right outgoing IP address is chosen.   

代码
           

ip route add $P1_NET dev $IF1 src $IP1
ip route add $P2_NET dev $IF2 src $IP2





Then, your  preference for default route:   

代码
            

ip route add default via $P1




Next, you set up the routing rules. These actually choose what
routing table to route with. You want to make sure that you
route out a given interface if you already have the  
corresponding source address:   

代码

ip rule add from $IP1 table T1
ip rule add from $IP2 table T2




This set of commands makes sure all answers to traffic coming in
on a particular interface get answered from that interface.

Now, this is just the very basic setup. It will work for all
processes running on the router itself, and for the local
network, if it is masqueraded. If it is not, then you either have
IP space from both providers or you are going to want to
masquerade to one of the two providers. In both cases you will
want to add rules selecting which provider to route out from
based on the IP address of the machine in the local network.

4.2.2. Load balancing
The second question is how to balance traffic going out over the
two providers. This is actually not hard if you already have set
up split access as above.

Instead of choosing one of the two providers as your default
route, you now set up the default route to be a multipath route.
In the default kernel this will balance routes over
the two providers. It is done as follows (once more building on
the example in the section on split-access):   
  
代码

ip route add default scope global nexthop via $P1 dev $IF1 weight 1 nexthop via $P2 dev $IF2 weight 1





This will balance the routes over both providers. The weight
parameters can be tweaked to favor one provider over the other.

Note that balancing will not be perfect, as it is route based,
and routes are cached. This means that routes to often-used
sites will always be over the same provider
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-8-29 15:49:53 | 显示全部楼层
T1 T2  添加到  /etc/iproute2/rt_tables 里,是什么格式?
回复 支持 反对

使用道具 举报

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

本版积分规则

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