![绑定:仅适用于下载](https://linux22.com/image/599370/%E7%BB%91%E5%AE%9A%EF%BC%9A%E4%BB%85%E9%80%82%E7%94%A8%E4%BA%8E%E4%B8%8B%E8%BD%BD.png)
我想安装具有 4 个链接和模式 4 的绑定。但只有“下载/接收”与绑定一起工作。对于传输,系统选择一个链接。
是否配置
bond0 Link encap:Ethernet HWaddr 90:E2:BA:0F:76:B4
inet addr:ip Bcast:ip Mask:255.255.255.248
inet6 addr: fe80::92e2:baff:fe0f:76b4/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:239187413 errors:0 dropped:10944 overruns:0 frame:0
TX packets:536902370 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:14688536197 (13.6 GiB) TX bytes:799521192901 (744.6 GiB)
eth2 Link encap:Ethernet HWaddr 90:E2:BA:0F:76:B4
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:54969488 errors:0 dropped:0 overruns:0 frame:0
TX packets:2537 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3374778591 (3.1 GiB) TX bytes:314290 (306.9 KiB)
eth3 Link encap:Ethernet HWaddr 90:E2:BA:0F:76:B4
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:64935805 errors:0 dropped:1 overruns:0 frame:0
TX packets:2532 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3993499746 (3.7 GiB) TX bytes:313968 (306.6 KiB)
eth4 Link encap:Ethernet HWaddr 90:E2:BA:0F:76:B4
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:57352105 errors:0 dropped:2 overruns:0 frame:0
TX packets:536894778 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3524236530 (3.2 GiB) TX bytes:799520265627 (744.6 GiB)
eth5 Link encap:Ethernet HWaddr 90:E2:BA:0F:76:B4
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:61930025 errors:0 dropped:3 overruns:0 frame:0
TX packets:2540 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3796021948 (3.5 GiB) TX bytes:314274 (306.9 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:62 errors:0 dropped:0 overruns:0 frame:0
TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5320 (5.1 KiB) TX bytes:5320 (5.1 KiB)
这些是我的配置:
DEVICE="eth2"
BOOTPROTO="none"
MASTER=bond0
SLAVE=yes
USERCTL=no
NM_CONTROLLED="no"
ONBOOT="yes"
DEVICE="eth3"
BOOTPROTO="none"
MASTER=bond0
SLAVE=yes
USERCTL=no
NM_CONTROLLED="no"
ONBOOT="yes"
DEVICE="eth4"
BOOTPROTO="none"
MASTER=bond0
SLAVE=yes
USERCTL=no
NM_CONTROLLED="no"
ONBOOT="yes"
DEVICE="eth5"
BOOTPROTO="none"
MASTER=bond0
SLAVE=yes
USERCTL=no
NM_CONTROLLED="no"
ONBOOT="yes"
DEVICE=bond0
IPADDR=<ip>
BROADCAST=<ip>
NETWORK=<ip>
GATEWAY=<ip>
NETMASK=<ip>
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
猫/ proc / net / bonding / bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
802.3ad info
LACP rate: slow
Aggregator selection policy (ad_select): stable
Active Aggregator Info:
Aggregator ID: 1
Number of ports: 4
Actor Key: 17
Partner Key: 11
Partner Mac Address: 00:24:51:12:63:00
Slave Interface: eth2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 90:e2:ba:0f:76:b4
Aggregator ID: 1
Slave queue ID: 0
Slave Interface: eth3
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 90:e2:ba:0f:76:b5
Aggregator ID: 1
Slave queue ID: 0
Slave Interface: eth4
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 90:e2:ba:0f:76:b6
Aggregator ID: 1
Slave queue ID: 0
Slave Interface: eth5
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 90:e2:ba:0f:76:b7
Aggregator ID: 1
Slave queue ID: 0
/etc/modprobe.d/bonding.conf
alias bond0 bonding
options bond0 mode=4 miimon=100 updelay=200
#downdelay=200 xmit_hash_policy=layer3+4 lacp_rate=1
Linux:
Linux 3.0.0+ #1 SMP Fri Oct 26 07:55:47 EEST 2012 x86_64 x86_64 x86_64 GNU/Linux
我尝试过的:
downdelay=200 xmit_hash_policy=layer3+4 lacp_rate=1
mode 6
答案1
在开始调试绑定配置之前,您是否已验证每个网络链路是否可以单独正常工作?如果关闭 eth4 ( ifdown eth4
) 后没有任何反应,则很可能是您的线路存在问题。
另外,您可能应该先尝试一些更简单的绑定模式。尝试 balance-rr ( mode=0
) 并查看是否可以看到所有接口上的流量。还要查看/proc/net/bonding/bond0
以验证配置的当前状态。
答案2
您应该阅读此文档: Linux 绑定
答案3
http://wiki.mikrotik.com/wiki/Manual:Interface/Bonding说:
LACP 根据散列协议头信息在活动端口之间平衡传出流量,并接受来自任何活动端口的传入流量。 [...] 如何计算哈希取决于 transmission-hash-policy 参数。
传输哈希策略:layer-2 - 使用硬件 MAC 地址的 XOR 来生成哈希。此算法会将所有流量放在同一从属设备上的特定网络对等端。
因此,如果你bond0
只向一个目的地传输数据,也就是单身的MAC 地址,所有帧都只从您的一个接口发出。这是预期行为。如果您要转移到其他 MAC,则哈希算法很可能会从您的 4 个接口中选择 3 个其他接口之一(确切的几率为 75%)。这确保了帧的交付顺序。
PS:如果你的传输经过网关(路由器),这也算作单 MAC 传输。这是一种很常见的情况。