Saturday, October 15, 2016

how to setup link aggregation on openvswitch

*** diagram

                               (eth2) --------- (eth2)
pc1 ----- (eth1) ovs1|                             | ovs2 (eth1) ------------pc2
                               (eth3) --------- (eth3)

ovs (openvswitch) is a software-based switch, so you can install it on your computer and trun in to a generic switch.

*** to test it on ritualized environment, use virtual and network type use udp tunnel, to setup like that follow the following line

1- since switch1 and switch2 have the same port structure, we execute the following command on both switch, ovs1 and ovs2

$ sudo apt-get install openvswitch-switch

- create a bridge called br0

$ sudo ovs-vsctl add-br br0

- add eth1 to bridge
$  sudo ovs-vsctl add-port br0 eth1

- create bonding port called bond0 to br0
$ sudo ovs-vsctl add-bond br0 bond0 eth2 eth3 lacp=active

- set bond mode on bond0
$ sudo ovs-vsctl set port bond0 lacp=active
$ sudo ovs-vsctl set port bond0 bond_mode=balance-tcp

2- bring up all network cards, if it is not yet bring it up
$ sudo ifconfig eth2 up 
$ sudo ifconfig eth3 up
$ sudo ifconfig eth4 up

3- show what we have done
-show bridge br0
$ sudo ovs-vsctl show
[sudo] password for ton:
    Bridge "br0"
        Port "br0"
            Interface "br0"
                type: internal
        Port "eth1"
            Interface "eth1"
        Port "bond0"
            Interface "eth3"
            Interface "eth2"
    ovs_version: "2.0.2"

-show bonding
$ sudo ovs-appctl bond/show bond0
---- bond0 ----
bond_mode: balance-tcp
bond-hash-basis: 0
updelay: 0 ms
downdelay: 0 ms
next rebalance: 2351 ms
lacp_status: negotiated

slave eth2: enabled
        may_enable: true
        hash 24: 0 kB load

slave eth3: enabled
        active slave
        may_enable: true
        hash 41: 1 kB load

- show mac address
$ sudo ovs-appctl fdb/show br0
 port  VLAN  MAC                Age
    1     0  08:00:27:96:54:b0    0
    3     0  08:00:27:d7:d3:be    0

 4- when you send/receive traffic across the switch it will balance the load on both interface,
-snapshot of iptraf and see the balance on both port eth2, eth3 (bond0)

No comments:

Post a Comment