Diff for /wikisrc/tutorials/how_to_set_up_a_guest_os_using_xen3.mdwn between versions 1.1 and 1.5

version 1.1, 2011/11/20 20:55:21 version 1.5, 2020/09/08 21:05:59
Line 1 Line 1
 **Contents**  **Contents**
   
 [[!toc levels=3]]  [[!toc levels=3]]
   
 #  Requirements  # Meta
   
 Xen3 is supported from NetBSD-4.0 onward. If you plan on using NetBSD-CURRENT,  Note that there is also a [Xen HOWTO](../../ports/xen/howto/).
 please read the article [[How to build NetBSD-current]] to do so. Guest  Arguably this content could be folded in there.
 operating systems can run from their own partitions, or from image files in  
 the main (DOM0) install.  #  Requirements
   
 This tutorial describes how to:  Xen3 is supported from NetBSD-4.0 onward. If you plan on using NetBSD-CURRENT,
   please read the article [[How to build NetBSD-current]] to do so. Guest
   * Install and configure NetBSD as a DOM0  operating systems can run from their own partitions, or from image files in
   * Install and run a NetBSD as a DOMU  the main (DOM0) install.
   * Install and run a Windows XP system as as DOMU  
   * Install and run a Debian system as a DOMU  This tutorial describes how to:
   
 #  Installing Xen tools and kernels    * Install and configure NetBSD as a DOM0 
     * Install and run a NetBSD as a DOMU 
 ##  Xen tools    * Install and run a Windows XP system as as DOMU 
     * Install and run a Debian system as a DOMU 
 To run and administer xen domains, we need the xentools3 or xentools33  
 packages which are available in pkgsrc.  #  Installing Xen tools and kernels
   
 Xen 3.1 packages are under [sysutils/xentools3](http://pkgsrc.se/sysutils/xentools3) for traditional xentools,  ##  Xen tools
 and [sysutils/xentools3-hvm](http://pkgsrc.se/sysutils/xentools3-hvm) for the additional **HVM** support to run un-  
 modified OSes such as Windows XP.  To run and administer xen domains, we need the xentools3 or xentools33
   packages which are available in pkgsrc.
 Xen 3.3 packages are under [sysutils/xentools33](http://pkgsrc.se/sysutils/xentools33). Unlike Xen 3.1, no extra  
 package is required for **HVM** support. Note, it is not possible to install  Xen 3.1 packages are under [sysutils/xentools3](http://pkgsrc.se/sysutils/xentools3) for traditional xentools,
 Xen 3.1 and Xen 3.3 packages at the same time. They conflict with each other.  and [sysutils/xentools3-hvm](http://pkgsrc.se/sysutils/xentools3-hvm) for the additional **HVM** support to run un-
   modified OSes such as Windows XP.
 **HVM** stands for **Hardware Virtualization Managed**. The benefit of hardware virtualization is that you can run OSes that don't know they are being virutalized like Windows XP, for example. However, you must have a CPU which supports this. Intel CPUs must have the 'VT' instruction. AMD CPUs will have the 'SVM' instruction. You can find out if your CPU supports HVM by taking a look at this page:  
   Xen 3.3 packages are under [sysutils/xentools33](http://pkgsrc.se/sysutils/xentools33). Unlike Xen 3.1, no extra
 <http://wiki.xensource.com/xenwiki/HVM_Compatible_Processors>  package is required for **HVM** support. Note, it is not possible to install
   Xen 3.1 and Xen 3.3 packages at the same time. They conflict with each other.
 In NetBSD 5.0 there's a new cpuctl command. This is an example output of an  
 AMD CPU:  **HVM** stands for **Hardware Virtualization Managed**. The benefit of hardware virtualization is that you can run OSes that don't know they are being virutalized like Windows XP, for example. However, you must have a CPU which supports this. Intel CPUs must have the 'VT' instruction. AMD CPUs will have the 'SVM' instruction. You can find out if your CPU supports HVM by taking a look at this page: 
   
      <http://wiki.xensource.com/xenwiki/HVM_Compatible_Processors>
      # cpuctl identify 0  
      cpu0: AMD Unknown K8 (Athlon) (686-class), 2210.22 MHz, id 0x60f82  In NetBSD 5.0 there's a new cpuctl command. This is an example output of an
      cpu0: features 0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>  AMD CPU:
      cpu0: features 0x178bfbff<PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX>  
      cpu0: features 0x178bfbff<FXSR,SSE,SSE2,HTT>      
      cpu0: features2 0x2001<SSE3,CX16>       # cpuctl identify 0
      cpu0: features3 0xebd3fbff<SCALL/RET,NOX,MXX,FFXSR,RDTSCP,LONG,3DNOW2,3DNOW>       cpu0: AMD Unknown K8 (Athlon) (686-class), 2210.22 MHz, id 0x60f82
      cpu0: features4 0x11f<LAHF,CMPLEGACY,SVM,EAPIC,ALTMOVCR0,3DNOWPREFETCH>       cpu0: features 0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>
      cpu0: "AMD Turion(tm) 64 X2 Mobile Technology TL-64"       cpu0: features 0x178bfbff<PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX>
      cpu0: I-cache 64KB 64B/line 2-way, D-cache 64KB 64B/line 2-waycpu0: L2 cache 1MB 64B/line 16-way       cpu0: features 0x178bfbff<FXSR,SSE,SSE2,HTT>
      cpu0: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative       cpu0: features2 0x2001<SSE3,CX16>
      cpu0: DTLB 32 4KB entries fully associative, 8 4MB entries fully associativecpu0: Initial APIC ID 0       cpu0: features3 0xebd3fbff<SCALL/RET,NOX,MXX,FFXSR,RDTSCP,LONG,3DNOW2,3DNOW>
      cpu0: AMD Power Management features: 0x7f<TS,FID,VID,TTP,HTC,STC,100>       cpu0: features4 0x11f<LAHF,CMPLEGACY,SVM,EAPIC,ALTMOVCR0,3DNOWPREFETCH>
      cpu0: family 0f model 08 extfamily 00 extmodel 06       cpu0: "AMD Turion(tm) 64 X2 Mobile Technology TL-64"
           cpu0: I-cache 64KB 64B/line 2-way, D-cache 64KB 64B/line 2-waycpu0: L2 cache 1MB 64B/line 16-way
        cpu0: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
 Note the **SVM** feature flag in the **features4** line indicating that       cpu0: DTLB 32 4KB entries fully associative, 8 4MB entries fully associativecpu0: Initial APIC ID 0
 **HVM** support is present on this CPU. However, this feature may be disabled       cpu0: AMD Power Management features: 0x7f<TS,FID,VID,TTP,HTC,STC,100>
 in the BIOS. In this case since NetBSD 5.0 there will show up this dmesg line       cpu0: family 0f model 08 extfamily 00 extmodel 06
 on AMD CPUs only:      
   
      Note the **SVM** feature flag in the **features4** line indicating that
      cpu0: SVM disabled by the BIOS  **HVM** support is present on this CPU. However, this feature may be disabled
      in the BIOS. In this case since NetBSD 5.0 there will show up this dmesg line
   on AMD CPUs only:
    
 Xen 3.1 (the xentools3-hvm package will automatically bring in the base      
 xentools3):       cpu0: SVM disabled by the BIOS
       
      
     # cd /usr/pkgsrc/sysutils/xentools3-hvm    
     # make install  Xen 3.1 (the xentools3-hvm package will automatically bring in the base
      xentools3):
   
 Xen 3.3:      
       # cd /usr/pkgsrc/sysutils/xentools3-hvm
          # make install
     # cd /usr/pkgsrc/sysutils/xentools33      
     # make install  
      Xen 3.3:
   
 ##  Xen kernel      
       # cd /usr/pkgsrc/sysutils/xentools33
 Next, we will get the xen hypervisor kernel itself. For NetBSD 4.x and 5.x the      # make install
 i386 port does not support 'PAE' kernels and must run the Xen 3.1 package.      
 This restriction has been removed in -current and is not relevant for the  
 amd64 port.  ##  Xen kernel
   
 For Xen 3.1, in pkgsrc this is [sysutils/xenkernel3](http://pkgsrc.se/sysutils/xenkernel3), for Xen 3.3, this is  Next, we will get the xen hypervisor kernel itself. For NetBSD 4.x and 5.x the
 [sysutils/xenkernel33](http://pkgsrc.se/sysutils/xenkernel33):  i386 port does not support 'PAE' kernels and must run the Xen 3.1 package.
   This restriction has been removed in -current and is not relevant for the
      amd64 port.
     # cd /usr/pkgsrc/sysutils/xenkernel3  
     # make install  For Xen 3.1, in pkgsrc this is [sysutils/xenkernel3](http://pkgsrc.se/sysutils/xenkernel3), for Xen 3.3, this is
      [sysutils/xenkernel33](http://pkgsrc.se/sysutils/xenkernel33):
   
 And copy it into / directory, like this:      
       # cd /usr/pkgsrc/sysutils/xenkernel3
          # make install
     # cp /usr/pkg/xen3-kernel/xen.gz /      
      
   And copy it into / directory, like this:
 Finally, decompress it so that all versions of GRUB can read it:  
       
          # cp /usr/pkg/xen3-kernel/xen.gz /
     # gunzip /xen.gz      
      
   ##  Xen DOM0 kernel
 ##  Xen DOM0 kernel  
   Lastly, we need a XEN-enabled kernel for our DOM0 domain. There are two
 Lastly, we need a XEN-enabled kernel for our DOM0 domain. There are two  possibilities: downloading the binary version, or building it from source.
 possibilities: downloading the binary version, or building it from source.  
   ##  Downloading the binary version
 ##  Downloading the binary version  
   From NetBSD-4.0 onward, NetBSD supports Xen, and provides some XEN-enabled
 From NetBSD-4.0 onward, NetBSD supports Xen, and provides some XEN-enabled  kernel directly from [[1]][36], in each `binary/kernel` directory associated
 kernel directly from [[1]][36], in each `binary/kernel` directory associated  with a particular release.
 with a particular release.  
   For example, with NetBSD-4.0, You can grab one from
 For example, with NetBSD-4.0, You can grab one from  (<ftp.NetBSD.org/pub/NetBSD/NetBSD-4.0/i386/binary/kernel>/netbsd-XEN3_DOM0.gz):
 (<ftp.NetBSD.org/pub/NetBSD/NetBSD-4.0/i386/binary/kernel>/netbsd-XEN3_DOM0.gz):  
       
          # ftp -a ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-4.0/i386/binary/kernel/netbsd-XEN3_DOM0.gz
     # ftp -a ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-4.0/i386/binary/kernel/netbsd-XEN3_DOM0.gz      
      
   The `netbsd-XEN3_DOM0.gz` file contains a gzipped version of the kernel. Just
 The `netbsd-XEN3_DOM0.gz` file contains a gzipped version of the kernel. Just  copy and move it into the root directory like this:
 copy and move it into the root directory like this:  
       
          # cp netbsd-XEN3_DOM0.gz /
     # cp netbsd-XEN3_DOM0.gz /      
      
   ##  Building it from source
 Now decompress it to avoid any issues GRUB or Xen might have with gzipped  
 kernels  Building a kernel from source is out of the scope of this section. Please
   consult [How to build a kernel](http://www.netbsd.org/docs/kernel/#how_to_build_a_kernel) from NetBSD's FAQ for more details.
      
     # gunzip /netbsd-XEN3_DOM0.gz  Once building is done, you can find them in
      `/usr/src/obj/_releasedir_/i386/binary/kernel/`. Identically to binary
   version, copy or move netbsd-XEN3_DOM0 in the root directory `/`.
 ##  Building it from source  
   #  Selecting a bootloader
 Building a kernel from source is out of the scope of this section. Please  
 consult [How to build a kernel](http://www.netbsd.org/docs/kernel/#how_to_build_a_kernel) from NetBSD's FAQ for more details.  In NetBSD 5.0 the native boot loader, /boot, can load Xen directly.
   The NetBSD 5.0 bootloader can be easily dropped into a NetBSD 4.x system by coping them into
 Once building is done, you can find them in  /boot and running installboot(8) properly.
 `/usr/src/obj/_releasedir_/i386/binary/kernel/`. Identically to binary  
 version, copy or move netbsd-XEN3_DOM0 in the root directory `/`.  ##  Updating /boot
   
 #  Selecting a bootloader  For full details refer to installboot(8), but for a standard configuration
   with VGA console and an IDE or SATA drive with an FFSv1 root file system use
 In NetBSD 5.0 the native boot loader, /boot, can load Xen directly. For  the following:
 earlier versions of NetBSD you will need to use Grub. The NetBSD 5.0  
 bootloader can be easily dropped into a NetBSD 4.x system by coping them into      
 /boot and running installboot(8) properly.      # cp /usr/mdec/boot /boot
       # installboot -v -o timeout=5 /dev/rwd0a /usr/mdec/bootxx_ffsv1
 ##  Updating /boot      
   
 For full details refer to installboot(8), but for a standard configuration  ##  Updating /boot.cfg
 with VGA console and an IDE or SATA drive with an FFSv1 root file system use  
 the following:  NetBSD 5.0 or later will already have a /boot.cfg file with a basic
   configuration. Enabling Xen support only requires one additional line in this
      case. If you're upgrading from an earlier version or do not have an existing
     # cp /usr/mdec/boot /boot  /boot.cfg use the following example:
     # installboot -v -o timeout=5 /dev/rwd0a /usr/mdec/bootxx_ffsv1  
          
       
 ##  Updating /boot.cfg      banner=Welcome to NetBSD
       banner==================
 NetBSD 5.0 or later will already have a /boot.cfg file with a basic      banner=
 configuration. Enabling Xen support only requires one additional line in this      banner=Please choose an option from the following menu:
 case. If you're upgrading from an earlier version or do not have an existing      menu=Boot normally:boot netbsd
 /boot.cfg use the following example:      menu=Boot single-user:boot netbsd -s
       menu=Boot backup kernel:boot onetbsd
          menu=Drop to boot prompt:prompt
          menu=Boot Xen with 256MB for dom0:load /netbsd-XEN3_DOM0 console=pc;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M
     banner=Welcome to NetBSD      menu=Boot Xen with 256MB for dom0 (serial):load /netbsd-XEN3_DOM0 console=com0;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M console=com1 com1=115200,8n1
     banner==================      menu=Boot Xen with dom0 in single-user mode:load /netbsd-XEN3_DOM0 -s;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M
     banner=      timeout=5
     banner=Please choose an option from the following menu:      default=1
     menu=Boot normally:boot netbsd      
     menu=Boot single-user:boot netbsd -s  
     menu=Boot backup kernel:boot onetbsd  Make sure you update the "load /netbsd-XEN3_DOM0" and the "dom0_mem=256M"
     menu=Drop to boot prompt:prompt  arguments to match your setup. On next boot select the 'Boot Xen with 256MB
     menu=Boot Xen with 256MB for dom0:load /netbsd-XEN3_DOM0 console=pc;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M  for dom0' option and make sure you see Xen kernel messages and the normal
     menu=Boot Xen with 256MB for dom0 (serial):load /netbsd-XEN3_DOM0 console=com0;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M console=com1 com1=115200,8n1  NetBSD kernel messages. Once you're satisfied it is working you can change the
     menu=Boot Xen with dom0 in single-user mode:load /netbsd-XEN3_DOM0 -s;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M  "default=1" line to "default=5" to automatically boot Xen on reboot.
     timeout=5  
     default=1  #  Setting up DOM0
      
   ##  Creating xen devices
 Make sure you update the "load /netbsd-XEN3_DOM0" and the "dom0_mem=256M"  
 arguments to match your setup. On next boot select the 'Boot Xen with 256MB  To create all xen devices, change to /dev and run ./MAKEDEV xen
 for dom0' option and make sure you see Xen kernel messages and the normal  
 NetBSD kernel messages. Once you're satisfied it is working you can change the      
 "default=1" line to "default=5" to automatically boot Xen on reboot.      cd /dev
       ./MAKEDEV xen
 #  Setting up Grub      
   
 Before installing and configuring XEN3, we need to install grub, the  This should create the devices **xencons**, **xenevt** and **xsd_kva**. If any
 bootloader required to boot our XEN-enabled system.  of these are missing you may not have updated to _CURRENT_ using the latest
   sources and you will have to create the missing device files.
 To install it, use its package provided in pkgsrc ([sysutils/grub](http://pkgsrc.se/sysutils/grub)):  
   ##  Configuring the bridge interface
      
     # cd /usr/pkgsrc/sysutils/grub  The [bridge(4)](//man.NetBSD.org/bridge.4) interface is used to provide network access to DOMUs.
     # make install  
      To use one, edit (or create) the file `/etc/ifconfig.bridge0` and insert
   following lines to:
 Building grub may take a while.  
       
 When installation is finished, you can proceed to grub's configuration in the      create
 _/grub_ directory.      !brconfig $int add bge0 stp bge0 up
       
 ##  GRUB configuration  
   Where 'bge0' should be changed to the name of the interface you want to use
 First, create `/grub` (if it is not present), and copy paste the menu.lst file  with your guest operating systems. use [ifconfig(8)](//man.NetBSD.org/ifconfig.8) to get more details
 below used by grub to read its configuration:  about your actual interfaces.
   
      ##  Rebooting into DOM0
     # mkdir /grub  
     # vi /grub/menu.lst  Time to reboot:
      
       
 This typical _/grub/menu.lst_ file should have following content:      # shutdown -r now
       
      
      If all has gone well, you should have booted into the XEN3_DOM0 kernel. Check
     #Grub config file for NetBSD/xen. Copy as /grub/menu.lst and run  this with [uname(1)](//man.NetBSD.org/uname.1):
     # grub-install /dev/rwd0d (assuming your boot device is wd0).  
     #      
     # The default entry to load will be the first one      # uname -v
     default=0      NetBSD 4.0 (XEN3_DOM0) #0: Sun Dec 16 01:20:31 PST 2007
          builds@wb34:/home/builds/ab/netbsd-4-0-RELEASE/i386/200712160005Z-obj/home/builds/ab/netbsd-4-0-RELEASE/src/sys/arch/i386/compile/XEN3_DOM0
     # boot after 10s the default entry if the user didn't hit keyboard      
     timeout=10  
      You should have **XEN3 DOM0** mentioned somewhere.
     # Same as above, but using VGA console  
     # We can use console=tty0 (Linux syntax) or console=pc (NetBSD syntax)  ##  Configuring rc scripts
     title Xen 3.0 / NetBSD (hda0, vga)  
       root(hd0,0)  Copy or symlink xend, xenbackendd and xendomains from
       kernel (hd0,a)/xen dom0_mem=514624  `/usr/pkg/share/examples/rc.d` to `/etc/rc.d`.
       module (hd0,a)/netbsd-XEN3_DOM0 bootdev=/dev/wd0a ro console=tty0  
          
     #Load a regular NetBSD/i386 kernel. Can be useful if you end up with a      # cp /usr/pkg/share/examples/rc.d/xend /etc/rc.d/
     #nonworking /xen.gz      # cp /usr/pkg/share/examples/rc.d/xenbackendd /etc/rc.d/
     title NetBSD 4.0      # cp /usr/pkg/share/examples/rc.d/xendomains /etc/rc.d/
       root (hd0,a)      
       kernel --type=netbsd /netbsd  
      Edit `/etc/rc.conf` and add the following lines:
     #Load the NetBSD bootloader, letting it load the NetBSD/i386 kernel.  
     #May be better than the above, as grub can't pass all required infos      
     #to the NetBSD/i386 kernel (e.g. console, root device, ...)      xend=YES
     title NetBSD via chain      xenbackendd=YES
     root        (hd0,a)      xendomains="dom1"
     chainloader +1      
      
     # end of grub config file.  Later on, when you have created a configuration file for 'dom1', the
      xendomains variable specified above will trigger 'dom1' to be started when the
   system is booted. At this point no configuration exists for dom1, therefore it
 Notice that the statement **dom0_mem** is allocating half a gig to Xen. If you  does nothing at this point. If you choose to name your configuration file
 have a box with 4Gb of RAM you probably want to change that to something  something else, adapt the name accordingly.
 larger. A smaller number might be wise on systems with less RAM, etc...  
   To avoid rebooting a second, start all three services:
 #  Setting up DOM0  
       
 ##  Creating xen devices      # /etc/rc.d/xend start
       # /etc/rc.d/xenbackendd start
 To create all xen devices, change to /dev and run ./MAKEDEV xen      # /etc/rc.d/xendomains start
       
      
     cd /dev  Run `ifconfig -a` to ensure the bridge interface is present and issue a `ps ax
     ./MAKEDEV xen  | grep xen` to ensure you have a similar output.
      
       
 This should create the devices **xencons**, **xenevt** and **xsd_kva**. If any      
 of these are missing you may not have updated to _CURRENT_ using the latest      12 ?     DK   0:00.00 [xenwatch]
 sources and you will have to create the missing device files.      13 ?     DK   0:00.00 [xenbus]
       411 ?     I    0:00.24 xenstored --pid-file=/var/run/xenstore.pid
 ##  Configuring the bridge interface      594 ?     IWa  0:00.26 xenconsoled
       629 ?     IW   0:00.00 /usr/pkg/bin/python2.3 /usr/pkg/sbin/xend start
 The [bridge(4)](http://netbsd.gw.com/cgi-bin/man-cgi?bridge+4+NetBSD-current) interface is used to provide network access to DOMUs.      631 ?     IWsa 0:00.02 /usr/pkg/sbin/xenbackendd
       639 ?     IWa  0:00.52 /usr/pkg/bin/python2.3 /usr/pkg/sbin/xend start
 To use one, edit (or create) the file `/etc/ifconfig.bridge0` and insert      
 following lines to:  
   The DOM0 configuration is now done. We will proceed to configuring DOMU
      domains.
     create  
     !brconfig $int add bge0 stp bge0 up  #  Configuring DOMU
      
   ##  Configuring and installing a NetBSD DOMU
 Where 'bge0' should be changed to the name of the interface you want to use  
 with your guest operating systems. use [ifconfig(8)](http://netbsd.gw.com/cgi-bin/man-cgi?ifconfig+8+NetBSD-current) to get more details  Create (or modify) `/usr/pkg/etc/xen/dom1` and include this:
 about your actual interfaces.  
       
 ##  Rebooting into DOM0      
       kernel = "/usr/src/obj/releasedir/i386/binary/kernel/netbsd-INSTALL_XEN3_DOMU.gz"
 Time to reboot:      #kernel = "/netbsd-XEN3_DOMU"
       memory = 64
          name = "dom1"
     # shutdown -r now      #vcpus = 1
          disk = [ 'phy:/dev/wd0g,0x03,w','file:/usr/src/obj/releasedir/i386/installation/cdrom/netbsd-i386.iso,0x04,r' ]
       vif = [ 'bridge=bridge0' ]
 If all has gone well, you should have booted into the XEN3_DOM0 kernel. Check      root = "/dev/wd0d"
 this with [uname(1)](http://netbsd.gw.com/cgi-bin/man-cgi?uname+1+NetBSD-current):      
   
      This configuration boots into the NetBSD sysinst program and allows you to
     # uname -v  install a NetBSD DOMU using the normal sysinst method. This configuration uses
     NetBSD 4.0 (XEN3_DOM0) #0: Sun Dec 16 01:20:31 PST 2007  a DOMU_INSTALL kernel and an ISO image provided by a successful 'build
     builds@wb34:/home/builds/ab/netbsd-4-0-RELEASE/i386/200712160005Z-obj/home/builds/ab/netbsd-4-0-RELEASE/src/sys/arch/i386/compile/XEN3_DOM0  release' and 'build iso-image'. You may be able to locate a valid Xen3
      DOMU_INSTALL kernel from <ftp://ftp.netbsd.org/pub/NetBSD-daily/> but if
   not, building a release is your best bet.
 You should have **XEN3 DOM0** mentioned somewhere.  
   In this configuration file, `/dev/wd0g` is the reserved partition for the
 ##  Configuring rc scripts  guest operating system. This should be changed to the partition you reserved
   prior to following the instructions within this document.
 Copy or symlink xend, xenbackendd and xendomains from  
 `/usr/pkg/share/examples/rc.d` to `/etc/rc.d`.  If you would like to use a physical CDROM instead of an ISO image, change the
   disk line to:
      
     # cp /usr/pkg/share/examples/rc.d/xend /etc/rc.d/      
     # cp /usr/pkg/share/examples/rc.d/xenbackendd /etc/rc.d/      disk = [ 'phy:/dev/wd0g,0x03,w','phy:/dev/cd0a,0x04,r' ]
     # cp /usr/pkg/share/examples/rc.d/xendomains /etc/rc.d/      
      
   Now boot into sysinst using the command:
 Edit `/etc/rc.conf` and add the following lines:  
       
          xm create dom1 -c
     xend=YES      
     xenbackendd=YES  
     xendomains="dom1"  The reserved partition will appear as `/dev/xbd0`. Proceed as you would with a
      normal NetBSD installation using xbd0 as the target drive and xbd1 as the
   CDROM.
 Later on, when you have created a configuration file for 'dom1', the  
 xendomains variable specified above will trigger 'dom1' to be started when the  When you have finished, run `shutdown -hp now` to dom1.
 system is booted. At this point no configuration exists for dom1, therefore it  
 does nothing at this point. If you choose to name your configuration file  Now edit `/usr/pkg/etc/xen/dom1`. Comment the INSTALL kernel and uncomment the
 something else, adapt the name accordingly.  DOMU kernel.
   
 To avoid rebooting a second, start all three services:  You should now have a working NetBSD DOMU (dom1). Boot into dom1 again with
   the command:
      
     # /etc/rc.d/xend start      
     # /etc/rc.d/xenbackendd start      xm create dom1 -c
     # /etc/rc.d/xendomains start      
      
   and ensure the file, `/etc/ttys` contains only this line or has all other
 Run `ifconfig -a` to ensure the bridge interface is present and issue a `ps ax  lines commented:
 | grep xen` to ensure you have a similar output.  
       
          console "/usr/libexec/getty Pc"         vt100   on secure
          
     12 ?     DK   0:00.00 [xenwatch]  
     13 ?     DK   0:00.00 [xenbus]  and the file `/etc/wscons.conf` is completely empty or has all lines commented
     411 ?     I    0:00.24 xenstored --pid-file=/var/run/xenstore.pid  out. These last two steps ensure no errors should be present on boot. Setting
     594 ?     IWa  0:00.26 xenconsoled  wscons=NO in `/etc/rc.conf` may effectively do the same thing.
     629 ?     IW   0:00.00 /usr/pkg/bin/python2.3 /usr/pkg/sbin/xend start  
     631 ?     IWsa 0:00.02 /usr/pkg/sbin/xenbackendd  From here, configure `/etc/rc.conf` and all runtime configuration files as you
     639 ?     IWa  0:00.52 /usr/pkg/bin/python2.3 /usr/pkg/sbin/xend start  would normally. The network interface name should be _**xennet0**_. Use this
      name when configuring an IP address.
   
 The DOM0 configuration is now done. We will proceed to configuring DOMU  More information can be obtained by referencing the [Xen user guide](http://www.cl.cam.ac.uk/Research/SRG/netos/xen/readmes/user/) and
 domains.  [the official NetBSD Xen Howto](http://www.netbsd.org/Ports/xen/howto.html). Questions can be addressed to the port-
   xen@NetBSD.org mailling list.
 #  Configuring DOMU  
   ##  Configuring and installing a Windows XP DOMU
 ##  Configuring and installing a NetBSD DOMU  
   This requires an HVM capable processor and xentools (see sections above).
 Create (or modify) `/usr/pkg/etc/xen/dom1` and include this:  
   This assumes you have a copy of the Windows install CD in /home/xen/winxp.iso,
      and wish to create a file /home/xen/winxp.img to hold the install. First
      create a blank file to hold the install. This assumes a size of 4GB (4096M).
     kernel = "/usr/src/obj/releasedir/i386/binary/kernel/netbsd-INSTALL_XEN3_DOMU.gz"  If you want a different size adjust the numbers to match:
     #kernel = "/netbsd-XEN3_DOMU"  
     memory = 64      
     name = "dom1"      # dd if=/dev/zero of=/home/xen/winxp.img bs=1m count=4096
     #vcpus = 1      
     disk = [ 'phy:/dev/wd0g,0x03,w','file:/usr/src/obj/releasedir/i386/installation/cdrom/netbsd-i386.iso,0x04,r' ]  
     vif = [ 'bridge=bridge0' ]  Create `/usr/pkg/etc/xen/win01`:
     root = "/dev/wd0d"  
          
       
 This configuration boots into the NetBSD sysinst program and allows you to      kernel = '/usr/pkg/lib/xen/boot/hvmloader'
 install a NetBSD DOMU using the normal sysinst method. This configuration uses      builder = 'hvm'
 a DOMU_INSTALL kernel and an ISO image provided by a successful 'build      memory = '400'
 release' and 'build iso-image'. You may be able to locate a valid Xen3      device_model='/usr/pkg/libexec/qemu-dm'
 DOMU_INSTALL kernel from <ftp://ftp.netbsd.org/pub/NetBSD-daily/> but if      
 not, building a release is your best bet.      disk = [ 'file:/home/xen/winxp.img,ioemu:hda,w',
                 'file:/home/xen/winxp.iso,ioemu:hdb:cdrom,r', ]
 In this configuration file, `/dev/wd0g` is the reserved partition for the      
 guest operating system. This should be changed to the partition you reserved      # Hostname
 prior to following the instructions within this document.      name = "win01"
       
 If you would like to use a physical CDROM instead of an ISO image, change the      vif = [ 'type=ioemu, bridge=bridge0' ]
 disk line to:      
       boot= 'd'
          vnc = 1
     disk = [ 'phy:/dev/wd0g,0x03,w','phy:/dev/cd0a,0x04,r' ]      usbdevice = 'tablet' # Helps with mouse pointer positioning
          
   
 Now boot into sysinst using the command:  You may want to modify the amount of memory and pathnames.
   
      Ensure you have a vncviewer installed, such as [net/tightvncviewer](http://pkgsrc.se/net/tightvncviewer) or
     xm create dom1 -c  [net/vncviewer](http://pkgsrc.se/net/vncviewer) from pkgsrc.
      
   Then start the XENU and connect to it via VNC.
 The reserved partition will appear as `/dev/xbd0`. Proceed as you would with a  
 normal NetBSD installation using xbd0 as the target drive and xbd1 as the      
 CDROM.      # xm create /usr/pkg/etc/xen/win01
       # vncviewer :0
 When you have finished, run `shutdown -hp now` to dom1.      
   
 Now edit `/usr/pkg/etc/xen/dom1`. Comment the INSTALL kernel and uncomment the  This will boot the Windows ISO image and let you install Windows as normal. As
 DOMU kernel.  Windows reboots during install you may need to restart vncviewer.
   
 You should now have a working NetBSD DOMU (dom1). Boot into dom1 again with  After install change the **boot d** to **boot c** to have the system boot
 the command:  directly from the disk image.
   
      ##  Configuring and installing a GNU/Linux DOMU
     xm create dom1 -c  
      We will do this in two steps:
   
 and ensure the file, `/etc/ttys` contains only this line or has all other    * install a GNU/Linux system, from a livecd or any installation media 
 lines commented:    * configure the DOM0 so that it can create and start the Linux DOMU. 
   
      ###  Installing a Linux distribution (soon-to-be DOMU)
     console "/usr/libexec/getty Pc"         vt100   on secure  
      Before proceeding with DOMU configuration, we will install our favorite
   GNU/Linux distribution on the computer.
 and the file `/etc/wscons.conf` is completely empty or has all lines commented  
 out. These last two steps ensure no errors should be present on boot. Setting  In order to do it, we need at least two partitions (only one, if you do not
 wscons=NO in `/etc/rc.conf` may effectively do the same thing.  consider the swap). These partitions must reside outside of the NetBSD slice,
   and may be either of primary or extended type. Of course, you can use more
 From here, configure `/etc/rc.conf` and all runtime configuration files as you  than two, but adapt your labels and partitions accordingly.
 would normally. The network interface name should be _**xennet0**_. Use this  
 name when configuring an IP address.  We do not cover the partition/slices manipulations through [fdisk(8)](//man.NetBSD.org/fdisk.8) and
   [disklabel(8)](//man.NetBSD.org/disklabel.8), as it depends strongly on how you manage your hard drive's
 More information can be obtained by referencing the [Xen user guide](http://www.cl.cam.ac.uk/Research/SRG/netos/xen/readmes/user/) and  space.
 [the official NetBSD Xen Howto](http://www.netbsd.org/Ports/xen/howto.html). Questions can be addressed to the port-  
 xen@NetBSD.org mailling list.  For this tutorial, we will use this partitioning:
   
 ##  Configuring and installing a Windows XP DOMU      
       
 This requires an HVM capable processor and xentools (see sections above).      # fdisk /dev/wd0d                                                      
       fdisk: removing corrupt bootsel information
 This assumes you have a copy of the Windows install CD in /home/xen/winxp.iso,      fdisk: Cannot determine the number of heads
 and wish to create a file /home/xen/winxp.img to hold the install. First      Disk: /dev/wd0d
 create a blank file to hold the install. This assumes a size of 4GB (4096M).      NetBSD disklabel disk geometry:
 If you want a different size adjust the numbers to match:      cylinders: 486344, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
       total sectors: 490234752
          
     # dd if=/dev/zero of=/home/xen/winxp.img bs=1m count=4096      BIOS disk geometry:
          cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
       total sectors: 490234752
 Create `/usr/pkg/etc/xen/win01`:      
       Partition table:
          0: Linux native (sysid 131)
              start 63, size 20482812 (10001 MB, Cyls 0-1274)
     kernel = '/usr/pkg/lib/xen/boot/hvmloader'              PBR is not bootable: All bytes are identical (0x00)
     builder = 'hvm'      1: Linux swap or Prime or Solaris (sysid 130)
     memory = '400'          start 20482875, size 1959930 (957 MB, Cyls 1275-1396)
     device_model='/usr/pkg/libexec/qemu-dm'              PBR is not bootable: All bytes are identical (0x00)
          2: NetBSD (sysid 169)
     disk = [ 'file:/home/xen/winxp.img,ioemu:hda,w',          start 61464690, size 428770062 (209360 MB, Cyls 3826-30515/178/63), Active
               'file:/home/xen/winxp.iso,ioemu:hdb:cdrom,r', ]      3: <UNUSED>
          Drive serial number: -286527765 (0xeeebeeeb)
     # Hostname      
     name = "win01"  
      Here, you notice that we decide to use two primary partitions for our future
     vif = [ 'type=ioemu, bridge=bridge0' ]  Linux DOMU:
      
     boot= 'd'    * partition 0 (for the **root directory /**) 
     vnc = 1    * partition 1 (for the **swap**) 
     usbdevice = 'tablet' # Helps with mouse pointer positioning  
      Labels:
   
 You may want to modify the amount of memory and pathnames.      
       
 Ensure you have a vncviewer installed, such as [net/tightvncviewer](http://pkgsrc.se/net/tightvncviewer) or      16 partitions:
 [net/vncviewer](http://pkgsrc.se/net/vncviewer) from pkgsrc.      #        size    offset     fstype [fsize bsize cpg/sgs]
        a:  30720816  61464690     4.2BSD   2048 16384     0  # (Cyl.  60976*-  91453*)
 Then start the XENU and connect to it via VNC.       b:   1049328  92185506       swap                     # (Cyl.  91453*-  92494*)
        c: 428770062  61464690     unused      0     0        # (Cyl.  60976*- 486343)
           d: 490234752         0     unused      0     0        # (Cyl.      0 - 486343)
     # xm create /usr/pkg/etc/xen/win01       e:  20480000  93234834     4.2BSD      0     0     0  # (Cyl.  92494*- 112812*)
     # vncviewer :0       f:  20480000 113714834     4.2BSD      0     0     0  # (Cyl. 112812*- 133129*)
           g:  20480000 134194834     4.2BSD      0     0     0  # (Cyl. 133129*- 153447*)
        h: 335559918 154674834     4.2BSD      0     0     0  # (Cyl. 153447*- 486343)
 This will boot the Windows ISO image and let you install Windows as normal. As       i:  20482812        63 Linux Ext2      0     0        # (Cyl.      0*-  20320*)
 Windows reboots during install you may need to restart vncviewer.       j:   1959930  20482875       swap                     # (Cyl.  20320*-  22264*)
       
 After install change the **boot d** to **boot c** to have the system boot  
 directly from the disk image.  Bear in mind that we added two labels here, namely **i** and **j**, which maps
   respectively to partition 0 and partition 1 of the disk. We will use these
 ##  Configuring and installing a GNU/Linux DOMU  labels later for DOMU configuration.
   
 We will do this in two steps:  Now that we have partitioned the disk, proceed with installing your Linux
   distribution. We will not cover that part in this tutorial. You can either
   * install a GNU/Linux system, from a livecd or any installation media  install it from an installation media (a cdrom from example), or copy files
   * configure the DOM0 so that it can create and start the Linux DOMU.  from an already installed distribution on your computer.
   
 ###  Installing a Linux distribution (soon-to-be DOMU)  Tip: to manipulate ext2/3 filesystems (the traditional fs under Linux) from
   NetBSD, you can use [sysutils/e2fsprogs](http://pkgsrc.se/sysutils/e2fsprogs) from pkgsrc:
 Before proceeding with DOMU configuration, we will install our favorite  
 GNU/Linux distribution on the computer.      
       # cd /usr/pkgsrc/sysutils/e2fsprogs
 In order to do it, we need at least two partitions (only one, if you do not      # make install
 consider the swap). These partitions must reside outside of the NetBSD slice,      
 and may be either of primary or extended type. Of course, you can use more  
 than two, but adapt your labels and partitions accordingly.  And then use e2fsck, mke2fs and [mount_ext2fs(8)](//man.NetBSD.org/mount_ext2fs.8) directly from NetBSD.
   
 We do not cover the partition/slices manipulations through [fdisk(8)](http://netbsd.gw.com/cgi-bin/man-cgi?fdisk+8+NetBSD-current) and  ###  Getting XEN aware Linux kernels
 [disklabel(8)](http://netbsd.gw.com/cgi-bin/man-cgi?disklabel+8+NetBSD-current), as it depends strongly on how you manage your hard drive's  
 space.  Once installation is done, reboot your computer and return to our Xen-NetBSD
   system.
 For this tutorial, we will use this partitioning:  
   To boot our Linux DOMU, we will need a Linux kernel supporting the XENU
      virtualisation. Depending on your Linux distribution, you can grab one from
      its repository (it is up to you to find it through aptitude, yum or whatever
     # fdisk /dev/wd0d                                                        package manager you use), or get one from the Xen binary distribution.
     fdisk: removing corrupt bootsel information  
     fdisk: Cannot determine the number of heads  To get a XENU Linux kernel from Xen binary distribution, get it directly from
     Disk: /dev/wd0d  [Xen website download page](http://www.xen.org/download/dl_31tarballs.html). Download the tarball and extract the
     NetBSD disklabel disk geometry:  **vmlinuz-*-xen** from it. In our case, with a 2.6.18 Linux kernel:
     cylinders: 486344, heads: 16, sectors/track: 63 (1008 sectors/cylinder)  
     total sectors: 490234752      
          # ftp -a http://bits.xensource.com/oss-xen/release/3.1.0/bin.tgz/xen-3.1.0-install-x86_32.tgz
     BIOS disk geometry:      # cd /tmp
     cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)      # tar -xzf xen-3.1.0-install-x86_32.tgz dist/install/boot/vmlinuz-2.6.18-xen
     total sectors: 490234752      
      
     Partition table:  **vmlinuz-2.6.18-xen** is the kernel that Xen will use to start the DOMU. Move it to any directory you like (just remember it when configuring the _kernel_ entry in the DOMU configuration file): 
     0: Linux native (sysid 131)      
         start 63, size 20482812 (10001 MB, Cyls 0-1274)      # mv dist/install/boot/vmlinuz-2.6.18-xen /vmlinuz-XEN3-DOMU
             PBR is not bootable: All bytes are identical (0x00)      
     1: Linux swap or Prime or Solaris (sysid 130)  
         start 20482875, size 1959930 (957 MB, Cyls 1275-1396)  ###  Configuring DOMU
             PBR is not bootable: All bytes are identical (0x00)  
     2: NetBSD (sysid 169)  Configuring the Linux DOMU is a bit different than a NetBSD one; some options
         start 61464690, size 428770062 (209360 MB, Cyls 3826-30515/178/63), Active  tend to differ.
     3: <UNUSED>  
     Drive serial number: -286527765 (0xeeebeeeb)  Edit (or create) the configuration file **domu-linux**, in
      `/usr/pkg/etc/xen/`:
   
 Here, you notice that we decide to use two primary partitions for our future      
 Linux DOMU:      # vi /usr/pkg/etc/xen/domu-linux
       
   * partition 0 (for the **root directory /**)  
   * partition 1 (for the **swap**)  Here's a typical config file for a Linux DOMU:
   
 Labels:      
       
          #----------------------------------------------------------------------------
          # Kernel image file. This kernel will be loaded in the new domain.
     16 partitions:      kernel = "/vmlinuz-XEN3-DOMU"
     #        size    offset     fstype [fsize bsize cpg/sgs]      
      a:  30720816  61464690     4.2BSD   2048 16384     0  # (Cyl.  60976*-  91453*)      # Memory allocation (in megabytes) for the new domain.
      b:   1049328  92185506       swap                     # (Cyl.  91453*-  92494*)      memory = 256
      c: 428770062  61464690     unused      0     0        # (Cyl.  60976*- 486343)      
      d: 490234752         0     unused      0     0        # (Cyl.      0 - 486343)      # A handy name for your new domain. This will appear in 'xm list',
      e:  20480000  93234834     4.2BSD      0     0     0  # (Cyl.  92494*- 112812*)      # and you can use this as parameters for xm in place of the domain
      f:  20480000 113714834     4.2BSD      0     0     0  # (Cyl. 112812*- 133129*)      # number. All domains must have different names.
      g:  20480000 134194834     4.2BSD      0     0     0  # (Cyl. 133129*- 153447*)      #
      h: 335559918 154674834     4.2BSD      0     0     0  # (Cyl. 153447*- 486343)      name = "domu-linux"
      i:  20482812        63 Linux Ext2      0     0        # (Cyl.      0*-  20320*)      
      j:   1959930  20482875       swap                     # (Cyl.  20320*-  22264*)      # Which CPU to start domain on (only relevant for SMP hardware).  CPUs
          # numbered starting from ``0''.
       #
 Bear in mind that we added two labels here, namely **i** and **j**, which maps      cpu = "^1"   # leave to Xen to pick
 respectively to partition 0 and partition 1 of the disk. We will use these      
 labels later for DOMU configuration.      #----------------------------------------------------------------------------
       # Define network interfaces for the new domain.
 Now that we have partitioned the disk, proceed with installing your Linux      
 distribution. We will not cover that part in this tutorial. You can either      # Number of network interfaces (must be at least 1). Default is 1.
 install it from an installation media (a cdrom from example), or copy files      vif = [ '' ]
 from an already installed distribution on your computer.      
       # Define MAC and/or bridge for the network interfaces.
 Tip: to manipulate ext2/3 filesystems (the traditional fs under Linux) from      #
 NetBSD, you can use [sysutils/e2fsprogs](http://pkgsrc.se/sysutils/e2fsprogs) from pkgsrc:      # The MAC address specified in ``mac'' is the one used for the interface
       # in the new domain. The interface in domain0 will use this address XOR'd
          # with 00:00:00:01:00:00 (i.e. aa:00:00:51:02:f0 in our example). Random
     # cd /usr/pkgsrc/sysutils/e2fsprogs      # MACs are assigned if not given.
     # make install      #
          # ``bridge'' is a required parameter, which will be passed to the
       # vif-script called by xend(8) when a new domain is created to configure
 And then use e2fsck, mke2fs and [mount_ext2fs(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount_ext2fs+8+NetBSD-current) directly from NetBSD.      # the new xvif interface in domain0.
       #
 ###  Getting XEN aware Linux kernels      # In this example, the xvif is added to bridge0, which should have been
       # set up prior to the new domain being created -- either in the
 Once installation is done, reboot your computer and return to our Xen-NetBSD      # ``network'' script or using a /etc/ifconfig.bridge0 file.
 system.      #
       vif = [ 'mac=aa:00:00:50:02:f0, bridge=bridge0' ]
 To boot our Linux DOMU, we will need a Linux kernel supporting the XENU      
 virtualisation. Depending on your Linux distribution, you can grab one from      #----------------------------------------------------------------------------
 its repository (it is up to you to find it through aptitude, yum or whatever      # Define the disk devices you want the domain to have access to, and
 package manager you use), or get one from the Xen binary distribution.      # what you want them accessible as.
       #
 To get a XENU Linux kernel from Xen binary distribution, get it directly from      # Each disk entry is of the form:
 [Xen website download page](http://www.xen.org/download/dl_31tarballs.html). Download the tarball and extract the      #
 **vmlinuz-*-xen** from it. In our case, with a 2.6.18 Linux kernel:      #       phy:DEV,VDEV,MODE
       #
          # where DEV is the device, VDEV is the device name the domain will see,
     # ftp -a http://bits.xensource.com/oss-xen/release/3.1.0/bin.tgz/xen-3.1.0-install-x86_32.tgz      # and MODE is r for read-only, w for read-write.  You can also create
     # cd /tmp      # file-backed domains using disk entries of the form:
     # tar -xzf xen-3.1.0-install-x86_32.tgz dist/install/boot/vmlinuz-2.6.18-xen      #
          #       file:PATH,VDEV,MODE
       #
 **vmlinuz-2.6.18-xen** is the kernel that Xen will use to start the DOMU. Move it to any directory you like (just remember it when configuring the _kernel_ entry in the DOMU configuration file):      # where PATH is the path to the file used as the virtual disk, and VDEV
          # and MODE have the same meaning as for ``phy'' devices.
     # mv dist/install/boot/vmlinuz-2.6.18-xen /vmlinuz-XEN3-DOMU      #
          # /dev/wd0i will be seen as "hda1" under DOMU (the root partition)
       # /dev/wd0j will be seen as "hda2" under DOMU (the swap)
 ###  Configuring DOMU      #
       disk = [ 'phy:/dev/wd0i,hda1,w','phy:/dev/wd0j,hda2,w' ]
 Configuring the Linux DOMU is a bit different than a NetBSD one; some options      
 tend to differ.      #----------------------------------------------------------------------------
       # Set the kernel command line for the new domain.
 Edit (or create) the configuration file **domu-linux**, in      
 `/usr/pkg/etc/xen/`:      # Set root device.
       root = "/dev/hda1"
          
     # vi /usr/pkg/etc/xen/domu-linux  
      Now, you should be able to start your first Linux DOMU!
   
 Here's a typical config file for a Linux DOMU:      
       # xm create -c /usr/pkg/etc/xen/domu-linux
          
      
     #----------------------------------------------------------------------------  #  Possible caveats
     # Kernel image file. This kernel will be loaded in the new domain.  
     kernel = "/vmlinuz-XEN3-DOMU"  If you intend to have more than one box configured with the above
      configuration on the same network, you will most likely have to specify a
     # Memory allocation (in megabytes) for the new domain.  unique MAC address per guest OS, otherwise it is likely you will have a
     memory = 256  conflict. I'm not sure if the MAC assignment is random, incremental or if Xen
      is able to check for the existence of the proposed MAC address, so specifying
     # A handy name for your new domain. This will appear in 'xm list',  the MAC address is recommended.
     # and you can use this as parameters for xm in place of the domain  
     # number. All domains must have different names.  Here is a method to assign a MAC address to a newly created Xen Domu. First as
     #  described before, use the following vif parameter in your config file :
     name = "domu-linux"  
          
     # Which CPU to start domain on (only relevant for SMP hardware).  CPUs      
     # numbered starting from ``0''.      vif = [ 'bridge=bridge0' ]
     #      
     cpu = "^1"   # leave to Xen to pick  
      Then, run the Xen DomU and, once logged run the following command :
     #----------------------------------------------------------------------------  
     # Define network interfaces for the new domain.      
          
     # Number of network interfaces (must be at least 1). Default is 1.      # ifconfig xennet0
     vif = [ '' ]      
          Output Sample : 
     # Define MAC and/or bridge for the network interfaces.      
     #      xennet0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
     # The MAC address specified in ``mac'' is the one used for the interface              capabilities=2800<TCP4CSUM_Tx,UDP4CSUM_Tx>
     # in the new domain. The interface in domain0 will use this address XOR'd              enabled=0
     # with 00:00:00:01:00:00 (i.e. aa:00:00:51:02:f0 in our example). Random              address: 00:16:3e:2e:32:5f
     # MACs are assigned if not given.              inet 192.168.4.81 netmask 0xffffff00 broadcast 192.168.4.255
     #              inet6 fe80::216:3eff:fe2e:325f%xennet0 prefixlen 64 scopeid 0x2
     # ``bridge'' is a required parameter, which will be passed to the      
     # vif-script called by xend(8) when a new domain is created to configure      
     # the new xvif interface in domain0.  
     #  A MAC address is automaticaly generated, use it in your config file with the
     # In this example, the xvif is added to bridge0, which should have been  following syntax :
     # set up prior to the new domain being created -- either in the  
     # ``network'' script or using a /etc/ifconfig.bridge0 file.      
     #      
     vif = [ 'mac=aa:00:00:50:02:f0, bridge=bridge0' ]      vif = [ 'mac=00:16:3e:2e:32:5f, bridge=bridge0' ]
          
     #----------------------------------------------------------------------------  
     # Define the disk devices you want the domain to have access to, and  And now you can restart the Xen DomU.
     # what you want them accessible as.  
     #  Please, note that the MAC Address MUST start with "00:16:3e".
     # Each disk entry is of the form:  
     #    
     #       phy:DEV,VDEV,MODE  
     #  #  See also
     # where DEV is the device, VDEV is the device name the domain will see,  
     # and MODE is r for read-only, w for read-write.  You can also create    * [The official NetBSD Xen Howto](http://www.netbsd.org/Ports/xen/howto.html)
     # file-backed domains using disk entries of the form:    * [The official Xen Wiki](http://wiki.xensource.com/xenwiki/)
     #  
     #       file:PATH,VDEV,MODE  
     #  
     # where PATH is the path to the file used as the virtual disk, and VDEV  
     # and MODE have the same meaning as for ``phy'' devices.  
     #  
     # /dev/wd0i will be seen as "hda1" under DOMU (the root partition)  
     # /dev/wd0j will be seen as "hda2" under DOMU (the swap)  
     #  
     disk = [ 'phy:/dev/wd0i,hda1,w','phy:/dev/wd0j,hda2,w' ]  
      
     #----------------------------------------------------------------------------  
     # Set the kernel command line for the new domain.  
      
     # Set root device.  
     root = "/dev/hda1"  
      
   
 Now, you should be able to start your first Linux DOMU!  
   
      
     # xm create -c /usr/pkg/etc/xen/domu-linux  
      
   
 #  Possible caveats  
   
 If you intend to have more than one box configured with the above  
 configuration on the same network, you will most likely have to specify a  
 unique MAC address per guest OS, otherwise it is likely you will have a  
 conflict. I'm not sure if the MAC assignment is random, incremental or if Xen  
 is able to check for the existence of the proposed MAC address, so specifying  
 the MAC address is recommended.  
   
 Here is a method to assign a MAC address to a newly created Xen Domu. First as  
 described before, use the following vif parameter in your config file :  
   
      
      
     vif = [ 'bridge=bridge0' ]  
      
   
 Then, run the Xen DomU and, once logged run the following command :  
   
      
      
     # ifconfig xennet0  
      
     Output Sample :  
      
     xennet0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500  
             capabilities=2800<TCP4CSUM_Tx,UDP4CSUM_Tx>  
             enabled=0  
             address: 00:16:3e:2e:32:5f  
             inet 192.168.4.81 netmask 0xffffff00 broadcast 192.168.4.255  
             inet6 fe80::216:3eff:fe2e:325f%xennet0 prefixlen 64 scopeid 0x2  
      
      
   
 A MAC address is automaticaly generated, use it in your config file with the  
 following syntax :  
   
      
      
     vif = [ 'mac=00:16:3e:2e:32:5f, bridge=bridge0' ]  
      
   
 And now you can restart the Xen DomU.  
   
 Please, note that the MAC Address MUST start with "00:16:3e".  
   
    
   
 #  See also  
   
   * [The official NetBSD Xen Howto](http://www.netbsd.org/Ports/xen/howto.html)  
   * [The official Xen Wiki](http://wiki.xensource.com/xenwiki/)  
   

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


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