Difference between revisions of "Starting qemu-kvm VMs with openvswitch networking"
From Notes_Wiki
(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...") |
m |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Virtualization tools]] > [[Openvswitch]] > [[Starting qemu-kvm VMs with openvswitch networking]] | |||
==Manual command line based VMs using openvswitch== | ==Manual command line based VMs using openvswitch== | ||
Line 33: | Line 31: | ||
#Verify that openvswitch configuration worked using '<tt>ovs-vsctl show</tt>' | #Verify that openvswitch configuration worked using '<tt>ovs-vsctl show</tt>' | ||
#Access the qemu-kvm vm display using '<tt>vncviewer localhost:<port></tt>' | #Access the qemu-kvm vm display using '<tt>vncviewer localhost:<port></tt>' | ||
==Automated VMs using virt-manager== | |||
To create a openvswitch networked VM using virt-manager use: | |||
#Ensure that bridge module is not loaded | |||
#Start virt-manager and create VM as usual | |||
#'''Remember to select customize configuration before install''' | |||
#In advanced network configuration choose specify shared device name with value such as 'br0' | |||
#Click finish to create VM | |||
#In NIC configuration one of the source devices should be openvswitch device with tag 'macvtap'. Use the given bridge with device mode 'Hypervisor default' and Source mode 'Bridge' (VEPA seems to work too). In the virtual port configuration of the switch Type should be 'openvswitch' and all other values can be left blank. | |||
#Start the VM and verify that network is working as expected. | |||
Line 38: | Line 49: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Virtualization tools]] > [[Openvswitch]] > [[Starting qemu-kvm VMs with openvswitch networking]] |
Latest revision as of 13:05, 24 August 2022
Home > CentOS > CentOS 6.x > Virtualization tools > Openvswitch > 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:
- 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
- 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
- Do 'chmod +x /etc/ovs-if{up,down}'
- 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
- Verify that openvswitch configuration worked using 'ovs-vsctl show'
- Access the qemu-kvm vm display using 'vncviewer localhost:<port>'
Automated VMs using virt-manager
To create a openvswitch networked VM using virt-manager use:
- Ensure that bridge module is not loaded
- Start virt-manager and create VM as usual
- Remember to select customize configuration before install
- In advanced network configuration choose specify shared device name with value such as 'br0'
- Click finish to create VM
- In NIC configuration one of the source devices should be openvswitch device with tag 'macvtap'. Use the given bridge with device mode 'Hypervisor default' and Source mode 'Bridge' (VEPA seems to work too). In the virtual port configuration of the switch Type should be 'openvswitch' and all other values can be left blank.
- Start the VM and verify that network is working as expected.
Steps learned from http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL.KVM;hb=HEAD
Home > CentOS > CentOS 6.x > Virtualization tools > Openvswitch > Starting qemu-kvm VMs with openvswitch networking