示例1:
运行命令:
sudo mn --custom 2s_8h.py --topo mytopo --controller=remote,ip=211.69.197.92,port=6653 --mac
# sudo mn --custom 2s_8h.py --topo mytopo --controller=remote,ip=211.69.197.92,port=6653 --mac
from mininet.topo import Topo
class MyTopo( Topo ):
def __init__( self ):
# initilaize topology
Topo.__init__( self )
# add hosts and switches
h1 = self.addHost( 'h1' )
h2 = self.addHost( 'h2' )
h3 = self.addHost( 'h3' )
s1 = self.addSwitch( 's1' )
s2 = self.addSwitch( 's2' )
# add links
self.addLink(h1,s1,1,1)
self.addLink(h2,s1,1,3)
self.addLink(h3,s2,1,1)
self.addLink(s1,s2,2,2)
topos = { 'mytopo': ( lambda: MyTopo() ) }