zoukankan      html  css  js  c++  java
  • mininet对象添加带外管理

            for i in range(1, 4+1):
                name = 'r%s' % i
    
                eth0 = { 'mac' : '00:00:00:00:0%s:01' % i,
                         'ipAddrs' : ['10.0.%s.1/24' % i] }
                eth1 = { 'ipAddrs' : ['192.168.%s.254/24' % i] }
                mg_eth = { 'ipAddrs' : ['172.168.%s.2/24' % i] }
                intfs = { '%s-eth0' % name : eth0,
                          '%s-eth1' % name : eth1,
                          '%s-eth2' % name : mg_eth}
                quaggaConf = '%s/quagga%s.conf' % (CONFIG_DIR, i)
           router = self.addHost(name, cls=Router, quaggaConfFile=quaggaConf,
                                      zebraConfFile=zebraConf, intfDict=intfs)
    
                host = self.addHost('h%s' % i, cls=SdnIpHost,
                                    ip='192.168.%s.1/24' % i,
                                    route='192.168.%s.254' % i)
    
                self.addLink(router, attachmentSwitches[i-1])
                self.addLink(router, host)
    
                mgnt = self.addHost( 'mgntr%s'%i, inNamespace=False, ip='172.168.%s.254/24'%i)
                self.addLink( mgnt, router )
    root@ubuntu:/home/ubuntu/# ping 172.168.3.2
    PING 172.168.3.2 (172.168.3.2) 56(84) bytes of data.
    64 bytes from 172.168.3.2: icmp_seq=1 ttl=64 time=0.068 ms
    64 bytes from 172.168.3.2: icmp_seq=2 ttl=64 time=0.020 ms
    ^C
    --- 172.168.3.2 ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 1023ms
    rtt min/avg/max/mdev = 0.020/0.044/0.068/0.024 ms
    root@ubuntu:/home/ubuntu/# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         10.10.16.254    0.0.0.0         UG    0      0        0 enahisic2i0
    0.0.0.0         10.10.16.254    0.0.0.0         UG    0      0        0 enahisic2i0
    10.10.10.0      0.0.0.0         255.255.255.0   U     0      0        0 root-eth0
    10.10.16.0      0.0.0.0         255.255.255.0   U     0      0        0 enahisic2i0
    169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 enahisic2i0
    172.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 mgntr1-eth0
    172.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 mgntr2-eth0
    172.168.3.0     0.0.0.0         255.255.255.0   U     0      0        0 mgntr3-eth0
    172.168.4.0     0.0.0.0         255.255.255.0   U     0      0        0 mgntr4-eth0
    root@ubuntu:/home/ubuntu/jvimal-bgp-789055b95a66#
    root@ubuntu:/home/ubuntu/jvimal-bgp-789055b95a66# telnet 172.168.3.2 bgpd
    Trying 172.168.3.2...
    Connected to 172.168.3.2.
    Escape character is '^]'.
    
    Hello, this is Quagga (version 1.2.4).
    Copyright 1996-2005 Kunihiro Ishiguro, et al.
    
    
    User Access Verification
    
    Password: 
    r3> en
    r3# show run
    
    Current configuration:
    !
    hostname r3
    password sdnip
    log stdout
    !
    router bgp 65003
     bgp router-id 10.0.3.1
     network 192.168.3.0/24
     timers bgp 3 9
     neighbor 10.0.3.101 remote-as 65000
     neighbor 10.0.3.101 ebgp-multihop 255
     neighbor 10.0.3.101 advertisement-interval 5
     neighbor 10.0.3.101 timers connect 5
    !
     address-family ipv6
     exit-address-family
     exit
    !
    line vty
    !
    end
    r3# 
    r3# 
    mininet> links
    bgp-eth0<->s3-eth1 (OK OK)
    mgntr1-eth0<->r1-eth2 (OK OK)
    mgntr2-eth0<->r2-eth2 (OK OK)
    mgntr3-eth0<->r3-eth2 (OK OK)
    mgntr4-eth0<->r4-eth2 (OK OK)
    r1-eth1<->h1-eth0 (OK OK)
    r1-eth0<->s1-eth1 (OK OK)
    r2-eth1<->h2-eth0 (OK OK)
    r2-eth0<->s2-eth1 (OK OK)
    r3-eth1<->h3-eth0 (OK OK)
    r3-eth0<->s5-eth1 (OK OK)
    r4-eth1<->h4-eth0 (OK OK)
    r4-eth0<->s6-eth1 (OK OK)
    root-eth0<->bgp-eth1 (OK OK)
    s1-eth2<->s2-eth2 (OK OK)
    s1-eth3<->s3-eth2 (OK OK)
    s2-eth3<->s4-eth1 (OK OK)
    s3-eth3<->s4-eth2 (OK OK)
    s3-eth4<->s5-eth2 (OK OK)
    s4-eth3<->s6-eth2 (OK OK)
    s5-eth3<->s6-eth3 (OK OK)
    sdnh1-eth0<->s3-eth5 (OK OK)
    sdnh2-eth0<->s4-eth4 (OK OK)
    mininet> 

  • 相关阅读:
    drf-通过drf-extensions扩展来实现缓存
    social_django第三方登录 没有token解决方法
    python-项目日志配置使用
    drf-支付宝支付
    git 相关命令
    django第三方登录与邮箱验证流程
    django项目部署
    数组中的方法
    滚动到页面底部,更新数据
    图片卷边
  • 原文地址:https://www.cnblogs.com/dream397/p/13337197.html
Copyright © 2011-2022 走看看