--- wikisrc/ports/xen/howto.mdwn 2014/12/23 23:25:57 1.11 +++ wikisrc/ports/xen/howto.mdwn 2014/12/23 23:37:56 1.12 @@ -4,37 +4,51 @@ Introduction [![[Xen 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 -CPUs), which supports running multiple guest operating systems on a -single machine. Guest OSes (also called “domains”) require a modified -kernel which supports Xen hypercalls in replacement to access to the -physical hardware. At boot, the Xen kernel (also known as the Xen -hypervisor) is loaded (via the bootloader) along with the guest kernel -for the first domain (called *domain0*). The Xen kernel has to be loaded -using the multiboot protocol. You would use the NetBSD boot loader for -this, or alternatively the `grub` boot loader (`grub` has some -limitations, detailed below). *domain0* has special privileges to access -the physical hardware (PCI and ISA devices), administrate other domains -and provide virtual devices (disks and network) to other domains that -lack those privileges. For more details, see [](http://www.xen.org/). - -NetBSD can be used for both *domain0 (Dom0)* and further, unprivileged -(DomU) domains. (Actually there can be multiple privileged domains -accessing different parts of the hardware, all providing virtual devices -to unprivileged domains. We will only talk about the case of a single -privileged domain, *domain0*). *domain0* will see physical devices much -like a regular i386 or amd64 kernel, and will own the physical console -(VGA or serial). Unprivileged domains will only see a character-only -virtual console, virtual disks (`xbd`) and virtual network interfaces -(`xennet`) provided by a privileged domain (usually *domain0*). xbd -devices are connected to a block device (i.e., a partition of a disk, -raid, ccd, ... device) in the privileged domain. xennet devices are -connected to virtual devices in the privileged domain, named -xvif\.\, e.g., xvif1.0. Both -xennet and xvif devices are seen as regular Ethernet devices (they can -be seen as a crossover cable between 2 PCs) and can be assigned -addresses (and be routed or NATed, filtered using IPF, etc ...) or be -added as part of a bridge. +Xen is a virtual machine monitor or hypervisor for x86 hardware +(i686-class or higher), which supports running multiple guest +operating systems on a single physical machine. With Xen, one uses +the Xen kernel to control the CPU, memory and console, a dom0 +operating system which mediates access to other hardware (e.g., disks, +network, USB), and one or more domU operating systems which operate in +an unprivileged virtualized environment. IO requests from the domU +systems are forwarded by the hypervisor (Xen) to the dom0 to be +fulfilled. + +Xen supports two styles of guests. The original is Para-Virtualized +(PV) which means that the guest OS does not attempt to access hardware +directly, but instead makes hypercalls to the hypervisor. This is +analogous to a user-space program making system calls. (The dom0 +operating system uses PV calls for some functions, such as updating +memory mapping page tables, but has direct hardware access for disk +and network.) PV guests must be specifically coded for Xen. + +The more recent style is HVM, which means that the guest does not have +code for Xen and need not be aware that it is running under Xen. +Attempts to access hardware registers are trapped and emulated. This +style is less efficient but can run unmodified guests. + +At boot, the dom0 kernel is loaded as module with Xen as the kernel. +The dom0 can start one or more domUs. (Booting is explained in detail +in the dom0 section.) + +NetBSD supports Xen in that it can serve as dom0, be used as a domU, +and that Xen kernels and tools are available in pkgsrc. This HOWTO +attempts to address both the case of running a NetBSD dom0 on hardware +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. + +For more details on Xen, see [](http://www.xen.org/). Installing NetBSD as privileged domain (Dom0) --------------------------------------------- @@ -336,7 +350,7 @@ working vif-bridge is also provided with #!/bin/sh #============================================================================ - # $NetBSD: howto.mdwn,v 1.10 2014/12/23 23:08:37 gdt Exp $ + # $NetBSD: howto.mdwn,v 1.11 2014/12/23 23:25:57 gdt Exp $ # # /usr/pkg/etc/xen/vif-bridge #