Mininet链接参数到遥控器

时间:2015-11-03 08:17:43

标签: python controller bandwidth mininet sdn

  1. 我想将交换机中的链接参数添加到遥控器(泛光灯),我该怎么办?我的意思是我想在交换机与控制器之间指定链路带宽,链路延迟..

  2. 是实现双向链接的正确方法吗?

    net.addLink('s1','s2', bw=43)  
    net.addLink('s2','s1', bw=35)
    
  3. 我正在使用此自定义拓扑

    def emptyNet():
        net = Mininet(controller=RemoteController,
                      switch=OVSKernelSwitch, link=TCLink)
        c1 = net.addController('c1', controller=RemoteController,
                               ip="127.0.0.1", port=6633)
        c2 = net.addController('c2', controller=RemoteController,
                               ip="127.0.0.1", port=6632)
        c3 = net.addController('c3', controller=RemoteController,
                               ip="127.0.0.1", port=6634)
    
        h1 = net.addHost( 'h1' )
        h2 = net.addHost( 'h2' )
        h3 = net.addHost( 'h3' )
        h4 = net.addHost( 'h4' )
        h5 = net.addHost( 'h5' )
        h6 = net.addHost( 'h6' )
        h7 = net.addHost( 'h7' )
        h8 = net.addHost( 'h8' )
        h9 = net.addHost( 'h9' )
        s1 = net.addSwitch( 's1' , mac='00:00:00:00:00:01' )
        s2 = net.addSwitch( 's2' , mac='00:00:00:00:00:02' )
        s3 = net.addSwitch( 's3' , mac='00:00:00:00:00:03' )
        s4 = net.addSwitch( 's4' , mac='00:00:00:00:00:04' )
        s5 = net.addSwitch( 's5' , mac='00:00:00:00:00:05' )
        s6 = net.addSwitch( 's6' , mac='00:00:00:00:00:06' )
        net.addLink('s1','s2', bw=43)
        net.addLink('s2','s1', bw=35)
        net.addLink('s1','s4', bw=68)
        net.addLink('s4','s1', bw=26)
        net.addLink('s2','s3', bw=151)
        net.addLink('s3','s2', bw=230)
        net.addLink('s3','s5', bw=26)
        net.addLink('s5','s3', bw=47)
        net.addLink('s3','s6', bw=353)
        net.addLink('s1','h1')
        net.addLink('s4','h2')
        net.addLink('s1','h3')
        net.addLink('s1','h4')
        net.addLink('s5','h5')
        net.addLink('s3','h6')
        net.addLink('s2','h7')
         net.addLink('s3','h8')
        net.addLink('s1','h9')
         s1.start([c1,c2,c3])
        s2.start([c1,c2,c3])
        s3.start([c1,c2,c3])
        s4.start([c1,c2,c3])
        s5.start([c1,c2,c3])
        s6.start([c1,c2,c3])
        net.start()
        net.staticArp()
        CLI( net )
        net.stop()
     if __name__ == '__main__':
      setLogLevel( 'info' )
      emptyNet()
    topos = { 'mytopo': ( lambda: MyTopo() ) }
    

1 个答案:

答案 0 :(得分:0)

  1. 您可以在Linux中使用流量控制命令tc来设置某些接口上的延迟,带宽(比如eth0)。 tc支持控制所有流量或仅基于数据包标头的某些流量,例如某些接口上的IP地址。 如果你想在交换机和控制器之间的每个链路上设置不同的链路参数,你可以使用tc来控制基于tcp端口的流量,因为控制器通过使用不同的tcp端口连接到交换机。
  2. 如果您的代码是

    net.addLink(' s1',' s2',bw = 43)
    net.addLink(' s2',' s1',bw = 35)

  3. 您将获得两个带宽不同的链接。 你可以在mininet中使用命令网来检查网络连接,你会发现两者都是' s1'和' s2'将为2个链接打开2个端口,如:

    s1 lo:s1-eth1:s2-eth1 s1-eth2:s2-eth2
      s2 lo:s2-eth1:s1-eth1 s2-eth2:s1-eth2