KVM (Kernel-mode Virtual Machine)

Tom Eastep

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover, and with no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.

2008/06/01



Table of Contents

Introduction
Networking Configuration

Introduction

Kernel-mode Virtual Machines (http://kvm.qumranet.com/) is a virtualization platform that leverages the virtualization capabilities available with current microprocessors from both Intel™ and AMD™. For an overview of KVM, please see my 2008 Linuxfest Northwest presentation.

I use KVM to implement a number of virtual machines running various Linux Distributions. The following diagram shows the entire network.

My personal laptop (Ursa) hosts the virtual machines. As shown in the diagram, Ursa has routes to the internet through both the Linksys™ WRT300N and through my Shorewall firewall. This allows me to test the Shorewall Multi-ISP feature, even though I only have a single internet connection

The Linux Bridges shown in the diagram are, of course, actually within their associated system (Firewall or Ursa) but I've pictured them separately.

Networking Configuration

I use a network configuration where each VM has it's own VNET and tap device and the tap devices are all configured as ports on a Linux Bridge. For clarity, I've only shown four of the virtual machines available on the system.

I run a DHCP server on the host to assign IP addresses to the VMs and I also run dmsmasq to act as a nameserver for the VMs. The latter is important when I take the laptop on the road. I'm currently running a separate ISC DHCP server but I have it on my todo list to configure dnsmasq as a DHCP server, thus eliminating one process on the system.

The bridge is configured using the script described in my Linuxfest presentation linked above. The script may be found at http://www.shorewall.net/pub/shorewall/contrib/kvm/kvm.

With this configuration, and with only a single network interface on the laptop, this is just a simple two-interface masquerading setup where the local network interface is br0. As with all bridges, br0 must be configured with the routeback option in shorewall-interfaces(5).