Mininet

SDN实验

谁说我不能喝 提交于 2019-12-04 04:12:38
第二次sdn实验: 1. 利用mininet创建如下拓扑,要求拓扑支持OpenFlow 1.3协议,主机名、交换机名以及端口对应正确,请给出拓扑Mininet执行结果,展示端口连接情况。 本次使用python脚本fattree生成拓扑,这样方便设置路由器的转发端口号。 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

2019 SDN上机第2次作业

喜你入骨 提交于 2019-12-04 01:58:26
1. 利用mininet创建如下拓扑,要求拓扑支持OpenFlow 1.3协议,主机名、交换机名以及端口对应正确,请给出拓扑Mininet执行结果,展示端口连接情况 编写如下python脚本后运行,得到与预期端口号相符的网络拓扑: #!/usr/bin/python #Creating Inernet Topo 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): def __init__(self): #Initialize Topology Topo.__init__(self) L1 = 2 L3 = 3 c = [] #add core ovs for i in range(L1): sw = self.addSwitch('s{}'.format(i+1)) c.append(sw) #add Hosts count = 1 for sw1 in c: for i in range(0, 3):

2019 SDN上机第2次作业

為{幸葍}努か 提交于 2019-12-04 01:54:57
1. 利用mininet创建如下拓扑,要求拓扑支持OpenFlow 1.3协议,主机名、交换机名以及端口对应正确,请给出拓扑Mininet执行结果,展示端口连接情况 Python脚本 #!/usr/bin/python #创建网络拓扑 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." Topo.__init__( self ) s = [] for i in range( 2 ): sw = self.addSwitch( 's{}'.format( i + 1 ) ) s.append( sw ) count = 1 for sw1 in s: for i in range(3): host = self.addHost( 'h{}'.format( count

2019 SDN上机第2次作业

こ雲淡風輕ζ 提交于 2019-12-04 00:28:35
1.利用mininet创建如下拓扑,要求拓扑支持OpenFlow 1.3协议,主机名、交换机名以及端口对应正确,请给出拓扑Mininet执行结果,展示端口连接情况 python代码 from mininet.topo import Topo class MyTopo( Topo ): "Simple topology example." def __init__( self ): Topo.__init__(self) sw1 = self.addSwitch('s1') sw2 = self.addSwitch('s2') h1 = self.addHost('h1') h2 = self.addHost('h2') h3 = self.addHost('h3') h4 = self.addHost('h4') h5 = self.addHost('h5') h6 = self.addHost('h6') self.addLink(h1,sw1,1,1) self.addLink(h2,sw1,1,2) self.addLink(h3,sw1,1,3) self.addLink(sw1,sw2,4,4) self.addLink(h4,sw2,1,1) self.addLink(h5,sw2,1,2) self.addLink(h6,sw2,1,3) topos = {

2019 SDN上机第2次作业

空扰寡人 提交于 2019-12-03 23:39:12
1.利用mininet创建如下拓扑,要求拓扑支持OpenFlow 1.3协议,主机名、交换机名以及端口对应正确,请给出拓扑Mininet执行结果,展示端口连接情况 创建fattree2.py文档,并编写py代码,代码如下: 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): def __init__(self): Topo.__init__(self) s=[] for i in range(2): sw = self.addSwitch('s{}'.format(i+1)) switchs.append(sw) count=1 for sw in switchs[0:2]: for i in range(3): host = self.addHost('h{}'.format(count)) self.addLink(sw,host) count += 1 self.addLink(switchs[0]

基于容器快速搭建onos环境

僤鯓⒐⒋嵵緔 提交于 2019-12-03 21:52:17
docker pull onosproject/onos:1.14.0 docker pull iwaseyusuke/mininet:latest docker create --name onos1140 --hostname onos -p 8101:8101 -p 8181:8181 -p 6633:6633 -it onosproject/onos:1.14.0 docker run -it -d -it --privileged -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /lib/modules:/lib/modules iwaseyusuke/mininet --name mininet @host ssh -p 8101 karaf@$ip_of_onos1140 pwd:karaf app activate org.onosproject.openflow (启用openflow) app activate org.onosproject.fwd (启用forward转发功能) docker exec -it mininet bash mn --topo tree,2 --controller remote,ip=$ip_of_onos1140 mn --topo tree,depth=2,fanout=3 -

2019 SDN上机第2次作业

六眼飞鱼酱① 提交于 2019-12-03 21:38:29
1.利用mininet创建如下拓扑,要求拓扑支持OpenFlow 1.3协议,主机名、交换机名以及端口对应正确,请给出拓扑Mininet执行结果,展示端口连接情况 (1)搭建如下拓扑 (2)python脚本代码 from mininet.topo import Topo Hcount=3 Scount=2 class MyTopo(Topo): def __init__(self): Topo.__init__(self) global Hcount,Scount switchs = [] for i in range(Scount): swit = self.addSwitch("s{}".format(i + 1)) switchs.append(swit) c = 1 for sw in switchs: for i in range(Hcount): hx = self.addHost("h{}".format(c)) self.addLink(sw, hx) c+=1 self.addLink(switchs[0], switchs[1]) topos = {"mytopo": (lambda : MyTopo()) } (3)执行python脚本创建mininet网络拓扑 (4).测试端口连接情况 2.直接在Open vSwitch下发流表,用vlan得到下列虚拟网段

2019 SDN上机第2次作业

左心房为你撑大大i 提交于 2019-12-03 21:32:10
1.利用mininet创建如下拓扑,要求拓扑支持OpenFlow 1.3协议,主机名、交换机名以及端口对应正确,请给出拓扑Mininet执行结果,展示端口连接情况 (1)创建SDNtest2.py文档 from mininet.topo import Topo class MyTopo( Topo ): def __init__( self ): # Initialize topology Topo.__init__( self ) switch1 = self.addSwitch('switch1') switch2 = self.addSwitch('switch2') h1 = self.addHost('h1') h2 = self.addHost('h2') h3 = self.addHost('h3') h4 = self.addHost('h4') h5 = self.addHost('h5') h6 = self.addHost('h6') self.addLink(h1,switch1,1,1) self.addLink(h2,switch1,1,2) self.addLink(h3,switch1,1,3) self.addLink(switch1,switch2,4,4) self.addLink(h4,switch2,1,1) self.addLink(h5

2019 SDN上机第2次作业

社会主义新天地 提交于 2019-12-03 21:20:17
1. 利用mininet创建如下拓扑,要求拓扑支持OpenFlow 1.3协议,主机名、交换机名以及端口对应正确,请给出拓扑Mininet执行结果,展示端口连接情况 使用python脚本设计拓扑,代码如下 from mininet.topo import Topo class MyTopo(Topo): def __init__(self): # initilaize topology Topo.__init__(self) # add hosts and switches host1 = self.addHost('h1') host2 = self.addHost('h2') host3 = self.addHost('h3') host4 = self.addHost('h4') host5 = self.addHost('h5') host6 = self.addHost('h6') switch1 = self.addSwitch('s1') switch2 = self.addSwitch('s2') # add links self.addLink(host1, switch1, 1, 1) self.addLink(host2, switch1, 1, 2) self.addLink(host3, switch1, 1, 3) self.addLink(host4,

2019 SDN上机第2次作业

匆匆过客 提交于 2019-12-03 21:16:15
1. 利用mininet创建拓扑,要求拓扑支持OpenFlow 1.3协议,主机名、交换机名以及端口对应正确,请给出拓扑Mininet执行结果,展示端口连接情况 Python代码: 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." Topo.__init__( self ) switchs = [] for i in range(2): sw = self.addSwitch("s{}".format(i + 1)) switchs.append(sw) self.addLink(switchs[0], switchs[1],4,4) count = 1 for sw in switchs: for i in range(3): h = self.addHost(