YggdrasillNetwork Blog

A blogging framework for hackers.

Openvswitch で Bonding

目的

OpenvSwithc 環境下で bonding を設定する

設定

1
# ovs-vsctl add-bond br0 bond0 eth0 eth1

※ 作成時に bond0 が存在しているとエラーになる

1
2
3
4
5
6
7
8
9
10
# ovs-vsctl show
49f85a35-e17c-4165-9bf9-e8476698908e
    Bridge "br0"
        Port "br0"
            Interface "br0"
                type: internal
        Port "bond0"
            Interface "eth0"
            Interface "eth1"
    ovs_version: "2.1.3"

eth0 を固定で slave, eth1 を backup slave みたく固定で設定する方法がよくわからない…

Memo

bond 設定確認コマンド

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# ovs-appctl bond/show bond0

---- bond0 ----
bond_mode: active-backup
bond-hash-basis: 0
updelay: 0 ms
downdelay: 0 ms
lacp_status: off

slave eth0: disabled
  may_enable: false

slave eth1: disabled
  may_enable: false

bond 状態確認コマンド

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# ovs-vsctl list port bond0

_uuid               : 79edb982-fe2a-4dfb-a078-38465aff870a
bond_downdelay      : 0
bond_fake_iface     : false
bond_mode           : []
bond_updelay        : 0
external_ids        : {}
fake_bridge         : false
interfaces          : [967407dc-f13f-4fa1-a9f7-fe720bb49512, 9e5e6bce-3d45-48ea-96b6-09017c517aa5]
lacp                : []
mac                 : []
name                : "bond0"
other_config        : {}
qos                 : []
statistics          : {}
status              : {}
tag                 : []
trunks              : []
vlan_mode           : []

port の削除

1
2
# ovs-vsctl del-port bond0
# ovs-vsctl del-port eth2

man ページ

1
# man 5 ovs-vswitchd.conf.db

雑記

1
2
3
4
5
# ovs-vsctl add-bond br0 bond0 eth1 eth2 bond_mode=balance-slb other_config:bond-detect-mode=miimon other_config:bond-miimon-interval=100 other_config:trunks=1,2,3,4,5,8,12,13,10,11 other_config:bond_updelay=100 other_config:lacp-time=fast

# ovs-vsctl set interface eth1 other-config:enable-vlan-splinters=true

# ovs-vsctl set interface eth2 other-config:enable-vlan-splinters=true
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# network interface settings
auto lo
iface lo inet loopback


auto eth1
iface eth1 inet manual


auto eth0
iface eth0 inet manual


allow-vmbr1 bond0
iface bond0 inet manual
        ovs_type OVSBond
        ovs_bridge vmbr1
        ovs_bonds eth0 eth1
        ovs_options bond_mode=active-backup




auto vmbr1
iface vmbr1 inet static
        address  192.168.0.22
        netmask  255.255.255.0
        gateway  192.168.0.1
        ovs_type OVSBridge
        ovs_ports bond0

[root@kvm2 ~]# ovs-vsctl add-bond br2 bond2 eth2 eth5 ovs-vsctl: cannot create an interface named eth2 because a port named eth2 already exists on bridge br2

1
2
3
4
5
6
7
8
9
[root@kvm2 network-scripts]# cat ifcfg-bond2 
DEVICE=bond2
ONBOOT=yes
DEVICETYPE=ovs
TYPE=OVSBond
OVS_BRIDGE=br2
BOOTPROTO=none
BOND_IFACES="eth2 eth5"
HOTPLUG=no
1
2
3
4
5
6
7
8
[root@kvm2 network-scripts]# cat ifcfg-eth2 
DEVICE=eth2
HWADDR=40:A8:F0:39:7B:AE
UUID=98cc7079-2517-4a15-ae0e-ca021d2a3f47
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
HOTPLUG=no
1
2
3
4
5
6
7
[root@kvm2 network-scripts]# cat ifcfg-br1 
DEVICE=br1
ONBOOT=yes
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=none
HOTPLUG=no

普通の ovs 設定と同じ

eth1 Link Down 時

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@kvm2 ~]# ovs-appctl bond/show bond1
---- bond1 ----
bond_mode: active-backup
bond-hash-basis: 0
updelay: 0 ms
downdelay: 0 ms
lacp_status: off

slave eth1: disabled
  may_enable: false

slave eth6: enabled
  active slave
  may_enable: true

eth1 Link Up 時

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@kvm2 ~]# ovs-appctl bond/show bond1
---- bond1 ----
bond_mode: active-backup
bond-hash-basis: 0
updelay: 0 ms
downdelay: 0 ms
lacp_status: off

slave eth1: enabled
  may_enable: true

slave eth6: enabled
  active slave
  may_enable: true

openvswitch 2.1.3 と 2.3.1 の違い

  • 2.1.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# ovs-appctl bond/show bond3
---- bond3 ----
bond_mode: active-backup
bond-hash-basis: 0
updelay: 0 ms
downdelay: 0 ms
lacp_status: off

slave eth3: enabled
  active slave
  may_enable: true

slave eth4: enabled
  may_enable: true
  • 2.3.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# ovs-appctl bond/show bond3
---- bond3 ----
bond_mode: active-backup
bond may use recirculation: no, Recirc-ID : -1
bond-hash-basis: 0
updelay: 0 ms
downdelay: 0 ms
lacp_status: off
active slave mac: fc:15:b4:28:86:93(eno4)

slave eno4: enabled
  active slave
  may_enable: true

slave ens2f3: enabled
  may_enable: true

参照 URL