Mininet实验手册

一、安装

1、  直接使用带有完整软件的VM(略)

2、  源码安装

1)  下载

git clone git://github.com/mininet/mininet

2)  安装

cd mininet/util

./install.sh –a   ##good luck

install.sh –nfv

3)  测试

sudo mn --switch ovsbr --test pingall

3、  软件包安装

sudo apt-get install mininet

二、常用命令

1、  创建拓扑

1)  最小化拓扑

root@user1-virtual-machine:~/mininet/util# mn --topo minimal

*** Creating network

*** Adding controller

*** Adding hosts:

h1 h2

*** Adding switches:

s1

*** Adding links:

(h1, s1) (h2, s1)

*** Configuring hosts

h1 h2

*** Starting controller

c0

*** Starting 1 switches

s1 ...

*** Starting CLI:

请画出最小化拓扑的图形结构(在画图里表示即可):

2)  创建线性拓扑

root@user1-virtual-machine:~/mininet/util# mn --topo linear,4

*** Creating network

*** Adding controller

*** Adding hosts:

h1 h2 h3 h4

*** Adding switches:

s1 s2 s3 s4

*** Adding links:

(h1, s1) (h2, s2) (h3, s3) (h4, s4) (s2, s1) (s3, s2) (s4, s3)

*** Configuring hosts

h1 h2 h3 h4

*** Starting controller

c0

*** Starting 4 switches

s1 s2 s3 s4 ...

*** Starting CLI:

请画出上面示例中线性结构的图形结构(在画图里表示即可):

3)  构建属性拓扑

root@user1-virtual-machine:~/mininet/util# mn --topo tree,fanout=3,depth=2

*** Creating network

*** Adding controller

*** Adding hosts:

h1 h2 h3 h4 h5 h6 h7 h8 h9

*** Adding switches:

s1 s2 s3 s4

*** Adding links:

(s1, s2) (s1, s3) (s1, s4) (s2, h1) (s2, h2) (s2, h3) (s3, h4) (s3, h5) (s3, h6) (s4, h7) (s4, h8) (s4, h9)

*** Configuring hosts

h1 h2 h3 h4 h5 h6 h7 h8 h9

*** Starting controller

c0

*** Starting 4 switches

s1 s2 s3 s4 ...

*** Starting CLI:

请画出上面示例中属性结构的图形结构(在画图里表示即可):

2、  使用python脚本构建拓扑

1)  线性拓扑脚本

#!/usr/bin/env python

"""

Create a self-defined linear network, and run the CLI on it.

"""

from mininet.net import Mininet

from mininet.topo import LinearTopo

Linear4 = LinearTopo(k=4)  #交换机数量为4

net = Mininet(topo=Linear4)

net.start()

net.pingAll()

net.stop()

~

2)  单交换机的星形拓扑(见上课文件)

3)  树形拓扑

4)  自定义ip

5)  自定义链路

以上程序文件参考课上

三、交互式界面命令

1、  执行mn创建最原始拓扑

root@user1-virtual-machine:~/mini_topo# mn

*** Creating network

*** Adding controller

*** Adding hosts:

h1 h2

*** Adding switches:

s1

*** Adding links:

(h1, s1) (h2, s1)

*** Configuring hosts

h1 h2

*** Starting controller

c0

*** Starting 1 switches

s1 ...

*** Starting CLI:

2、  添加h3主机

mininet> py net.addHost('h3')

<Host h3:  pid=39832>

3、  添加h3和s0之间的连接

mininet> py net.addLink(s1,net.get('h3'))

<mininet.link.Link object at 0x7f674c3e5bb0>

4、  给交换机添加端口连接h3

mininet> py s1.attach('s1-eth3')

5、  给h3设置ip地址

mininet> py h3.setIP("10.0.0.3/24")

6、  测试连通性

mininet> h1 ping h3

PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.

64 bytes from 10.0.0.3: icmp_seq=1 ttl=64 time=1.50 ms

64 bytes from 10.0.0.3: icmp_seq=2 ttl=64 time=0.198 ms

64 bytes from 10.0.0.3: icmp_seq=3 ttl=64 time=0.043 ms

^C

--- 10.0.0.3 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 2012ms

rtt min/avg/max/mdev = 0.043/0.581/1.504/0.655 ms

7、  查看信息

mininet> dump

<Host h1: h1-eth0:10.0.0.1 pid=39788>

<Host h2: h2-eth0:10.0.0.2 pid=39790>

<Host h3: h3-eth0:10.0.0.3 pid=39832>

<OVSSwitch s1: lo:127.0.0.1,s1-eth1:None,s1-eth2:None,s1-eth3:None pid=39795>

<Controller c0: 127.0.0.1:6653 pid=39781>

具体命令手册查看官网:http://mininet.org/walkthrough/#interact-with-hosts-and-switches

四、图形化

本实验在openlab注册平台上实现:

https://www.51openlab.com/course/expt/detail/d102e658-2dde-4f42-be95-f75d63461d9e/?from=/platform/curriculum/a18026230ad04063a70b6bb625212f3f/learn/

效果如下:

mininet配置命令的更多相关文章

  1. linux配置网卡IP地址命令详细介绍及一些常用网络配置命令

    linux配置网卡IP地址命令详细介绍及一些常用网络配置命令2010-- 个评论 收藏 我要投稿 Linux命令行下配置IP地址不像图形界面下那么方 便,完全需要我们手动配置,下面就给大家介绍几种配置 ...

  2. 一个简单的零配置命令行HTTP服务器

    http-server 是一个简单的零配置命令行HTTP服务器, 基于 nodeJs. 如果你不想重复的写 nodeJs 的 web-server.js, 则可以使用这个. 安装 (全局安装加 -g) ...

  3. IB交换机配置命令总结

    串口通过远程CRT登录,波特率9600用户名和密码都是adminDo you want to use the wizard for initial configuration?选择no打开ip rou ...

  4. 一个简单的零配置命令行HTTP服务器 - http-server (nodeJs)

    http-server 是一个简单的零配置命令行HTTP服务器, 基于 nodeJs. 如果你不想重复的写 nodeJs 的 web-server.js, 则可以使用这个. 安装 (全局安装加 -g) ...

  5. 思科Cisco 2960系列交换机配置命令

    配置密码: 2960>en :第一次密码为空 2960h#conf t :进入全局配置模式 2960(config)#hostname swa :设置交换机名 2960(config)#enab ...

  6. RHEL7查看网卡配置命令ip addr show

    Validating Network Address Configuration To verify the configuration of the network address, you nee ...

  7. LINUX查看硬件配置命令

    LINUX查看硬件配置命令   系统 # uname -a # 查看内核/操作系统/CPU信息 # head -n 1 /etc/issue # 查看操作系统版本 # cat /proc/cpuinf ...

  8. Ubuntu Linux下设置IP的配置命令

    Ubuntu Linux下设置IP的配置命令 今天装了Ubuntu,但是发现不能上网,开始排查问题: 1.首先确定网络连接是否正确,所用的网线是否可以正常工作 2.查看网卡是否能正常工作,检测的方法如 ...

  9. 烽火2640路由器命令行手册-13-VPDN(L2TP,PPTP,PPPOE)配置命令

    VPDN(L2TP,PPTP,PPPOE)配置命令 目  录 第1章 VPDN配置命令... 1 1.1 VPDN配置命令... 1 1.1.1 accept-dialin. 1 1.1.2 doma ...

  10. 烽火2640路由器命令行手册-12-IBM网络配置命令

    IBM网络配置命令 目  录 第1章 DLSW配置命令... 1 1.1 DLSW配置命令... 1 1.1.1 dlsw local-peer 1 1.1.2 dlsw remote-peer 3 ...

随机推荐

  1. js两个数组对象中,获取不相同的值 非交集元素对象

    查看前端面试题小程序 大量面试题和答案,请微信查看 var array1 = [ {"Num": "A " },{"Num": " ...

  2. idea提交时忽略.class、.iml文件和文件夹或目录的方法

    第一种方法 在Setings–> Editor --> File Types -->Ignore files and folders中添加需要忽略的文件和文件夹: .idea 忽略 ...

  3. Linux 服务器安全扫描

    工具一:Nmap 1. 探测网络中活跃的主机 nmap -sP 10.0.105.1/24 :探测10.0.105网段中的全部主机 2. 探测主机系统版本 nmap -O IP :探测指定IP的相关数 ...

  4. 认识jmeter(一)

    1.官网下载: https://jmeter.apache.org/download_jmeter.cgi 下载后解压: 2.安装 免安装,解压后,bin目录下双击jmeter.bat,会直接打开 会 ...

  5. react和vue的区别及优缺点

    区别: vue是双向绑定的,采用template: react是单向的,采用jsx. Vue的优缺点: 简单.快速.强大.对模块友好,但不支持IE8. React的优缺点: 速度快.跨浏览器兼容.模块 ...

  6. 10 soundJs 初体验

    最近想做一个h5的小游戏所以用上了soundjs. 还在开发中  http://www.hetenglife.com/mouse/game.html 刚刚把控制做完. 首先是要导入这个文件 <s ...

  7. 为什么你需要升级 pip

    更新软件版本可以修复bug,增加新功能和提升性能.例如,NumPy 1.20 添加了类型注释,并在可能的情况下通过使用SIMD来提高性能.如果您要安装NumPy,则可能要安装最新版本. 相反,如果您使 ...

  8. PTA_Maximum Subsequence Sum

    Given a sequence of K integers { N1​, N2​, ..., NK​ }. A continuous subsequence is defined to be { N ...

  9. eset node32卸载记录

    安装的是这个东西,卸载麻烦 1.一般的卸载软件比如wise program uninstall无论是普通卸载还是强制卸载都是实现不了的,火绒自带的文件粉碎是可以使用的,有两个目录要进行粉碎C:\Pro ...

  10. Linux中/etc目录下passwd和shadow文件

    /etc/passwd介绍 首先,通过cat /etc/passwd 来查看文件/etc/passwd中内容: root:x:0:0:root:/root:/bin/bash daemon:x:1:1 ...