Почему два сервера соединяют один и тот же сетевой адаптер, когда я использую соединение в Linux с mode = 6?

318
flypen

Я создаю связующий интерфейс с 3 сетевыми картами в CentOS6.3. Я использую режим = 6, который не нуждается в аппаратной поддержке коммутатора.

Вот файл склеивания:

[root@~]cat /proc/net/bonding/bond0  Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)  Bonding Mode: adaptive load balancing Primary Slave: None Currently Active Slave: eth3 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0  Slave Interface: eth1 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 1 Permanent HW addr: 00:e0:66:d3:70:b1 Slave queue ID: 0  Slave Interface: eth2 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 1 Permanent HW addr: 00:e0:66:d3:70:b2 Slave queue ID: 0  Slave Interface: eth3 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 1 Permanent HW addr: 00:e0:66:d3:70:b3 Slave queue ID: 0 

Я использую три сервера Windows для подключения IP-адреса. Теоретически, каждый сервер получит свой MAC-адрес. Например, Сервер 1 подключится к eth1, а Сервер 2 подключится к eth2, а Сервер 3 подключится к eth3. Тогда нагрузка будет сбалансирована.

Однако Сервер 1 подключается к eth2, а Сервер 2 подключается к eth3, но Сервер 3 снова подключается к eth2. eth1 никогда не используется. Я пытался много раз, но не получилось. Наконец, я вручную связываю IP-адрес и MAC-адрес, чтобы решить эту проблему.

Почему это происходит? Есть ли способ заставить каждый сетевой адаптер использоваться? Подключено только три сервера, поэтому теоретически каждый сервер должен подключаться к отдельной сетевой карте.

Большое спасибо!

0

1 ответ на вопрос

1
suprjami

You've made the assumption:

each server will get a different MAC address. For example, Server 1 will connect to eth1, and Server 2 will connect to eth2, and Server 3 will connect to eth3.

However that is not correct. As per the Linux kernel bonding documentation:

different peers use different hardware addresses

But not every peer will use a different hardware address.

The load balancing algorithm is based around a hash table, you need to use more than three hosts on the same broadcast domain to achieve equal load balancing across all slaves.

If you had a large number of hosts communicating with your bond, say tens or hundreds of hosts on the same broadcast domain, then the number of hosts would be fairly equal across all bond slaves.

For the sort of load balancing you're after, you might be better using Mode 2 or Mode 4 with xmit_hash_policy set to layer2+3 or layer3+4, however that will only do transmit load balancing, it would be up to the switch to provide similar inbound load balancing.

(Note: layer3+4 is not compatible with Mode 4, your switch may or may not complain if it is configured that way, try it and see)

Really, if you want your three Windows systems to communicate with your Linux system over different interfaces, then the only 100% reliable way to do this is to separate the interfaces at Layer 2 - have each of your eth1/eth2/eth3 in a different VLAN with a different IP, and the Windows systems each know the Linux system by that different IP.