zoukankan      html  css  js  c++  java
  • 2019 SDN上机第1次作业

    1.安装轻量级网络仿真工具Mininet

    通过拷贝老师提供的虚拟镜像直接导入,完成Mininet的安装

    查看Mininet版本

    2.用字符命令搭建如下拓扑,要求写出命令

    (1)第一个拓扑是三台主机分别连接交换机,然后三台交换机连接在一起,是一个线性拓扑结构。

    sudo mn --topo linear,3
    

    通过net展示所有网络信息

    (2)第二个拓扑是一个交换机连接三个交换机,每台交换机连接三个主机,是一个深度为2、扇出为3的树形拓扑结构。

    sudo mn --topo tree, fanout=3,depth=2
    

    通过net展示所有网络信息

    3. 利用可视化工具搭建如下拓扑,并要求支持OpenFlow 1.0 1.1 1.2 1.3,设置h1(10.0.0.10)、h2(10.0.0.11)、h3(10.0.0.12),拓扑搭建完成后使用命令验证主机ip,查看拓扑端口连接情况。

    (1)打开miniedit.py

    (2)添加组件建立拓扑,并设置属性






    (3)命令执行信息

    (4)点击左下角“run”按钮,启动mininet,运行设置好的网络拓扑

    sudo ./miniedit.py
    

    要加sudo 以管理员身份运行,否则会闪退

    (5)用xterm验证主机IP

    4.利用Python脚本完成如下图所示的一个Fat-tree型的拓扑(交换机和主机名需与图中一致,即s1s6,h1h8,并且链路正确,请给出Mininet相关截图)

    (1)python脚本

    #!/usr/bin/python
    #创建网络拓扑
    """Custom topology example
    Adding the 'topos' dict with a key/value pair to generate our newly defined
    topology enables one to pass in '--topo=mytopo' from the command line.
    """
     
    from mininet.topo import Topo
    from mininet.net import Mininet
    from mininet.node import RemoteController,CPULimitedHost
    from mininet.link import TCLink
    from mininet.util import dumpNodeConnections
     
    class MyTopo( Topo ):
        "Simple topology example."
     
        def __init__( self ):
            "Create custom topo."
            # Initialize topology
            Topo.__init__( self )
            L1 = 2
            L2 = L1 * 2 
            s = []
      
            # add core ovs  
            for i in range( L1 ):
                    sw = self.addSwitch( 's{}'.format( i + 1 ) )
                    s.append( sw )
            # add aggregation ovs
            for i in range( L2 ):
                    sw = self.addSwitch( 's{}'.format( L1 + i + 1 ) )
                    s.append( sw )
         
     
            # add links between core and aggregation ovs
            for i in range( L1 ):
                    sw1 = s[i]
                    for j in range(L1,L1+L2):
                sw2=s[j]
                    # self.addLink(sw2, sw1, bw=10, delay='5ms', loss=10, max_queue_size=1000, use_htb=True)
                self.addLink( sw2, sw1 )
     
     
            #add hosts and its links with edge ovs
            count = 1
            for j in range(L1,L1+L2):
            sw1=s[j]
                    for i in range(2):
                        host = self.addHost( 'h{}'.format( count ) )
                        self.addLink( sw1, host )
                        count += 1
    topos = { 'mytopo': ( lambda: MyTopo() ) }
    

    (2)命令行运行截图

  • 相关阅读:
    积水路面Wet Road Materials 2.3
    门控时钟问题
    饮料机问题
    Codeforces Round #340 (Div. 2) E. XOR and Favorite Number (莫队)
    Educational Codeforces Round 82 (Rated for Div. 2)部分题解
    Educational Codeforces Round 86 (Rated for Div. 2)部分题解
    Grakn Forces 2020部分题解
    2020 年百度之星·程序设计大赛
    POJ Nearest Common Ancestors (RMQ+树上dfs序求LCA)
    算法竞赛进阶指南 聚会 (LCA)
  • 原文地址:https://www.cnblogs.com/zys99/p/11787468.html
Copyright © 2011-2022 走看看