当前位置: 首页 > 大杂烩 > 正文

Installing KVM and Open vSwitch on Ubuntu[转]

Installing KVM and Open vSwitch on Ubuntu

These articles provides a very good explanation about how to install KVM and Open vSwitch on Ubuntu.

  • http://blog.scottlowe.org/2012/08/17/installing-kvm-and-open-vswitch-on-ubuntu/
  • http://networkstatic.net/installing-open-vswitch-with-kvm/

I summarize the scripts from the above URLs as follows:

ubuntu 14.04 64bit server.

1. Installing KVM and Open vSwitch on Ubuntu

sudo apt-get update && apt-get dist-upgrade
sudo apt-get install qemu-kvm libvirt-bin virt-manager bridge-utils
sudo virsh net-destroy default
sudo virsh net-autostart --disable default
sudo aptitude purge ebtables

2. Open vSwitch on Ubuntu

sudo apt-get install openvswitch-controller openvswitch-brcompat 
sudo openvswitch-switch openvswitch-datapath-source

Edit this: /etc/default/openvswitch-switch and change this line:

#BRCOMPAT=no ==> #BRCOMPAT=yes 

to build and install the necessary module

sudo module-assistant auto-install openvswitch-datapath

3. Add Open vSwitch bridge

sudo ovs-vsctl add-br br0
sudo ovs-vsctl add-port br0 eth0
sudo ovs-vsctl list port

4.Change your eth0 IP to your new br0 interface

sudo ifconfig eth0 0
sudo ifconfig br0 192.168.1.x netmask 255.255.255.0
sudo route add default gw 192.168.1.1 br0

These two scripts bring up the KVM Tap interfaces into your
bridge from the CLI.

$ cat /etc/ovs-ifup
#!/bin/sh
switch='br0'
/sbin/ifconfig $1 0.0.0.0 up
ovs-vsctl add-port ${switch} $1

$ cat /etc/ovs-ifdown
#!/bin/sh
switch='br0'
/sbin/ifconfig $1 0.0.0.0 down
ovs-vsctl del-port ${switch} $1

Then make executable

chmod +x /etc/ovs-ifup /etc/ovs-ifdown

5. BOOT HD IMG

Here are some KVM examples. Starting with the CD is easiest. No build needed for testing.

OS Install
sudo kvm -m 1024 -hda /media/Storage/imgs/centos.kvm -net nic,macaddr=00:11:22:CC:CC:C5 -net tap,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown &

CD Boot
sudo kvm -m 512 -hda /media/Storage/imgs/centos.kvm -net nic,macaddr=00:11:22:CC:CC:C5 -net tap,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -cdrom /media/Storage/vm-images/CentOS-6.2-x86_64-LiveCD.iso &

Make an Image from CD
sudo kvm -m 512 -net nic,macaddr=00:11:22:CC:CC:10 -net tap,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -cdrom /HD/Storage/vm-images/ubuntu-11.10-desktop-amd64.iso &

sudo qemu-img create -f qcow2 /media/Storage/imgs/uCentOS-6.2.img 6G

sudo kvm -m 128 -name cirros -drive file=/root/images/cirros-0.3.4-x86_64-disk.img,media=disk,format=qcow2,if=ide -boot c

本文固定链接: http://sdnhub.cn/index.php/installing-kvm-and-open-vswitch-on-ubuntu/ | 软件定义网络SDN

该日志由 sdnhub 于2015年05月24日发表在 大杂烩 分类下, 通告目前不可用,你可以至底部留下评论。
原创文章转载请注明: Installing KVM and Open vSwitch on Ubuntu[转] | 软件定义网络SDN
关键字:

Installing KVM and Open vSwitch on Ubuntu[转]:等您坐沙发呢!

发表评论

*

快捷键:Ctrl+Enter