aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--en_US.ISO8859-1/books/handbook/virtualization/Makefile15
-rw-r--r--en_US.ISO8859-1/books/handbook/virtualization/chapter.sgml485
2 files changed, 500 insertions, 0 deletions
diff --git a/en_US.ISO8859-1/books/handbook/virtualization/Makefile b/en_US.ISO8859-1/books/handbook/virtualization/Makefile
new file mode 100644
index 0000000000..4c89488e9c
--- /dev/null
+++ b/en_US.ISO8859-1/books/handbook/virtualization/Makefile
@@ -0,0 +1,15 @@
+#
+# Build the Handbook with just the content from this chapter.
+#
+# $FreeBSD$
+#
+
+CHAPTERS= virtualization/chapter.sgml
+
+VPATH= ..
+
+MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
+
+DOC_PREFIX?= ${.CURDIR}/../../../..
+
+.include "../Makefile"
diff --git a/en_US.ISO8859-1/books/handbook/virtualization/chapter.sgml b/en_US.ISO8859-1/books/handbook/virtualization/chapter.sgml
new file mode 100644
index 0000000000..23141cbc46
--- /dev/null
+++ b/en_US.ISO8859-1/books/handbook/virtualization/chapter.sgml
@@ -0,0 +1,485 @@
+<!--
+ The FreeBSD Documentation Project
+
+ $FreeBSD$
+-->
+
+<chapter id="virtualization">
+ <chapterinfo>
+ <authorgroup>
+ <author>
+ <firstname>Murray</firstname>
+ <surname>Stokely</surname>
+ <contrib>Contributed by </contrib>
+ </author>
+ </authorgroup>
+ <!-- Mar 2007 -->
+ </chapterinfo>
+
+ <title>Virtualization</title>
+
+ <sect1 id="virualization-synopsis">
+ <title>Synopsis</title>
+
+ <para>Virtualization software allows multiple operating systems
+ to run simultaneously on the same computer. Such software
+ systems for PCs often involve a host operating system which runs
+ the virtualization software and supports any number of guest
+ operating systems.</para>
+
+ <para>After reading this chapter, you will know:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>The difference between a host operating system and a
+ guest operating system.</para>
+ </listitem>
+
+ <listitem>
+ <para>How to install FreeBSD on Linux with Xen.</para>
+ </listitem>
+
+ <listitem>
+ <para>How to install FreeBSD on an Intel-based Apple Macintosh
+ computer.</para>
+ </listitem>
+
+ <listitem>
+ <para>How to tune a FreeBSD system for best performance under
+ virtualization.</para>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>Before reading this chapter, you should:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Understand the basics of &unix; and FreeBSD (<xref
+ linkend="basics">).</para>
+ </listitem>
+
+ <listitem><para>Know how to install FreeBSD (<xref
+ linkend="install">).</para></listitem>
+
+ <listitem><para>Know how to set up your network connection (<xref
+ linkend="advanced-networking">).</para></listitem>
+
+ <listitem><para>Know how to install additional third-party
+ software (<xref linkend="ports">).</para></listitem>
+ </itemizedlist>
+
+ </sect1>
+
+
+
+ <sect1 id="virtualization-guest">
+ <title>FreeBSD as a Guest OS</title>
+
+ <sect2 id="virtualization-guest-parallels">
+ <title>Parallels on MacOS</title>
+
+ <para>Parallels Desktop for Mac is a commercial software product
+ available for Intel based Apple Mac computers running MacOS
+ 10.4.6 or higher. FreeBSD is a fully supported guest
+ operating system. Once Parallels has been installed on MacOS
+ X, the user must configure a virtual machine and then install
+ the desired guest operating system.</para>
+
+ <sect3 id="virtualization-guest-parallels-install">
+ <title>Installing FreeBSD on Parallels/MacOS X</title>
+
+ <para>The first step in installing FreeBSD on MacOS
+ X/Parallels is to create a new virtual machine for
+ installing FreeBSD. Select 'FreeBSD' as the Guest OS Type
+ when prompted, and choose a reasonable amount of disk and
+ memory depending on your plans for this virtual FreeBSD
+ instance. 4GB and 512MB of RAM work well for most uses of
+ FreeBSD under Parallels.</para>
+
+ <para>After your FreeBSD virtual machine has been created,
+ you will need to install FreeBSD on it. This is best done
+ with an official FreeBSD CDROM or with an ISO image
+ downloaded from an official FTP site. When you have the
+ appropriate ISO image on your local Mac filesystem or a
+ CDROM in your Mac's CD drive, click on the disc icon in the
+ bottom right corner of your FreeBSD Parallels window. This
+ will bring up a window that allows you to associate the
+ CDROM drive in your virtual machine with an ISO file on
+ disk or with your real CDROM drive.</para>
+
+ <para>Once you have made this association with your CDROM
+ source, reboot your FreeBSD virtual machine as normal by
+ clicking the reboot icon. Parallels will reboot with a
+ special BIOS that first checks if you have a CDROM just as a
+ normal BIOS would do. In this case it will find the FreeBSD
+ installation media and begin a normal sysinstall based
+ installation as described in <xref linkend="install">. You
+ may install, but do not attempt to configure X-Windows at
+ this time. When you have finished the installation, reboot
+ into your newly installed FreeBSD virtual machine.</para>
+
+ </sect3>
+
+ <sect3 id="virtualization-guest-parallels-configure">
+ <title>Configuring FreeBSD on MacOS X/Parallels</title>
+
+ <para>After FreeBSD has been successfully installed on MacOS
+ X with Parallels, there are a number of configuration
+ steps that can be taken to optimize the system for
+ virtualized operation.</para>
+
+ <procedure>
+ <step>
+ <title>Set boot loader variables.</title>
+
+ <para>The most important step is to reduce the
+ <option>kern.hz</option> tunable to reduce the CPU utilization
+ of FreeBSD under the Parallels environment. This is
+ accomplished by adding the following line to
+ <filename>/boot/loader.conf</filename>:</para>
+
+ <programlisting>kern.hz=100</programlisting>
+
+ <para>Without this setting, an idle FreeBSD parallels guest
+ OS will use roughly 15% of the cpu of a single
+ processor iMac. After this change the usage will be
+ closer to a mere 5%.</para>
+ </step>
+
+ <step>
+ <title>Create a new kernel configuration file.</title>
+
+ <para>You can remove all of the SCSI, firewire, and USB
+ device drivers. Paralells provides a virtual network
+ adapter used by the <option>ed</option> driver, so
+ all other network devices except for
+ <option>ed</option> and <option>miibus</option> can be
+ removed from the kernel.</para>
+ </step>
+
+ <step>
+ <title>Setup networking.</title>
+
+ <para>The most basic networking setup involves simply
+ using DHCP to connect your virtual machine to the same
+ local area network as your host Mac. This can be
+ accomplished by adding
+ <literal>ifconfig_ed0="DHCP"</literal> to
+ <filename>/etc/rc.conf</filename>. More advanced
+ networking setups are described in <xref
+ linkend="advanced-networking">.</para>
+ </step>
+ </procedure>
+
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="virtualization-guest-xen">
+ <sect2info>
+ <authorgroup>
+ <author>
+ <firstname>Fukang</firstname>
+ <surname>Chen (Loader)</surname>
+ <contrib>Contributed by </contrib>
+ </author>
+ </authorgroup>
+ <!-- Mar/Apr 2007 -->
+ </sect2info>
+
+ <title>FreeBSD with Xen on Linux</title>
+
+ <para>The Xen hypervisor is an open source paravirtualization
+ product which is now supported by the commercial XenSource
+ company. Guest operating systems are known as domU domains,
+ and the host operating system is known as dom0. The first
+ step in running a virtual FreeBSD instance under Linux is to install
+ Xen for Linux dom0.</para>
+
+ <sect3 id="xen-slackware-dom0">
+ <title>Setup Xen 3 on Linux Dom0</title>
+
+ <procedure>
+ <step>
+ <title>Download Xen 3.0 from XenSource</title>
+
+ <para>Download <ulink
+ url="http://bits.xensource.com/oss-xen/release/3.0.4-1/src.tgz/xen-3.0.4_1-src.tgz">xen-3.0.4_1-src.tgz</ulink>
+ from <ulink url="http://www.xensource.com/"></ulink>.</para>
+
+ </step>
+
+ <step>
+ <title>Unpack the tarball</title>
+
+ <screen>&prompt.root; cd xen-3.0.4_1-src
+&prompt.root; KERNELS="linux-2.6-xen0 linux-2.6-xenU" make world
+&prompt.root; make install</screen>
+
+ <note>
+ <para>To re-compile the kernel for Dom0:</para>
+
+ <screen>&prompt.root; cd xen-3.0.4_1-src/linux-2.6.16.33-xen0
+&prompt.root; make menuconfig
+&prompt.root; make
+&prompt.root; make install</screen>
+
+ <para>Older version of Xen may need to specify
+ <command>make ARCH=xen menuconfig</command></para>
+ </note>
+ </step>
+
+ <step>
+ <title>Add a menu entry into Grub menu.lst</title>
+
+ <screen>&prompt.root; <userinput><command>vi</command> <filename>/boot/grub/menu.lst</filename></userinput></screen>
+
+ <programlisting>title Xen-3.0.4
+root (hd0,0)
+kernel /boot/xen-3.0.4-1.gz dom0_mem=262144
+module /boot/vmlinuz-2.6.16.33-xen0 root=/dev/hda1 ro</programlisting>
+ </step>
+
+ <step>
+ <title>Reboot your computer into Xen</title>
+
+ <screen>&prompt.root; <userinput><command>vi</command> <filename>/etc/xen/xend-config.sxp</filename></userinput>
+
+(network-script 'network-bridge netdev=eth0')</screen>
+
+ <screen>&prompt.root; <userinput>/etc/init.d/xend start</userinput>
+&prompt.root; <userinput>/etc/init.d/xendomains start</userinput></screen>
+
+ <screen>&prompt.root; <userinput><command>xm</command> list</userinput>
+Name ID Mem VCPUs State Time(s)
+Domain-0 0 256 1 r----- 54452.9</screen>
+ </step>
+ </procedure>
+ </sect3>
+
+ <sect3>
+ <title>FreeBSD 7-CURRENT domU</title>
+
+ <para>Download the FreeBSD domU kernel for Xen 3.0 and
+ disk image from <ulink
+ url="http://www.fsmware.com/">http://www.fsmware.com/</ulink></para>
+
+ <itemizedlist>
+ <listitem>
+ <para><ulink url="http://www.fsmware.com/xenofreebsd/7.0/download/kernel-current">kernel-current</ulink></para>
+ </listitem>
+
+ <listitem>
+ <para><ulink url="http://www.fsmware.com/xenofreebsd/7.0/download/mdroot-7.0.bz2">mdroot-7.0.bz2</ulink></para>
+ </listitem>
+
+ <listitem>
+ <para><ulink url="http://www.fsmware.com/xenofreebsd/7.0/download/config/xmexample1.bsd">xmexample1.bsd</ulink></para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Put the config file <filename>xmexample1.bsd</filename>
+ into <filename>/etc/xen/</filename> and modify the related
+ entries about where stores the kernel and the disk image,
+ it should look like this:</para>
+
+ <programlisting>kernel = "/opt/kernel-current"
+memory = 256
+name = "freebsd"
+vif = [ '' ]
+disk = [ 'file:/opt/mdroot-7.0,hda1,w' ]
+#on_crash = 'preserve'
+extra = "boot_verbose"
+extra += ",boot_single"
+extra += ",kern.hz=100"
+extra += ",vfs.root.mountfrom=ufs:/dev/xbd769a"</programlisting>
+
+ <para><filename>mdroot-7.0.bz2</filename> should be
+ uncompressed</para>
+
+ <para>And also in the <filename>kernel-current</filename>,
+ fix the __xen_guest section to add the VIRT_BASE that
+ Xen 3.0.3 requires, </para>
+
+ <screen>&prompt.root; <userinput><command>objcopy</command> <filename>kernel-current</filename> -R __xen_guest</userinput>
+&prompt.root; <userinput><command>perl</command> -e 'print "LOADER=generic,GUEST_OS=freebsd,GUEST_VER=7.0,XEN_VER=xen-3.0,BSD_SYMTAB,VIRT_BASE=0xC0000000\x00"' &gt; <filename>tmp</filename></userinput>
+&prompt.root; <userinput><command>objcopy</command> <filename>kernel-current</filename> --add-section __xen_guest=<filename>tmp</filename></userinput></screen>
+
+ <screen>&prompt.root; <userinput><command>objdump</command> -j __xen_guest -s <filename>kernel-current</filename></userinput>
+
+kernel-current: file format elf32-i386
+
+Contents of section __xen_guest:
+ 0000 4c4f4144 45523d67 656e6572 69632c47 LOADER=generic,G
+ 0010 55455354 5f4f533d 66726565 6273642c UEST_OS=freebsd,
+ 0020 47554553 545f5645 523d372e 302c5845 GUEST_VER=7.0,XE
+ 0030 4e5f5645 523d7865 6e2d332e 302c4253 N_VER=xen-3.0,BS
+ 0040 445f5359 4d544142 2c564952 545f4241 D_SYMTAB,VIRT_BA
+ 0050 53453d30 78433030 30303030 3000 SE=0xC0000000. </screen>
+
+ <screen>&prompt.root; <userinput><command>xm</command> create <filename>/etc/xen/xmexample1.bsd</filename> -c</userinput>
+Using config file "/etc/xen/xmexample1.bsd".
+Started domain freebsd
+WARNING: loader(8) metadata is missing!
+Copyright (c) 1992-2006 The FreeBSD Project.
+Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
+The Regents of the University of California. All rights reserved.
+FreeBSD 7.0-CURRENT #113: Wed Jan 4 06:25:43 UTC 2006
+ kmacy@freebsd7.gateway.2wire.net:/usr/home/kmacy/p4/freebsd7_xen3/src/sys/i386-xen/compile/XENCONF
+WARNING: DIAGNOSTIC option enabled, expect reduced performance.
+Xen reported: 1796.927 MHz processor.
+Timecounter "ixen" frequency 1796927000 Hz quality 0
+CPU: Intel(R) Pentium(R) 4 CPU 1.80GHz (1796.93-MHz 686-class CPU)
+ Origin = "GenuineIntel" Id = 0xf29 Stepping = 9
+ Features=0xbfebfbff&lt;FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,
+ DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE&gt;
+ Features2=0x4400&lt;CNTX-ID,&lt;b14&gt;&gt;
+real memory = 265244672 (252 MB)
+avail memory = 255963136 (244 MB)
+xc0: &lt;Xen Console&gt; on motherboard
+cpu0 on motherboard
+Timecounters tick every 10.000 msec
+[XEN] Initialising virtual ethernet driver.
+xn0: Ethernet address: 00:16:3e:6b:de:3a
+[XEN]
+Trying to mount root from ufs:/dev/xbd769a
+WARNING: / was not properly dismounted
+Loading configuration files.
+No suitable dump device was found.
+Entropy harvesting: interrupts ethernet point_to_point kickstart.
+Starting file system checks:
+/dev/xbd769a: 18859 files, 140370 used, 113473 free (10769 frags, 12838 blocks, 4.2% fragmentation)
+Setting hostname: demo.freebsd.org.
+lo0: flags=8049&lt;UP,LOOPBACK,RUNNING,MULTICAST&gt; mtu 16384
+ inet6 ::1 prefixlen 128
+ inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
+ inet 127.0.0.1 netmask 0xff000000
+Additional routing options:.
+Mounting NFS file systems:.
+Starting syslogd.
+/etc/rc: WARNING: Dump device does not exist. Savecore not run.
+ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/X11R6/lib /usr/local/lib
+a.out ldconfig path: /usr/lib/aout /usr/lib/compat/aout /usr/X11R6/lib/aout
+Starting usbd.
+usb: Kernel module not available: No such file or directory
+Starting local daemons:.
+Updating motd.
+Starting sshd.
+Initial i386 initialization:.
+Additional ABI support: linux.
+Starting cron.
+Local package initialization:.
+Additional TCP options:.
+Starting background file system checks in 60 seconds.
+
+Sun Apr 1 02:11:43 UTC 2007
+
+FreeBSD/i386 (demo.freebsd.org) (xc0)
+
+login: </screen>
+
+ <screen>&prompt.root; <userinput><command>uname</command> -a</userinput>
+FreeBSD demo.freebsd.org 7.0-CURRENT FreeBSD 7.0-CURRENT #113: Wed Jan 4 06:25:43 UTC 2006
+kmacy@freebsd7.gateway.2wire.net:/usr/home/kmacy/p4/freebsd7_xen3/src/sys/i386-xen/compile/XENCONF i386</screen>
+
+
+ <screen>&prompt.root; <userinput><command>ifconfig</command> xn0 10.10.10.200 netmask 255.0.0.0</userinput>
+&prompt.root; <userinput><command>ifconfig</command></userinput>
+xn0: flags=843&lt;UP,BROADCAST,RUNNING,SIMPLEX&gt; mtu 1500
+ inet 10.10.10.200 netmask 0xff000000 broadcast 10.255.255.255
+ ether 00:16:3e:6b:de:3a
+lo0: flags=8049&lt;UP,LOOPBACK,RUNNING,MULTICAST&gt; mtu 16384
+ inet6 ::1 prefixlen 128
+ inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
+ inet 127.0.0.1 netmask 0xff000000 </screen>
+
+ <para>On Dom0 Slackware:</para>
+
+ <screen>&prompt.root; <userinput><command>ifconfig</command></userinput>
+eth0 Link encap:Ethernet HWaddr 00:07:E9:A0:02:C2
+ inet addr:10.10.10.130 Bcast:0.0.0.0 Mask:255.0.0.0
+ UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
+ RX packets:815 errors:0 dropped:0 overruns:0 frame:0
+ TX packets:1400 errors:0 dropped:0 overruns:0 carrier:0
+ collisions:0 txqueuelen:0
+ RX bytes:204857 (200.0 KiB) TX bytes:129915 (126.8 KiB)
+
+lo Link encap:Local Loopback
+ inet addr:127.0.0.1 Mask:255.0.0.0
+ UP LOOPBACK RUNNING MTU:16436 Metric:1
+ RX packets:99 errors:0 dropped:0 overruns:0 frame:0
+ TX packets:99 errors:0 dropped:0 overruns:0 carrier:0
+ collisions:0 txqueuelen:0
+ RX bytes:9744 (9.5 KiB) TX bytes:9744 (9.5 KiB)
+
+peth0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
+ UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
+ RX packets:1853349 errors:0 dropped:0 overruns:0 frame:0
+ TX packets:952923 errors:0 dropped:0 overruns:0 carrier:0
+ collisions:0 txqueuelen:1000
+ RX bytes:2432115831 (2.2 GiB) TX bytes:86528526 (82.5 MiB)
+ Base address:0xc000 Memory:ef020000-ef040000
+
+vif0.1 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
+ UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
+ RX packets:1400 errors:0 dropped:0 overruns:0 frame:0
+ TX packets:815 errors:0 dropped:0 overruns:0 carrier:0
+ collisions:0 txqueuelen:0
+ RX bytes:129915 (126.8 KiB) TX bytes:204857 (200.0 KiB)
+
+vif1.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
+ UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
+ RX packets:3 errors:0 dropped:0 overruns:0 frame:0
+ TX packets:2 errors:0 dropped:157 overruns:0 carrier:0
+ collisions:0 txqueuelen:1
+ RX bytes:140 (140.0 b) TX bytes:158 (158.0 b)
+
+xenbr1 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
+ UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
+ RX packets:4 errors:0 dropped:0 overruns:0 frame:0
+ TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
+ collisions:0 txqueuelen:0
+ RX bytes:112 (112.0 b) TX bytes:0 (0.0 b)</screen>
+
+ <screen>&prompt.root; <userinput><command>brctl</command> show</userinput>
+bridge name bridge id STP enabled interfaces
+xenbr1 8000.feffffffffff no vif0.1
+ peth0
+ vif1.0</screen>
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="virtualization-guest-vmware">
+ <title>VMWare on Windows/Mac/Linux</title>
+
+ <para>This section has yet to be written.</para>
+
+ </sect2>
+
+ </sect1>
+
+ <sect1 id="virtualization-host">
+ <title>FreeBSD as a Host OS</title>
+
+ <para>FreeBSD is not officially supported by any virtualization
+ package as a host operating system at this time, but many people
+ use older versions of VMWare in this capacity. Work is also
+ ongoing in getting Xen to work as a host environment on
+ FreeBSD.</para>
+
+ </sect1>
+
+</chapter>
+
+<!--
+ Local Variables:
+ mode: sgml
+ sgml-declaration: "../chapter.decl"
+ sgml-indent-data: t
+ sgml-omittag: nil
+ sgml-always-quote-attributes: t
+ sgml-parent-document: ("../book.sgml" "part" "chapter")
+ End:
+-->