Diff for /wikisrc/ports/xen/howto.mdwn between versions 1.5 and 1.14

version 1.5, 2013/11/01 12:27:37 version 1.14, 2014/12/23 23:43:27
Line 1 Line 1
 <table>  
 <tbody>  
 <tr class="odd">  
 <td align="left"><a href="../../about/disclaimer.html#bsd-daemon"></a></td>  
 <td align="left"><h1>Table Of Contents</h1>  
 <ul>  
 <li>Introduction</li>  
 <li>Installing NetBSD as privileged domain (Dom0)</li>  
 <li>Creating an unprivileged NetBSD domain (DomU)</li>  
 <li>Creating an unprivileged Linux domain (DomU)</li>  
 <li>Creating an unprivileged Solaris domain (DomU)</li>  
 <li>Using PCI devices in guest domains</li>  
 <li>Links and further information</li>  
 </ul></td>  
 </tr>  
 </tbody>  
 </table>  
   
 Introduction  Introduction
 ------------  ============
   
 [![[Xen  [![[Xen
 screenshot]](../../gallery/in-Action/hubertf-xens.png)](../../gallery/in-Action/hubertf-xen.png)  screenshot]](http://www.netbsd.org/gallery/in-Action/hubertf-xens.png)](../../gallery/in-Action/hubertf-xen.png)
   
 Xen is a virtual machine monitor for x86 hardware (requires i686-class  Xen is a virtual machine monitor or hypervisor for x86 hardware
 CPUs), which supports running multiple guest operating systems on a  (i686-class or higher), which supports running multiple guest
 single machine. Guest OSes (also called “domains”) require a modified  operating systems on a single physical machine.  With Xen, one uses
 kernel which supports Xen hypercalls in replacement to access to the  the Xen kernel to control the CPU, memory and console, a dom0
 physical hardware. At boot, the Xen kernel (also known as the Xen  operating system which mediates access to other hardware (e.g., disks,
 hypervisor) is loaded (via the bootloader) along with the guest kernel  network, USB), and one or more domU operating systems which operate in
 for the first domain (called *domain0*). The Xen kernel has to be loaded  an unprivileged virtualized environment.  IO requests from the domU
 using the multiboot protocol. You would use the NetBSD boot loader for  systems are forwarded by the hypervisor (Xen) to the dom0 to be
 this, or alternatively the `grub` boot loader (`grub` has some  fulfilled.
 limitations, detailed below). *domain0* has special privileges to access  
 the physical hardware (PCI and ISA devices), administrate other domains  Xen supports two styles of guests.  The original is Para-Virtualized
 and provide virtual devices (disks and network) to other domains that  (PV) which means that the guest OS does not attempt to access hardware
 lack those privileges. For more details, see [](http://www.xen.org/).  directly, but instead makes hypercalls to the hypervisor.  This is
   analogous to a user-space program making system calls.  (The dom0
 NetBSD can be used for both *domain0 (Dom0)* and further, unprivileged  operating system uses PV calls for some functions, such as updating
 (DomU) domains. (Actually there can be multiple privileged domains  memory mapping page tables, but has direct hardware access for disk
 accessing different parts of the hardware, all providing virtual devices  and network.)   PV guests must be specifically coded for Xen.
 to unprivileged domains. We will only talk about the case of a single  
 privileged domain, *domain0*). *domain0* will see physical devices much  The more recent style is HVM, which means that the guest does not have
 like a regular i386 or amd64 kernel, and will own the physical console  code for Xen and need not be aware that it is running under Xen.
 (VGA or serial). Unprivileged domains will only see a character-only  Attempts to access hardware registers are trapped and emulated.  This
 virtual console, virtual disks (`xbd`) and virtual network interfaces  style is less efficient but can run unmodified guests.
 (`xennet`) provided by a privileged domain (usually *domain0*). xbd  
 devices are connected to a block device (i.e., a partition of a disk,  At boot, the dom0 kernel is loaded as module with Xen as the kernel.
 raid, ccd, ... device) in the privileged domain. xennet devices are  The dom0 can start one or more domUs.  (Booting is explained in detail
 connected to virtual devices in the privileged domain, named  in the dom0 section.)
 xvif\<domain number\>.\<if number for this domain\>, e.g., xvif1.0. Both  
 xennet and xvif devices are seen as regular Ethernet devices (they can  NetBSD supports Xen in that it can serve as dom0, be used as a domU,
 be seen as a crossover cable between 2 PCs) and can be assigned  and that Xen kernels and tools are available in pkgsrc.  This HOWTO
 addresses (and be routed or NATed, filtered using IPF, etc ...) or be  attempts to address both the case of running a NetBSD dom0 on hardware
 added as part of a bridge.  and running NetBSD as a domU in a VPS.
   
   Prerequisites
   -------------
   
   Installing NetBSD/Xen is not extremely difficult, but it is more
   complex than a normal installation of NetBSD.
   
   This HOWTO presumes a basic familiarity with the Xen system
   architecture.
   
   This HOWTO presumes familiarity with installing NetBSD on i386/amd64
   hardware and installing software from pkgsrc.
   
 Installing NetBSD as privileged domain (Dom0)  For more details on Xen, see [](http://www.xen.org/).
 ---------------------------------------------  
   Installing Xen with NetBSD as privileged domain (dom0)
   ======================================================
   
   Note that it doesn't make sense to talk about installing a dom0 OS
   without also installing Xen itself.
   
 First do a NetBSD/i386 or NetBSD/amd64  First do a NetBSD/i386 or NetBSD/amd64
 [installation](../../docs/guide/en/chap-inst.html) of the 5.1 release  [installation](../../docs/guide/en/chap-inst.html) of the 5.1 release
Line 211  Install grub with the following command: Line 210  Install grub with the following command:
     Done.      Done.
                       
   
 Creating an unprivileged NetBSD domain (DomU)  Creating unprivileged domains (domU)
   ====================================
   
   Creating domUs is almost entirely independent of operating system.  We
   first explain NetBSD, and then differences for Linux and Solaris.
   
   Creating an unprivileged NetBSD domain (domU)
 ---------------------------------------------  ---------------------------------------------
   
 Once you have *domain0* running, you need to start the xen tool daemon  Once you have *domain0* running, you need to start the xen tool daemon
Line 354  working vif-bridge is also provided with Line 359  working vif-bridge is also provided with
   
     #!/bin/sh      #!/bin/sh
     #============================================================================      #============================================================================
     # $NetBSD: vif-bridge-nbsd,v 1.3 2005/11/08 00:47:35 jlam Exp $      # $NetBSD: howto.mdwn,v 1.13 2014/12/23 23:40:11 gdt Exp $
     #      #
     # /usr/pkg/etc/xen/vif-bridge      # /usr/pkg/etc/xen/vif-bridge
     #      #
Line 478  in rc.conf. This way, the domain will be Line 483  in rc.conf. This way, the domain will be
   
 Your domain should be now ready to work, enjoy.  Your domain should be now ready to work, enjoy.
   
 Creating an unprivileged Linux domain (DomU)  Creating an unprivileged Linux domain (domU)
 --------------------------------------------  --------------------------------------------
   
 Creating unprivileged Linux domains isn't much different from  Creating unprivileged Linux domains isn't much different from
Line 522  To get the linux console right, you need Line 527  To get the linux console right, you need
 to your configuration since not all linux distributions auto-attach a  to your configuration since not all linux distributions auto-attach a
 tty to the xen console.  tty to the xen console.
   
 Creating an unprivileged Solaris domain (DomU)  Creating an unprivileged Solaris domain (domU)
 ----------------------------------------------  ----------------------------------------------
   
 Download an Opensolaris [release](http://opensolaris.org/os/downloads/)  Download an Opensolaris [release](http://opensolaris.org/os/downloads/)
Line 659  Restart the guest to verify it works cor Line 664  Restart the guest to verify it works cor
                         
   
 Using PCI devices in guest domains  Using PCI devices in guest domains
 ==================================  ----------------------------------
   
 The domain0 can give other domains access to selected PCI devices. This  The domain0 can give other domains access to selected PCI devices. This
 can allow, for example, a non-privileged domain to have access to a  can allow, for example, a non-privileged domain to have access to a
Line 734  to use PCI devices in a domU. Here's a k Line 739  to use PCI devices in a domU. Here's a k
 Links and further information  Links and further information
 =============================  =============================
   
 -   The HowTo on  -   The [HowTo on Installing into RAID-1](http://mail-index.NetBSD.org/port-xen/2006/03/01/0010.html)
     Installing into RAID-1      explains how to set up booting a dom0 with Xen using grub 
     gives some hints on using Xen (grub) with NetBSD's RAIDframe      with NetBSD's RAIDframe.  (This is obsolete with the use of
 -   Harold Gutch wrote documentation on      NetBSD's native boot.)
     setting up a Linux DomU with a NetBSD Dom0  
 -   An example of how to use NetBSD's native bootloader to load  -   An example of how to use NetBSD's native bootloader to load
     NetBSD/Xen instead of Grub can be found in the i386/amd64 MAN.BOOT.8      NetBSD/Xen instead of Grub can be found in the i386/amd64 boot(8)
     and MAN.BOOT.CFG.5 manpages.      and boot.cfg(5) manpages.
   

Removed from v.1.5  
changed lines
  Added in v.1.14


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb