转载连接: http://blog.csdn.net/quqi99 


linux有七种网卡绑定模式:


bond0:round-robin, 轮询。各接口轮流使用。需要交换机支持。交换机要配置成聚合口

bond1:active-backup, 主备。即只有一个接口在使用,当接口出现问题的时候再切换到别的接口

bond2:load balancing(xor), 根据数据的目的mac地址计算使用的端口。

bond3:broadcast, 所有数据在每个接口都复制一份

bond4:lacp, IEEE 802.3ad动态链路聚合。创建共享相同的速率和双工模式的聚合组。能根据802.3ad规范利用所有的slave来建立聚合链路。Salve的出站选择取决于传输的hash策略,默认策略是简单的XOR策略,而hash策略则可以通过xmit_hash_policy选项加以改变。

bond5:对外出流量负载均衡

bond6:通过修改ARP包实现负载均衡, 即对到来的arp请求依据一定策略使用不通过的arp进行回复


vi /etc/network/interfaces


auto bond0

iface bond0 inet manual

   bond-slaves eth2 eth1

   bond-miimon 100

   bond-mode 4

   bond-lacp-rate 1

   bond-xmit-hash-policy 2

   mtu 9000

auto eth2

iface eth2 inet manual

bond-master bond0

auto eth1

iface eth1 inet manual

bond-master bond0

auto bond0.1600

iface bond0.1600 inet static

   address 10.0.1.108

   netmask 255.255.255.0

   up ip route add 10.0.0.0/16 via 10.0.1.1 dev bond0.1600 || true


 


hua@node1:~$ cat /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+3 (2)

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0



802.3ad info

LACP rate: fast

Min links: 0

Aggregator selection policy (ad_select): stable


Slave Interface: eth1

MII Status: up

Speed: 100 Mbps

Duplex: full

Link Failure Count: 1

Permanent HW addr: 2c:53:4a:02:20:3c

Slave queue ID: 0

Aggregator ID: 1

Actor Churn State: none

Partner Churn State: churned

Actor Churned Count: 0

Partner Churned Count: 2


Slave Interface: eth2

MII Status: up

Speed: 100 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 2c:53:4a:02:20:3d  #若此处是00:00:00:00:00:00的话意味着交换机没配置LACP,这叫fallback模式,就像bond只有一个NIC一样影响性能,但合法

Slave queue ID: 0

Aggregator ID: 2

Actor Churn State: churned

Partner Churn State: churned

Actor Churned Count: 1

Partner Churned Count: 1


其他


这里的网口bond0被插到了br-bond0中,但在neutron中还有一个br-ex需要plug一个没有使用的网口,如果没有多余的网卡怎么样,可以这样(见: https://bugs.launchpad.net/charms/+source/neutron-openvswitch/+bug/1635067):


# create veth pair between br-bond0 and veth-tenant

ip l add name veth-br-bond0 type veth peer name veth-tenant


# set mtu if needed on veth interfaces and turn up

#ip l set dev veth-br-bond0 mtu 9000

#ip l set dev veth-tenant mtu 9000

ip l set dev veth-br-bond0 up

ip l set dev veth-tenant up


juju set neutron-openvswitch data-port="br-ex:veth-tenant"

————————————————

版权声明:本文为CSDN博主「quqi99」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/quqi99/article/details/51251210