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. 【C学习笔记】day2-3 求10 个整数中最大值

    #include <stdio.h>#define n 10 int main() { int max=0; int a[n] = {12,15,16,546,165,654,612,23 ...

  2. 信息安全day1

    课程目标:中小型网络建立.操作和故障排除,连接到WAN和实施网络安全 路由器三层协议功能 多层交换机具备三层协议的功能 终端服务器:特殊的路由器 网云:1.未知网络区域 2.不受自己管理的网络区域 A ...

  3. WCF部署HTTP错误404.3

    错误:WCF部署HTTP错误404.3-Not Found 由于扩展配置问题而无法提供您请求的页面.如果该页面是脚本,请添加处理程序.如果应下载文件,请添加MIME映射. 解决步骤如下: 控制面板-& ...

  4. interpreting non ascii codepoint

    ProtoBuf 在Windows VS2019 C++平台上的使用 这两天想着了解一下protobuf,搜索了一篇博客照着弄了一下 https://blog.csdn.net/weixin_4478 ...

  5. EOVS 83开局

    目录 公司筹备阶段 第一季 公司筹备阶段 第一季

  6. wx小程序 组件无法使用全局样式 (app.wxss)

    解决方法: 在组件中加上options选项 Component({ options: { addGlobalClass: true } })

  7. anaconda怎么将用户名路径切换为工作路径

  8. <小李飞刀>系列 随笔

    1.多情剑客无情剑 古龙的作品在电视上只看过电影版的陆小凤传奇,对古龙的作品也没有过系统的了解,初读时听到了李寻欢的名字,突然感觉可惜.觉得如此早就读到这种级别的小说有些暴殄天物,不过也算是以白纸状态 ...

  9. 数据结构(C语言)_链表

    //单链表按序号查找节点的值 LNode* GetElem(LinkList L, int i) { int j = 1; LNode* p = L->next; if (i == 0) ret ...

  10. 解决未定义的count键“报错为:"Uncaught ReferenceError: count is not defined"

    报错: 源码:Vuex仓库.js let state = {     count } export default state   解决:未赋值的count键