SDN第三次上机作业

实验目的

在给定如上实验拓扑情况下,用vlan得到下列虚拟网段

h1--h4互通
h2--h5互通
h3--h6互通
其余主机间无法通信
实验步骤
1.创建以下拓扑(可采用任意方式)

2.利用OVS命令下发流表,实现VLAN功能

sudo ovs-ofctl -O OpenFlow13 add-flow s1 priority=1,in_port=1,actions=push_vlan:0x8100,set_field:4096-\>vlan_vid,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow s1 priority=1,in_port=2,actions=push_vlan:0x8100,set_field:4097-\>vlan_vid,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow s1 priority=1,in_port=3,actions=push_vlan:0x8100,set_field:4098-\>vlan_vid,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow s1 priority=1,dl_vlan=0,actions=pop_vlan,output:1
sudo ovs-ofctl -O OpenFlow13 add-flow s1 priority=1,dl_vlan=1,actions=pop_vlan,output:2
sudo ovs-ofctl -O OpenFlow13 add-flow s1 priority=1,dl_vlan=2,actions=pop_vlan,output:3

sudo ovs-ofctl -O OpenFlow13 add-flow s2 priority=1,in_port=1,actions=push_vlan:0x8100,set_field:4096-\>vlan_vid,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow s2 priority=1,in_port=2,actions=push_vlan:0x8100,set_field:4097-\>vlan_vid,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow s2 priority=1,in_port=3,actions=push_vlan:0x8100,set_field:4098-\>vlan_vid,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow s2 priority=1,dl_vlan=0,actions=pop_vlan,output:1
sudo ovs-ofctl -O OpenFlow13 add-flow s2 priority=1,dl_vlan=1,actions=pop_vlan,output:2
sudo ovs-ofctl -O OpenFlow13 add-flow s2 priority=1,dl_vlan=2,actions=pop_vlan,output:3

参考链接:http://blog.csdn.net/rocson001/article/details/73163041

提交要求:贴出OVS下发流表的命令
3.利用OVS命令查看流表

sudo ovs-ofctl -O OpenFlow13 dump-flows s1


sudo ovs-ofctl -O OpenFlow13 dump-flows s2

参考链接:http://blog.csdn.net/rocson001/article/details/73163041

4.验证性测试

截图验证:


h1--h4互通
h2--h5互通
h3--h6互通
其余主机间无法通信
5.Wireshark抓包验证

posted @ 2017-12-14 23:47  cxkkk  阅读(170)  评论(0编辑  收藏  举报