摘要:
这里给出了Mininet在ubuntu 12.04 KVM (qemu 1.0)的环境下测试
提前准备:宿主机ubuntu + 虚拟机KVM(官方给出的镜像是vmdk vmware格式,教程中给出了vmdk到KVM镜像qcow2装换)
操作系统:ubuntu server amd64
安装完成后设置宿主机网络为
ubuntu@node2:~$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.12
gateway 192.168.1.1
netmask 255.255.255.0
auto eth1
iface eth1 inet manual
auto br0
iface br0 inet static
address 192.168.1.18
gateway 192.168.1.1
netmask 255.255.255.0
bridge_ports eth1
bridge_stp on
bridge_maxwait 0
重启网络服务,出现 br0网桥,这里假设有双网卡。单网卡也可以见后文。
然后安装 KVM
apt-get install -y kvm libvirt-bin
添加用户到libvirtd组
useradd $USER libvirtd
virsh net-destroy virtbr0 && virsh net-undefine virbr0
然后重启libvirt-bin
service libvirt-bin restart
对于单网卡使用KVM桥接方式的的用户
brctl addbr br0
ifup br0
ifconfig br0 promisc
ifconfig br0 192.168.1.100 netmask 255.55.255.0 dev br0
就可以使用KVM桥接方式网桥br0
下载 mininet vmware镜像
wget https://github.com/downloads/mininet/mininet/mininet-2.0.0-113012-amd64-ovf.zip
转化镜像 vmware 格式到 kvm支持的格式
如果使用的是vmware workstation 略过
使用KVM 并且 qemu-img 版本1.0 报错
qemu-img convert -O qcow2 mininet-vm-disk1.vmdk mininet-vm-disk1.qcow2
报错
ubuntu@node2:~/vmimg/mininet-ovf$ qemu-img convert -O qcow2 mininet-vm-disk1.vmdk mininet-vm-disk1.qcow2
qemu-img: error while reading sector 131072: Invalid argument
ubuntu@node2:~/vmimg/mininet-ovf$ qemu-img convert -f vmdk -O qcow2 mininet-vm-disk1.vmdk mininet-vm-disk1.qcow2
qemu-img: error while reading sector 131072: Invalid argument
ubuntu@node2:~/vmimg/mininet-ovf$
conversion of a VMDK image with qemu-img failed with “error while reading sector 131072: Invalid argument”解决办法http://serverfault.com/questions/429478/conversion-of-a-vmdk-image-with-qemu-img-failed-with-error-while-reading-sector
原因是qemu的版本太低需要大于1. x
cd /tmp
apt-get install apt-get install libglib2.0-dev
wget http://wiki.qemu.org/download/qemu-1.2.0.tar.bz2
tar xf qemu-1.2.0.tar.bz2
cd qemu-1.2.0 && ./configure && make -j16 (时间较长)
在/etc/libvirt/qemu/下创建mininet.xml(xml文件格式定义KVM镜像配置具体google "qemu syntax")
sudo cat mininet.xml
[sudo] password for ubuntu:
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit mininet
or other application using the libvirt API.
-->
<domain type='kvm'>
<name>mininet</name>
<uuid>3245e642-05dc-bd23-6d0e-e7582dc00660</uuid>
<memory>4194304</memory>
<currentMemory>4194304</currentMemory>
<vcpu cpuset='1,3,5,7,9,11,13,15'>4</vcpu>
<os>
<type arch='x86_64' machine='pc-1.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<cpu match='exact'>
<model>Westmere</model>
<vendor>Intel</vendor>
<feature policy='require' name='tm2'/>
<feature policy='require' name='est'/>
<feature policy='require' name='vmx'/>
<feature policy='require' name='ds'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='vme'/>
<feature policy='require' name='rdtscp'/>
<feature policy='require' name='ht'/>
<feature policy='require' name='dca'/>
<feature policy='require' name='pbe'/>
<feature policy='require' name='tm'/>
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='ds_cpl'/>
<feature policy='require' name='xtpr'/>
<feature policy='require' name='acpi'/>
<feature policy='require' name='monitor'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/mininet-vm-disk1.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<interface type='bridge'>
<mac address='52:54:00:31:05:76'/>
<source bridge='br0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
virsh create /etc/libvirt/qemu/mininet.xml
virsh consloe mininet
使用mininet:mininet
登陆修改
sudo ifconfig eth0 192.168.1.19 netmask 255.255.255.0 up
sudo route add default gw 192.168.1.1
sudo echo "nameserver 61.139.2.69" > /etc/resolv.conf
sudo echo "nameserver 61.139.2.69" > /etc/resolvconf/resolv.conf.d/base
账户 mininet
密码 mininet
配置静态IP
root@mininet-vm:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.19
gateway 192.168.1.1
netmask 255.255.255.0
root@mininet-vm:~#
参考:
- http://mininet.github.com/vm-setup-notes/
- https://github.com/mininet/mininet/downloads/
- http://serverfault.com/questions/429478/conversion-of-a-vmdk-image-with-qemu-img-failed-with-error-while-reading-sector
注意这里给出的是ubuntu12.04版本的安装教程,在ubuntu 12.10 中qemu已经是1.2版本了,不存在qemu-img convert问题。
相关推荐
该文档为openflow1.0版本的中文手册,介绍了openflow协议,mininet,OpenVSwitch,NOX,等相关使用,对于学习SDN有一定帮助。
这些VM包含以下工作组件,以及从提取之日起发生的所有错误的快照。 如果需要任何Linux知识,则很少。 如果您以前没有时间,学习Linux绝对不会是一个坏时机。 会有很多错误,但这都是全新的,所以要耐心或帮助解决它...
广东工业大学SDN-Qos实验报告,包括以下实验,每个均有实验目的、原理、步骤、结果和小结 一、 实验名称 Open vSwitch网桥管理 ...九、 实验名称:Mininet的安装 十、 实验名称:OpenFlow Packet-in/out消息
第二个实验是如何利用POX控制器和OpenFlow协议,软件编写一个自学习型交换通信模块加入到控制器中。最后在Mininet中对这广播交换通信两个模块进行网络性能仿真,结果表明Mininet平台能够以较高的保真度仿真SDN网络的...
基于Mininet对SDN / OpenFlow网络进行仿真,构建由一个三层路由器staticRouter,一个二层自学习交换机以及若干台主机构成的网络拓扑。使用POX做控制器,编程实现了网络中各个主机之间的连通性。 其中mytopo.py文件为...
人工智能-机器学习
SDN是当前网络世界的一种新方法,在本实验中,您将通过OpenFlow学习SDN的基本概念。 OpenFlow从斯坦福大学的几位工程师开始,他们创建了一个协议,该协议将具有一个逻辑上集中的控制平面,与底层的交换细节分开。 ...
项目中采用了OpenFlow协议作为SDN控制器与交换机之间的通信协议。 2. Python编程语言:Python是一种易于学习且功能强大的编程语言,在网络编程、数据处理和自动化等领域具有广泛应用。本项目使用Python实现了SDN...
这是博主之前学习SDN相关知识做的一个简单word笔记,供有兴趣的小伙伴作为一个简单的参考。如果想学习详细内容,建议去看“未来学院”的相关视频
我自己也是这时候才真正系统学习 SDN,国内第一个 SDN 中文媒体,盛科都是这一年开始大动作。同年,爱立信员工Dominique 等创办了 NoviFlow,盛科发布了 V330 交换机,BigSwitch 发布了控制器 Floodlight(ODL 和 ...
使用机器学习的软件定义网络中的TCP拥塞检测本文的思想是使用决策树算法检测SDN网络中的拥塞使用的工具POX OpenFlow控制器(强烈建议使用OF版本1.3或1.5的基于Ryu Python的控制器)。 Mininet仿真器Wireshark Iperf...
云计算网络章节讲解网络基本概念、数据中心网络、网络虚拟化、租户网络管理等内容,并实践 Mininet 搭建 OpenFlow 实验环境。 云计算安全章节讲解云安全概述、虚拟化安全、云存储安全、云数据安全等内容,并实践全...
SDN教程 SDN(软件定义的网络,软件定义网路)是一个相当大的架构,字面上虽然简单,而是一切最有问题的地方...在学习的项目上又分为四个部分(依顺序隔开): 初学者入门建议 其余章节,读者可以依需求阅读。每个项目