Starting qemu-kvm VMs with openvswitch networking

From Notes_Wiki
Revision as of 01:34, 13 March 2013 by Saurabh (talk | contribs) (Created page with "<yambe:breadcrumb>Openvswitch|Openvswitch</yambe:breadcrumb> =Starting qemu-kvm VMs with openvswitch networking= ==Manual command line based VMs using openvswitch== To use o...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<yambe:breadcrumb>Openvswitch|Openvswitch</yambe:breadcrumb>

Starting qemu-kvm VMs with openvswitch networking

Manual command line based VMs using openvswitch

To use openvswitch for a qemu-kvm VM networking when qemu-kvm VM is started using command line use:

  1. Create '/etc/ovs-ifup' script with following contents:
    #!/bin/sh
    switch='br0'
    /sbin/ifconfig $1 0.0.0.0 up
    ovs-vsctl add-port ${switch} $1
  2. Create '/etc/ovs-ifdown' script with following contents:
    #!/bin/sh
    switch='br0'
    /sbin/ifconfig $1 0.0.0.0 down
    ovs-vsctl del-port ${switch} $1
  3. Do 'chmod +x /etc/ovs-if{up,down}'
  4. To test start a qemu-kvm VM using something like
    /usr/libexec/qemu-kvm -m 2048 -smp 2 \
    -net nic,macaddr=00:11:22:EE:EE:EE \
    -net tap,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown \
    -hda <path-to-hdd-disk-image> \
    -cdrom <path-to-cdrom-disk-image> \
    -boot order=dc,menu=on
  5. Verify that openvswitch configuration worked using 'ovs-vsctl show'
  6. Access the qemu-kvm vm display using 'vncviewer localhost:<port>'


Steps learned from http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL.KVM;hb=HEAD


<yambe:breadcrumb>Openvswitch|Openvswitch</yambe:breadcrumb>