利用OVS+FLOODLIGHT,为数据表添加VLAN_ID和MPLS

话不多说,直接上拓扑:

我这里是用主机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:4
V2
//改为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.结果:

 

 

 

posted @ 2018-12-03 21:13  冲向云霄1998  阅读(963)  评论(0编辑  收藏  举报