首页 > 编程知识 正文

minitel,mininet命令

时间:2023-05-06 15:34:18 阅读:138379 作者:728

在Coursera SDN开放式课程中,编程工作在Mininet中进行。 这里简单介绍一下Mininet。

什么是Mininet

Mininet是一个连接了多个虚拟端节点(end-hosts )、交换机和路由器的网络仿真器,可以采用轻量级虚拟化技术将系统与实际网络相媲美。

Mininet可以轻松创建支持SDN的网络。 host像一台真正的电脑一样工作,它使用ssh登录并启动APP应用程序,程序可以将数据包发送到以太网端口,数据包由交换机、路由器接收和处理。 有了这个网络,就可以向网络添加新的功能,进行相关的测试,并很容易地部署到实际的硬件环境中。

http://www.Sina.com/http://www.Sina.com /

可以轻松快速地创建支持用户定制的网络拓扑,缩短开发测试周期

可以执行实际的程序。 在Linux上运行的程序基本上可以在Wireshark等Mininet上运行

Mininet支持Openflow,在Mininet上执行的代码可以方便地移植到支持Openflow的硬件设备中

Mininet可以在自己的电脑、服务器、虚拟机、云(例如亚马逊ec2 )上运行

Mininet提供python API,使用方便

Mininet是一个开源项目,源代码在此: https://github.com/mininet

.

http://www.Sina.com/http://www.Sina.com /

使用VirtualBox安装Mininet虚拟机: http://mininet.org/download/

http://www.Sina.com/http://www.Sina.com /

以courserasdnweek 3编程助手为例,构建简单的数据中心网络。

datacenternetworkstypicallyhaveatree-like topology.end-hostsconnecttotop-of-rack switches,whichformtheleaves (oneore ) andoneormorelayersofaggregationswitchesformthemiddleofthetree.inabasictreetopology,eachswitch(exceptthecoreswitch )。 hasasingleparentswitch.additionalswitchesandlinksmaybeaddedtoconstructmorecomplextreetopologies (e.g .fat tree )

In this assignment,yourtaskistocreateasimpletreetopology.youwillassumeeachleveli.e .core,aggregation, edgeandhosttobecomposedofasinglelayerofswitches/hostswithaconfigurablefanoutvalue (k ) looks like:

代码:

# custom topo.py ' ' coursera :-softwaredefinednetworking (sdn ) )。 course-- module3programmingassignmentprofessor : nickfeamsterteachingassistant : muhammadshahbaz ' ' ' ' fromminet.ttet et.nodeimportcpulimitedhostfrommininet.linkimporttclinkfrommininet.utilimportirange, dumpnodeconnectionsfrommininet.logimportsetloglevelclasscustomtopo (topo ) : ' simpledatacentertopology ' link opts-link :参数' ' fanout-numberofchildswitchperparentswitch ' def _ _ init _ ) self,lilf fanout=2, * * opts (: # initializetopologyanddefaultoptionstopo._ init _ _ (self, * opts (# addyourlogichere . self.fanout=fanout core=self.addswitch (' C1 ' ) for i in irange(1) 1, fanout (: aggregation=self.addswitch (a % s ) %I ) self.addlink(core,aggregation, **linkopts1) forjiniraaation fanout (: edge=self.addswitch (e % s ) ) fanout*(I-1 ) j ) ) self.addlink ) add * * linkok fanout (: host=self.add host (h % s ) % ) (fanout ) fanout*(I-1 ) j-1 ) ) ) ) self.addlink ) host ) ) ) *linkopts3(topos=(custom(: ) lambda:customtopo ) }def simpleTest ) : ) createandtestastasimpler use _ htb=true (link opts2=dict (bw=8,delay='4ms ',loss=1,max_queue_size=900,) max _ qu queue _ sisi fanout=2) net=mininet ) topo, host link=TClink(net.start ) print ' dumpinghostconnections ' dumpnodeconnections ) print ' testingnetworkconnections ' nt。 et.stop (if _ name _=' _ _ main _ ' : # tellmininettoprintusefulinformationsetloglevel ) ' info '函数simpleTest

mininet @ mininet-VM :~~/mininet $ sudopythoncustomtopo.py

Mininet

1.mininet : http://mininet.org /

2.minine twiki :https://github.com/mininet/mininet/wiki

转载于:https://www.cn blogs.com/thelongroad/p/3264024.html

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。