linux多网卡拨号叠加带宽
发布网友
发布时间:2022-04-22 23:38
我来回答
共1个回答
热心网友
时间:2023-07-15 15:43
首先,需要先明确,绑定的各种模式
0 - Sets a round-robin policy for fault tolerance and load balancing. Transmissions are received and sent out sequentially on each bonded slave interface beginning with the first one available.
1 - Sets an active-backup policy for fault tolerance. Transmissions are received and sent out via the first available bonded slave interface. Another bonded slave interface is only used if the active bonded slave interface fails.
2 - Sets an XOR (exclusive-or) policy for fault tolerance and load balancing. Using this method, the interface matches up the incoming request's MAC address with the MAC address for one of the slave NICs. Once this link is established, transmissions are sent out sequentially beginning with the first available interface.
3 - Sets a broadcast policy for fault tolerance. All transmissions are sent on all slave interfaces.
4 - Sets an IEEE 802.3ad dynamic link aggregation policy. Creates aggregation groups that share the same speed and plex settings. Transmits and receives on all slaves in the active aggregator. Requires a switch that is 802.3ad compliant.
5 - Sets a Transmit Load Balancing (TLB) policy for fault tolerance and load balancing. The outgoing traffic is distributed according to the current load on each slave interface. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed slave.
6 - Sets an Active Load Balancing (ALB) policy for fault tolerance and load balancing. Includes transmit and receive load balancing for IPV4 traffic. Receive load balancing is achieved through ARP negotiation.
需要注意的是MODE 0仅仅能实现网卡轮询,但同一时间只有一个网卡生效,总体带宽还是1个网卡的带宽。
这里,我们需要开启交换机的802.3ad,并设置mode=4来实现带宽增倍
注意,在上面这个BLOG里的mode需要改一下:
vi /etc/modprobe.conf
alias bond0 bonding
options bond0 miimon=100 mode=4 lacp_rate=1
我们用iperf工具来测试带宽,由于mode 4模式使用mac地址分配那个网卡参与工作,因此,需要多台测试机进行测试
10.199.81.39作为server,10.199.81.40及10.199.81.42作为client,如果两个client均能达到1000Mbits,那也就意味着带宽是翻倍了。
server:
# iperf -s -w 1M
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 2.00 MByte (WARNING: requested 1.00 MByte)
------------------------------------------------------------
[ 4] local 10.199.81.39 port 5001 connected with 10.199.81.40 port 9951
[ 5] local 10.199.81.39 port 5001 connected with 10.199.81.42 port 61211
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-100.0 sec 11.1 GBytes 949 Mbits/sec
[ 5] 0.0-100.0 sec 11.1 GBytes 949 Mbits/sec
达到了带宽翻倍的目的