Virtio is a virtualization standard for network and disk device drivers where the guest OS' device drivers know they are running in a virtual environment, and cooperate with the host OS in order to get high performance network and disk operations, giving most of the performance benefits of paravirtualization.
NetworkManager is a set of co-operative tools that make networking simple and straightforward. This setup uses NetworkManager to provide a full network stack to the guest OS.
This document is a simple tutorial to take full advantage of the benefits of the technologies listed above when creating a new QEMU machine. For this, we are using an up-to-date installation of Fedora 21.
- As root on the host OS, create the br0 bridge device with the following persistent configuration:
/etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
STP=yes
BRIDGING_OPTS=priority=32768
TYPE=Bridge
BOOTPROTO=shared
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
NAME=br0
UUID=<paste the output of uuidgen>
ONBOOT=yes - Whitelist the br0 bridge device for use with qemu:
/etc/qemu/bridge.conf
allow br0 - As the normal user who will run qemu, create the disk image of the guest OS on the host OS:
$ qemu-img create -f qcow2 guest.qcow2 40G
- Define the options for qemu; you may want to save them to a script:
OPTS="-enable-kvm -drive file=guest.qcow2,if=virtio,aio=native -m 4G --machine pc,accel=kvm:xen:tcg -cpu host -soundhw hda -name GuestOS -vga std -smp cpus=1,cores=2,threads=2 -netdev tap,helper=/usr/libexec/qemu-bridge-helper,id=tap0 -device virtio-net-pci,netdev=tap0,id=nic0"
- Run the guest OS installer disk image with the virtio drivers appropriate to it:
qemu-system-x86_64 $OPTS -drive file="guestOSinstaller.iso",index=2,media=cdrom -drive file=virtio-drivers.iso,index=3,media=cdrom -boot d
- After installation, run the guest OS:
qemu-system-x86_64 $OPTS -boot c
No comments:
Post a Comment
Is your comment or question:
1. Constructive?
2. Interesting?
3. Short?
If not, please post it in your own blog.