<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>KVM (Kernel-mode Virtual Machine)</title><link rel="stylesheet" href="html.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="article" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id257523"></a>KVM (Kernel-mode Virtual Machine)</h2></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Tom</span> <span class="surname">Eastep</span></h3></div></div></div><div><p class="copyright">Copyright © 2008 Thomas M. Eastep</p></div><div><div class="legalnotice"><a id="id292634"></a><p>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 “<span class="quote"><a class="ulink" href="GnuCopyright.htm" target="_self">GNU Free Documentation License</a></span>”.</p></div></div><div><p class="pubdate">2008/12/15</p></div></div><hr /></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id257928">Introduction</a></span></dt><dt><span class="section"><a href="#id292638">Networking Configuration</a></span></dt></dl></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id257928"></a>Introduction</h2></div></div></div><p>Kernel-mode Virtual Machines (<a class="ulink" href="http://kvm.qumranet.com/" target="_self">http://kvm.qumranet.com/</a>) is a virtualization platform that leverages the virtualization capabilities available with current microprocessors from both <span class="trademark">Intel</span>™ and <span class="trademark">AMD</span>™. For an overview of KVM, please see my <a class="ulink" href="http://www.shorewall.net/Linuxfest-2008.pdf" target="_self">2008 Linuxfest Northwest presentation</a>.</p><p>I use KVM to implement a number of virtual machines running various Linux Distributions. The following diagram shows the entire network.</p><div align="center"><img src="images/Network2008a.png" align="middle" /></div><p>My personal laptop (Ursa) hosts the virtual machines. As shown in the diagram, Ursa has routes to the Internet through both the <span class="trademark">Linksys</span>™ WRT300N and through my Shorewall firewall. This allows me to test the <a class="ulink" href="MultiISP.html" target="_self">Shorewall Multi-ISP feature</a>.</p><p>The Linux Bridges shown in the diagram are, of course, actually within their associated system (Firewall or Ursa) but I've pictured them separately.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id292638"></a>Networking Configuration</h2></div></div></div><p>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.</p><div align="center"><img src="images/KVM1.png" align="middle" /></div><p>I run <a class="ulink" href="???" target="_self">dmsmasq</a> to act as a DHCP server and name server for the VMs.</p><p>The bridge is configured using the script described in my Linuxfest presentation linked above. The script may be found at <a class="ulink" href="http://www.shorewall.net/pub/shorewall/contrib/kvm/kvm" target="_self">http://www.shorewall.net/pub/shorewall/contrib/kvm/kvm</a>.</p><p>With this configuration, and with only a single network interface on the laptop, this is just a simple <a class="ulink" href="two-interface.xml" target="_self">two-interface masquerading setup</a> where the local network interface is <code class="filename">br0</code>. As with all bridges, <code class="filename">br0</code> must be configured with the <code class="option">routeback</code> option in <a class="ulink" href="manpages/shorewall-interfaces.html" target="_self">shorewall-interfaces</a>(5).</p><p>For additional information about this setup, including the Shorewall configuration, see <a class="ulink" href="MultiISP.html#Shared" target="_self">http://www.shorewall.net/MultiISP.html#Shared</a></p></div></div></body></html>