OpenVswitch bonding

TurnToJPG -->


Before

Add 2 NICs, and show their ip infos via:

[root@localhost ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.47.58.207  netmask 255.255.255.0  broadcast 10.47.58.255
        inet6 fe80::5054:ff:feae:f2be  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:ae:f2:be  txqueuelen 1000  (Ethernet)
        RX packets 75  bytes 10924 (10.6 KiB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 15  bytes 1668 (1.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.47.58.135  netmask 255.255.255.0  broadcast 10.47.58.255
        inet6 fe80::5054:ff:fe56:8c2e  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:56:8c:2e  txqueuelen 1000  (Ethernet)
        RX packets 108  bytes 17136 (16.7 KiB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 47  bytes 6928 (6.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Install Openvswitch

Install/Configure ovs via:

# yum localinstall /home/ovs/rpmbuild/RPMS/x86_64/openvswitch-2.3.2-1.x86_64.rpm
# systemctl start openvswitch.service
# chkconfig openvswitch on
# ovs-vsctl -V
ovs-vsctl (Open vSwitch) 2.3.2 
Compiled Feb 23 2016 10:12:37
DB Schema 7.6.2

Configure Bonding

Add bridge and list the added bridge:

[root@localhost ~]# ovs-vsctl add-br br0 
[root@localhost ~]# ovs-vsctl list-br
br0                               
[root@localhost ~]# ovs-vsctl show
fb542c8e-968a-4dcf-b55f-934667abc7d3
    Bridge "br0"                  
        Port "br0"
            Interface "br0"
                type: internal
    ovs_version: "2.3.2"

Add bonding:

# ovs-vsctl add-bond br0 bond0 eth0 eth1

Or? ??

$ ovs-vsctl add-bond br0 bond0 eth1 eth0 bond_mode=balance-slb other_config:lacp-time=fast

Configure eth0/eth1/br0:

[root@localhost network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
# Generated by dracut initrd
DEVICE="eth0"
ONBOOT=yes
NETBOOT=yes
UUID="8dbd22bd-764d-48d0-b896-99ae358aebcc"
IPV6INIT=yes
BOOTPROTO="none"
TYPE=Ethernet
NAME="eth0"
[root@localhost network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
# Generated by dracut initrd
DEVICE="eth1"
ONBOOT=yes
NETBOOT=yes
IPV6INIT=yes
BOOTPROTO="none"
TYPE=Ethernet
NAME="eth1"
[root@localhost network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-br0
# Generated by dracut initrd
DEVICE="br0"
ONBOOT=yes
DEVICETYPE="ovs"
NETBOOT=yes
IPV6INIT=yes
BOOTPROTO=dhcp
TYPE="OVSBridge"
NAME="br0"

now restart the machine, you will get ovs bonding networking working.