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

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


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