Mininet 创建topo的时候指定host的ip
示例,要创建一个3个交换机8个主机的拓扑,如下图:
可以用如下python代码创建上述拓扑,并指定ip:
- from mininet.topo import Topo
- class MyTopo( Topo ):
- def __init__( self ):
- "Create custom topo."
- # Initialize topology
- Topo.__init__( self )
- # Add hosts and switches
- leftHost1 = self.addHost( 'h1', ip='10.0.0.1' )
- leftHost2 = self.addHost( 'h2', ip='10.0.0.2' )
- leftHost3 = self.addHost( 'h3', ip='10.0.1.1' )
- leftHost4 = self.addHost( 'h4', ip='10.0.1.2' )
- leftSwitch = self.addSwitch( 's1' )
- middleSwitch = self.addSwitch( 's2' )
- rightSwitch = self.addSwitch( 's3' )
- rightHost1 = self.addHost( 'h5', ip='10.0.11.1' )
- rightHost2 = self.addHost( 'h6', ip='10.0.11.2' )
- rightHost3 = self.addHost( 'h7', ip='10.0.12.1' )
- rightHost4 = self.addHost( 'h8', ip='10.0.12.2' )
- # Add links
- self.addLink( leftHost1, leftSwitch )
- self.addLink( leftHost2, leftSwitch )
- self.addLink( leftHost3, leftSwitch )
- self.addLink( leftHost4, leftSwitch )
- self.addLink( leftSwitch, middleSwitch )
- self.addLink( middleSwitch, rightSwitch )
- self.addLink( rightSwitch, rightHost1 )
- self.addLink( rightSwitch, rightHost2 )
- self.addLink( rightSwitch, rightHost3 )
- self.addLink( rightSwitch, rightHost4 )
- topos = { 'mytopo': ( lambda: MyTopo() ) }
创建topo之后用dump命令验证,可见它们的ip确实如代码中指定的一样。
- mininet@mininet-vm:~/mininet/custom$ sudo mn --custom topo-3sw-8host.py --topo mytopo --controller=remote,ip=192.168.56.1 --mac
- added a switch!
- added a switch!
- added a switch!
- *** Creating network
- *** Adding controller
- *** Adding hosts:
- h1 h2 h3 h4 h5 h6 h7 h8
- *** Adding switches:
- s1 s2 s3
- *** Adding links:
- (h1, s1) (h2, s1) (h3, s1) (h4, s1) (h5, s3) (h6, s3) (h7, s3) (h8, s3) (s1, s2) (s2, s3)
- *** Configuring hosts
- h1 h2 h3 h4 h5 h6 h7 h8
- *** Starting controller
- *** Starting switches
- s1 s2 s3
- *** Starting CLI:
- mininet> dump
- <RemoteController c0: 192.168.56.1: pid=>
- <OVSSwitch s1: lo:127.0.0.1,s1-eth1:None,s1-eth2:None,s1-eth3:None,s1-eth4:None,s1-eth5:None pid=>
- <OVSSwitch s2: lo:127.0.0.1,s2-eth1:None,s2-eth2:None pid=>
- <OVSSwitch s3: lo:127.0.0.1,s3-eth1:None,s3-eth2:None,s3-eth3:None,s3-eth4:None,s3-eth5:None pid=>
- <Host h1: h1-eth0:10.0.0.1 pid=>
- <Host h2: h2-eth0:10.0.0.2 pid=>
- <Host h3: h3-eth0:10.0.1.1 pid=>
- <Host h4: h4-eth0:10.0.1.2 pid=>
- <Host h5: h5-eth0:10.0.11.1 pid=>
- <Host h6: h6-eth0:10.0.11.2 pid=>
- <Host h7: h7-eth0:10.0.12.1 pid=>
- <Host h8: h8-eth0:10.0.12.2 pid=>
- mininet>
Mininet 创建topo的时候指定host的ip的更多相关文章
- 使用Mininet创建网络拓扑
使用Mininet创建Topo Python脚本实现创建拓扑 #coding:utf-8 from mininet.net import Mininet from mininet.topo impor ...
- PDO创建mysql数据库并指定utf8编码
<?php //PDO创建mysql数据库并指定utf8编码 header('Content-type:text/html; charset=utf-8'); $servername = &qu ...
- expect脚本同步文件 expect脚本指定host和要同步的文件 构建文件分发系统 批量远程执行命令
自动同步文件 #!/usr/bin/expect set " spawn rsync -av root@.txt /tmp/ expect { "yes/no" { se ...
- expect脚本同步文件、expect脚本指定host和要同步的文件、构建文件分发系统、批量远程执行命令
7月20日任务 20.31 expect脚本同步文件20.32 expect脚本指定host和要同步的文件20.33 构建文件分发系统20.34 批量远程执行命令扩展:shell多线程 http:// ...
- Linux centosVMware运行告警系统、分发系统-expect讲解、自动远程登录后,执行命令并退出、expect脚本传递参数、expect脚本同步文件、指定host和要同步的文件、shell项目-分发系统-构建文件分发系统、分发系统-命令批量执行
一运行告警系统 创建一个任务计划crontab -e 每一分钟都执行一次 调试时把主脚本里边log先注释掉 再次执行 没有发现502文件说明执行成功了,每日有错误,本机IP 负载不高 二.分发系统-e ...
- 如何在Mininet中修改host的IP地址
how to update virtual host's IP in mininet? I got it! do like this: mininet> py h1.setIP('10.0.0. ...
- [转]php curl 设置host curl_setopt CURLOPT_HTTPHEADER 指定host
From : http://digdeeply.org/archives/10132139.html 我们在开发测试时,有时web服务器会绑定一个域名,但是因为dns是无法解析的,我们需要设置host ...
- mysql中如何在创建数据库的时候指定数据库的字符集?
需求描述: 在创建DB的时候指定字符集. 操作过程: 1.使用create database语句创建数据库 mysql> create database if not exists test03 ...
- centos shell编程4【分发系统】 服务器标准化 mkpasswd 生成密码的工具 expect讲解 expect传递参数 expect自动同步文件 expect指定host和要同步的文件 expect文件分发系统 expect自动发送密钥脚本 Linux脚本执行方式 第三十八节课
centos shell编程4[分发系统] 服务器标准化 mkpasswd 生成密码的工具 expect讲解 expect传递参数 expect自动同步文件 expect指定host和要 ...
随机推荐
- 批处理cmd背景颜色
Pause Echo 其他提示语 & pause > nul pause暂停 COLOR 设置默认的控制台前景和背景颜色. COLOR [attr] attr 指定控制台输出的 ...
- 【Qt】Qt之重启应用程序【转】
简介 今天分享的内容有些意思-如何重启一个应用程序.其实,有时候这是一个很重要的功能点,而且很人性化.易用性很好. 例如:切换用户.当某个用户登录成功之后,需要切换到其它账号,那么这时,你就知道它的重 ...
- 【Qt】Qt Creator快捷键【转】
简介 Qt Creator中提供了各种快捷键来加快开发进程. 如果需要查看或自定义快捷键,选择工具->选项->环境->键盘.快捷键按类别列出,可以在过滤器(Filter)处输入命令名 ...
- [大牛翻译系列]Hadoop(19)MapReduce 文件处理:基于压缩的高效存储(二)
5.2 基于压缩的高效存储(续) (仅包括技术27) 技术27 在MapReduce,Hive和Pig中使用可分块的LZOP 如果一个文本文件即使经过压缩后仍然比HDFS的块的大小要大,就需要考虑选择 ...
- js Table冻结表头示例代码
Table冻结表头的js实现代码. Table冻结表头: <script type="text/javascript"> //冻结table的表头 function ...
- php + apache + mysql环境搭建
别人写的很好,若是不改变php默认访问路径的话,能够成功搭建是没问题的 http://www.cnblogs.com/pharen/archive/2012/02/06/2340628.html
- 防DDOS攻击
/ip firewall filter add chain=forward connection-state=new action=jump jump-target=block-ddos add ch ...
- 3. opencv进行SIFT特征提取
opencv中sift特征提取的步骤 使用SiftFeatureDetector的detect方法检测特征存入一个向量里,并使用drawKeypoints在图中标识出来 SiftDescriptorE ...
- ORA-00054
系统版本: [root@yoon ~]# more /etc/oracle-releaseOracle Linux Server release 5.7 数据库版本: Oracle Database ...
- How To Fix – Mcrypt PHP extension required in Laravel on Mac OS X (No MAMP)
Laravel PHP web framework requires certain libraries to function properly. One of these libraries is ...