zoukankan      html  css  js  c++  java
  • 【2019.12.04】SDN上机第6次作业

    实验拓扑

    通过图形化界面建立拓扑

    先清除网络拓扑

    sudo mn -c
    

    生成Python语句

    #!/usr/bin/python
    
    from mininet.net import Mininet
    from mininet.node import Controller, RemoteController, OVSController
    from mininet.node import CPULimitedHost, Host, Node
    from mininet.node import OVSKernelSwitch, UserSwitch
    from mininet.node import IVSSwitch
    from mininet.cli import CLI
    from mininet.log import setLogLevel, info
    from mininet.link import TCLink, Intf
    from subprocess import call
    
    def myNetwork():
    
        net = Mininet( topo=None,
                       build=False,
                       ipBase='10.0.0.0/8')
    
        info( '*** Adding controller
    ' )
        info( '*** Add switches
    ')
        s1 = net.addSwitch('s1', cls=OVSKernelSwitch)
        s2 = net.addSwitch('s2', cls=OVSKernelSwitch)
    
        info( '*** Add hosts
    ')
        h6 = net.addHost('h6', cls=Host, ip='10.0.0.6', defaultRoute=None)
        h2 = net.addHost('h2', cls=Host, ip='10.0.0.2', defaultRoute=None)
        h1 = net.addHost('h1', cls=Host, ip='10.0.0.1', defaultRoute=None)
        h5 = net.addHost('h5', cls=Host, ip='10.0.0.5', defaultRoute=None)
        h3 = net.addHost('h3', cls=Host, ip='10.0.0.3', defaultRoute=None)
        h4 = net.addHost('h4', cls=Host, ip='10.0.0.4', defaultRoute=None)
    
        info( '*** Add links
    ')
        net.addLink(h1, s1)
        net.addLink(h2, s1)
        net.addLink(h3, s1)
        net.addLink(s1, s2)
        net.addLink(h4, s2)
        net.addLink(h5, s2)
        net.addLink(h6, s2)
    
        info( '*** Starting network
    ')
        net.build()
        info( '*** Starting controllers
    ')
        for controller in net.controllers:
            controller.start()
    
        info( '*** Starting switches
    ')
        net.get('s1').start([])
        net.get('s2').start([])
    
        info( '*** Post configure switches and hosts
    ')
    
        CLI(net)
        net.stop()
    
    if __name__ == '__main__':
        setLogLevel( 'info' )
        myNetwork()
    
    

    拓扑搭建成功

    在目录下打开ryu-manager的ofctl_rest.py

    ryu-manager ofctl_rest.py
    

    先使用pingall语句和net语句检测网络拓扑

    根据网络拓扑编写脚本文件

    运行脚本

    查看下发流表

    重新运行pingall命令

  • 相关阅读:
    [原]零基础学习SDL开发之在Android使用SDL2.0渲染PNG图片
    [原]零基础学习SDL开发之在Android使用SDL2.0显示BMP叠加图
    [原]零基础学习SDL开发之在Android使用SDL2.0显示BMP图
    LLBLGen Pro ORM 生成器
    ODATA4 及实现
    所见即所得的网页设计工具 Macaw
    Unity 3D ---引擎行业的新宠
    金蝶有关的网站及服务
    Bitcoin 比特币, LTC(litecoin)莱特币,
    SONY 手提 realtek high definition audio driver
  • 原文地址:https://www.cnblogs.com/mokou/p/11984894.html
Copyright © 2011-2022 走看看