摘要:
这里给出了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问题。
相关推荐
SDN和Openflow详解+mininet及opendaylight环境搭建及测试.doc
SDN网络学习资料共享,openflow学习资料总结。
该文档为openflow1.0版本的中文手册,介绍了openflow协议,mininet,OpenVSwitch,NOX,等相关使用,对于学习SDN有一定帮助。
学习整理的OpenFlow相关基础知识,用于入门了解Openflow的前世今生,以及各种技术的发展优缺点
Openflow交换机初步安装测试
H3C_SDN OpenFlow Mininet 笔记.docx
OpenFlow网络试验床路由服务的设计与实现
在ubutnu12.04系统下通过安装floodlight+mininet部署OpenFlow试验平台进行抓包测试。
Title: OpenFlow Cookbook Author: Kingston Smiler. S Length: 300 pages Edition: 1 Language: English Publisher: Packt Publishing Publication Date: 2015-03-27 ISBN-10: 1783987944 ISBN-13: 9781783987948 ...
openflow简介学习课程.pptx
SDN-手_Openflow-Mininet-RYU SDN动手资源 此工作和代码源自名为 使用了实验室设置 ( ) ,( ) ,( ) ,( ) 免费,而不是自由。 主要课程内容使用Python2.7.x演示和功能,本文档旨在尝试使用Python3.7....
openflow
openflow switch 白皮书 openflow switch 白皮书 openflow switch 白皮书
OpenFlow1.3流表项各字段详细信息,助于理解SDN网络中的OpenFlow流表结构
openflow specification 最新版
OpenFlow1.3官方教程,适合新手入门SDN技术,学习OpenFlow协议规范。
openflow - 是OpenFlow协议的纯Go实现
OPENFLOW技术研究报告
openflow 交换机标准。学习sdn可以参考,用openflow协议开发的可以参考标准。
用于sdn的开发,将openflow协议中的1.3版本进行了细致翻译。