Lab-1:create vlan based Openflow flows in OVS

openflow_1

openflow_2

Precondition:

  • Mininet and OVS ver 2.0.2 on Virtual Box
  • vlan package installed on VM. Try below command to install vlan package
    • apt-get install vlan

Procedure:

  • Start mininet with single bridge, 2 hosts and no controller
mininet>sudo mn --controller=none --topo=single,3
  • Perform below steps on mininet to prep hosts to add vlan-id.

 

mininet>h1 vconfig add h1-eth0 100
mininet>h2 vconfig add h2-eth0 100
mininet>h1 route del –net 10.0.0.0 netmask 255.0.0.0
mininet>h2 route del –net 10.0.0.0 netmask 255.0.0.0
mininet>h1 ifconfig h1-eth0.100 10.0.0.1
mininet>h2 ifconfig h2-eth0.100 10.0.0.2
mininet>h1 ifconfig
mininet>h1 route

Case-1: Figure-1

mininet>sh ovs-ofctl add-flow s1 priority=100,in_port=1,dl_vlan=100,actions=output:2
mininet>sh ovs-ofctl add-flow s1 priority=100,in_port=2,dl_vlan=100,actions=output:1
mininet>h1 ping h2 //ping is successful

Start wireshark and capture frame, frames are encapsulated into vlan-id=100

Case-2: Modify VLAN-ID (Figure-2)

  • Delete h2 vlan interface (h2-eth0.100) and add vlan interface 200

 

mininet>h2 vconfig rem h2-eth0.100
mininet>h2 vconfig add h2-eth0 200
mininet>h2 ifconfig h2-eth0.200 10.0.0.2
  • Add flow to modify vlan-id

 

mininet>sh ovs-ofctl add-flow s1 priority=100,in_port=1,dl_vlan=100,actions=mod_vlan_vid:200,output:2
mininet>sh ovs-ofctl add-flow s1 priority=100,in_port=2,dl_vlan=200,actions=mod_vlan_vid:100,output:1
mininet>h1 ping h2 //ping is successful

Case-3: Strip VLAN-ID (Figure-3)

  • Delete h2 vlan interface (h2-eth0.200).

 

mininet>h2 vconfig delete h2-eth0.200
mininet>h2 ifconfig h2-eth0 down
mininet>h2 ifconfig h2-eth0 up
  • Add flow to modify & strip vlan-id

 

mininet>sh ovs-ofctl add-flow s1 priority=100,in_port=1,dl_vlan=100,actions=strip_vlan,output:2
mininet>sh ovs-ofctl add-flow s1 priority=100,in_port=2,actions=mod_vlan_vid:100,output:1

One thought on “Lab-1:create vlan based Openflow flows in OVS

Leave a comment