利用OVS+FLOODLIGHT,為數據表添加VLAN_ID和MPLS
阿新 • • 發佈:2018-12-03
-c 操作 br0 ffffff .com 附加 info spa http
3.結果:
話不多說,直接上拓撲:
我這裏是用主機h1 (10.0.0.1)ping 主機h2(10.0.0.2)
1.添加VLAN標簽
v1: sudo ovs-ofctl add-flow m1-s1 in_port=1,actions=mod_vlan_vid:123,output:4 v2: sudo ovs-ofctl add-flow m1-s2 in_port=1,dl_vlan=123,action=output:2 v3: sudo ovs-ofctl add-flow m1-s3 in_port=2,dl_vlan=123,actions=strip_vlan,output:1
2.添加MPLS標簽
註意:ping是先用arp協議查看目標ip的mac地址,在發送icmp數據包,所以加標簽完了去標簽的時候要註意區分包類型!
V1 sudo ovs-ofctl add-flow -O OpenFlow13 m1-s1 icmp,in_port=1,actions=push_mpls:0x8847,set_field:123-\>mpls_label,output:4 sudo ovs-ofctl add-flow -O OpenFlow13 m1-s1 arp,in_port=1,actions=push_mpls:0x8847,set_field:124-\>mpls_label,output:4V2 //改為ip協議 ,支持icmp sudo ovs-ofctl add-flow -O OpenFlow13 m1-s2 mpls,in_port=1,mpls_label=123,actions=pop_mpls:0x0800,output:2 sudo ovs-ofctl add-flow -O OpenFlow13 m1-s2 mpls,in_port=1,mpls_label=124,actions=pop_mpls:0x0806,output:2 V3 sudo ovs-ofctl add-flow m1-s3 in_port=2,actions=output:1
附加:OVS操作cmd:
查看交換機流表
sudo ovs-ofctl dump-flows br0 "in_port=1"
刪除指定交換機流表
sudo ovs-ofctl del-flows m1-s2
3.結果:
利用OVS+FLOODLIGHT,為數據表添加VLAN_ID和MPLS