Sunday, October 16, 2016

enable stp (spanning tree protocol) on openvswitch

*** diagram


                               |(eth1)   ovs1   (eth2)|
                               |                                |
                             (eth3)                      (eth3)
client1--------(eth1) ovs2(eth2) ----- (eth2)ovs3(eth1) -----

                     
1- install openvswitch on  all openvswitch machine
$ sudo apt-get install openvswitch-switch

*** ovs2 and ovs3
- add bridge br0
$ sudo ovs-vsctl add-br br0

- add all port to br0
$ sudo ovs-vsctl add-port br0 eth1
$ sudo ovs-vsctl add-port br0 eth2 
$ sudo ovs-vsctl add-port br0 eth3

- enable stp
$ sudo ovs-vsctl set Bridge br0 stp_enable=true 

-bring up all interfacese
$ sudo ifconfig eth1 up
$ sudo ifconfig eth2 up
$ sudo ifconfig eth3 up


*** ovs1
- add bridge br0
$ sudo ovs-vsctl add-br br0

- add all port to br0
$ sudo ovs-vsctl add-port br0 eth1
$ sudo ovs-vsctl add-port br0 eth2 


- enable stp
$ sudo ovs-vsctl set Bridge br0 stp_enable=true 

-bring up all interfacese
$ sudo ifconfig eth1 up
$ sudo ifconfig eth2 up


- check stp and port status on ovs1


$ sudo ovs-ofctl show br0
[sudo] password for ton:
OFPT_FEATURES_REPLY (xid=0x2): dpid:0000080027b6cbd5
n_tables:254, n_buffers:256
capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
 1(eth1): addr:08:00:27:b6:cb:d5
     config:     0
     state:      STP_FORWARD
     current:    1GB-FD COPPER AUTO_NEG
     advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-FD COPPER AUTO_NEG
     supported:  10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-FD COPPER AUTO_NEG
     speed: 1000 Mbps now, 1000 Mbps max
 2(eth2): addr:08:00:27:c1:78:fe
     config:     0
     state:      STP_BLOCK
     current:    1GB-FD COPPER AUTO_NEG
     advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-FD COPPER AUTO_NEG
     supported:  10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-FD COPPER AUTO_NEG
     speed: 1000 Mbps now, 1000 Mbps max
 LOCAL(br0): addr:08:00:27:b6:cb:d5
     config:     0
     state:      0
     speed: 0 Mbps now, 0 Mbps max
OFPT_GET_CONFIG_REPLY (xid=0x4): frags=normal miss_send_len=0


 - you see the interface eth3 is in the BLOCK mode, so the switched network will not be in loop.

if we bring down interface eth2 on ovs2 machine, the port will eventually change to FORWARD mode


- snapshot of stp port status before and after shutdown port eth2 on ovs2
 -before shutdown the port



-after shutdown the port


No comments:

Post a Comment