![NIC 绑定模式 6(balance-alb)仅使用一个 NIC](https://linux22.com/image/1101474/NIC%20%E7%BB%91%E5%AE%9A%E6%A8%A1%E5%BC%8F%206%EF%BC%88balance-alb%EF%BC%89%E4%BB%85%E4%BD%BF%E7%94%A8%E4%B8%80%E4%B8%AA%20NIC.png)
操作系统:Ubuntu 12.04LTS
bonding
/etc/modules
启动时自动加载
粘合配置有效bond-mode 0
,但无效bond-mode 6
--
系统启动时bond0
仅显示eth0
为从属
eth1
在 ifconfig 中根本无法启动,但可以启动ifconfig eth1 up
然而,即使它被养大了,它也不会被奴役bond0
尝试使用ifenslave bond0 eth1
结果Master 'bond0', Slave 'eth1': Error: Enslave failed
系统日志报告bonding: bond0: Error: dev_set_mac_address of dev eth1 failed!
但是,我可以使用ifconfig eth1 hw ether 123456789abc
在适配器上设置 mac 地址(适用于eth0
和eth1
)
bond0 Link encap:Ethernet HWaddr <mac address>
inet addr:10.3.0.1 Bcast:10.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::222:68ff:fe39:83c0/64 Scope:Link
UP BROADCAST MASTER MULTICAST MTU:1500 Metric:1
RX packets:10519 errors:0 dropped:0 overruns:0 frame:0
TX packets:9444 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2179485 (2.1 MB) TX bytes:1158406 (1.1 MB)
eth0 Link encap:Ethernet HWaddr 34:56:78:9a:bc:de <-- set using ifconfig
UP BROADCAST SLAVE MULTICAST MTU:1500 Metric:1
RX packets:10519 errors:0 dropped:0 overruns:0 frame:0
TX packets:9444 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2179485 (2.1 MB) TX bytes:1158406 (1.1 MB)
Interrupt:17
eth1 Link encap:Ethernet HWaddr 12:34:56:78:9a:bc <-- set using ifconfig
inet6 addr: fe80::1034:56ff:fe78:9abc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3417 errors:0 dropped:0 overruns:1 frame:0
TX packets:63 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:689886 (689.8 KB) TX bytes:28363 (28.3 KB)
Interrupt:20 Base address:0xe800
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:306 errors:0 dropped:0 overruns:0 frame:0
TX packets:306 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:76193 (76.1 KB) TX bytes:76193 (76.1 KB)
lo:1 Link encap:Local Loopback
inet addr:172.16.1.1 Mask:255.255.255.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
这是我的/etc/network/interfaces
:
auto lo lo:1 br0
iface lo inet loopback
auto he-ipv6
iface he-ipv6 inet6 v4tunnel
endpoint 209.51.161.14
address 2001:470:1f06:4ca::2
gateway 2001:470:1f06:4ca::1
netmask 64
local 10.3.0.1
up ip -6 route add default dev he-ipv6
down ip -6 route del default dev he-ipv6
iface lo:1 inet static
address 172.16.1.1
netmask 255.255.255.0
network 172.16.1.0
auto eth0
iface eth0 inet manual
bond-master bond0
auto eth1
iface eth1 inet manual
bond-master bond0
auto bond0
iface bond0 inet static
address 10.3.0.1
netmask 255.0.0.0
gateway 10.0.0.1
bond-mode 6
bond-miimon 100
bond-lacp-rate 1
bond-slaves none
ethtool ethX
输出:
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: No
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: pg
Wake-on: g
Current message level: 0x000000ff (255)
drv probe link timer ifdown ifup rx_err tx_err
Link detected: yes
Settings for eth1:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Link partner advertised pause frame use: Symmetric
Link partner advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 24
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: d
Current message level: 0x00000001 (1)
drv
Link detected: yes
答案1
我发现我必须添加:
bond-slaves eth0 eth1
到我的接口文件以使绑定在主动备份模式下工作(与 Ubuntu 文档网站上的说明相反......)
我现在正在尝试让一种更复杂(且更有用)的粘合模式(如平衡 alb)发挥作用......