• 第三次上机作业


    实验目的

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

    h1--h4互通
    h2--h5互通
    h3--h6互通
    其余主机间无法通信

    实验步骤

    1.创建以下拓扑(可采用任意方式)

    class MyTopo( Topo ):
    "Simple topology example."
     def __init__( self ):
         # Initialize topology
        Topo.__init__( self )
        # add switches and hosts  
        sw1 = self.addSwitch('s1')
        sw2 = self.addSwitch('s2')
        h1 = self.addHost('h1')
        h2 = self.addHost('h2')
        h3 = self.addHost('h3')
        h4 = self.addHost('h4')
        h5 = self.addHost('h5')
        h6 = self.addHost('h6')
        # add links
        self.addLink(h1,sw1,1,1)
        self.addLink(h2,sw1,1,2)
        self.addLink(h3,sw1,1,3)
        self.addLink(sw1,sw2,4,4)
        self.addLink(h4,sw2,1,1)
        self.addLink(h5,sw2,1,2)
        self.addLink(h6,sw2,1,3)
        topos = { 'mytopo': ( lambda: MyTopo() ) }
    

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

    s1:

    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

    s2:

    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

    3.利用OVS命令查看流表


    4.验证性测试

    5.Wireshark抓包验证

  • 相关阅读:
    将excel表导入到mysql中
    MYSQL数据库注释
    查询所有的表
    清空、删除数据
    创建、删除表
    创建、使用、删除数据库
    [转]文件后缀与Mime类型对照表
    给本地服务器配置py文件的下载功能
    在Autodesk应用程序商店发布基于浏览器的Web应用程序
    开发培训及技术研讨会开始报名了,赶紧报名啊
  • 原文地址:https://www.cnblogs.com/ch2405/p/8059014.html
Copyright © 2020-2023  润新知