1: **Contents**
2:
3: [[!toc levels=3]]
4:
5: # Requirements
6:
7: Xen3 is supported from NetBSD-4.0 onward. If you plan on using NetBSD-CURRENT,
8: please read the article [[How to build NetBSD-current]] to do so. Guest
9: operating systems can run from their own partitions, or from image files in
10: the main (DOM0) install.
11:
12: This tutorial describes how to:
13:
14: * Install and configure NetBSD as a DOM0
15: * Install and run a NetBSD as a DOMU
16: * Install and run a Windows XP system as as DOMU
17: * Install and run a Debian system as a DOMU
18:
19: # Installing Xen tools and kernels
20:
21: ## Xen tools
22:
23: To run and administer xen domains, we need the xentools3 or xentools33
24: packages which are available in pkgsrc.
25:
26: Xen 3.1 packages are under [sysutils/xentools3](http://pkgsrc.se/sysutils/xentools3) for traditional xentools,
27: and [sysutils/xentools3-hvm](http://pkgsrc.se/sysutils/xentools3-hvm) for the additional **HVM** support to run un-
28: modified OSes such as Windows XP.
29:
30: Xen 3.3 packages are under [sysutils/xentools33](http://pkgsrc.se/sysutils/xentools33). Unlike Xen 3.1, no extra
31: package is required for **HVM** support. Note, it is not possible to install
32: Xen 3.1 and Xen 3.3 packages at the same time. They conflict with each other.
33:
34: **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:
35:
36: <http://wiki.xensource.com/xenwiki/HVM_Compatible_Processors>
37:
38: In NetBSD 5.0 there's a new cpuctl command. This is an example output of an
39: AMD CPU:
40:
41:
42: # cpuctl identify 0
43: cpu0: AMD Unknown K8 (Athlon) (686-class), 2210.22 MHz, id 0x60f82
44: cpu0: features 0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>
45: cpu0: features 0x178bfbff<PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX>
46: cpu0: features 0x178bfbff<FXSR,SSE,SSE2,HTT>
47: cpu0: features2 0x2001<SSE3,CX16>
48: cpu0: features3 0xebd3fbff<SCALL/RET,NOX,MXX,FFXSR,RDTSCP,LONG,3DNOW2,3DNOW>
49: cpu0: features4 0x11f<LAHF,CMPLEGACY,SVM,EAPIC,ALTMOVCR0,3DNOWPREFETCH>
50: cpu0: "AMD Turion(tm) 64 X2 Mobile Technology TL-64"
51: cpu0: I-cache 64KB 64B/line 2-way, D-cache 64KB 64B/line 2-waycpu0: L2 cache 1MB 64B/line 16-way
52: cpu0: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
53: cpu0: DTLB 32 4KB entries fully associative, 8 4MB entries fully associativecpu0: Initial APIC ID 0
54: cpu0: AMD Power Management features: 0x7f<TS,FID,VID,TTP,HTC,STC,100>
55: cpu0: family 0f model 08 extfamily 00 extmodel 06
56:
57:
58: Note the **SVM** feature flag in the **features4** line indicating that
59: **HVM** support is present on this CPU. However, this feature may be disabled
60: in the BIOS. In this case since NetBSD 5.0 there will show up this dmesg line
61: on AMD CPUs only:
62:
63:
64: cpu0: SVM disabled by the BIOS
65:
66:
67:
68: Xen 3.1 (the xentools3-hvm package will automatically bring in the base
69: xentools3):
70:
71:
72: # cd /usr/pkgsrc/sysutils/xentools3-hvm
73: # make install
74:
75:
76: Xen 3.3:
77:
78:
79: # cd /usr/pkgsrc/sysutils/xentools33
80: # make install
81:
82:
83: ## Xen kernel
84:
85: Next, we will get the xen hypervisor kernel itself. For NetBSD 4.x and 5.x the
86: i386 port does not support 'PAE' kernels and must run the Xen 3.1 package.
87: This restriction has been removed in -current and is not relevant for the
88: amd64 port.
89:
90: For Xen 3.1, in pkgsrc this is [sysutils/xenkernel3](http://pkgsrc.se/sysutils/xenkernel3), for Xen 3.3, this is
91: [sysutils/xenkernel33](http://pkgsrc.se/sysutils/xenkernel33):
92:
93:
94: # cd /usr/pkgsrc/sysutils/xenkernel3
95: # make install
96:
97:
98: And copy it into / directory, like this:
99:
100:
101: # cp /usr/pkg/xen3-kernel/xen.gz /
102:
103:
104: ## Xen DOM0 kernel
105:
106: Lastly, we need a XEN-enabled kernel for our DOM0 domain. There are two
107: possibilities: downloading the binary version, or building it from source.
108:
109: ## Downloading the binary version
110:
111: From NetBSD-4.0 onward, NetBSD supports Xen, and provides some XEN-enabled
112: kernel directly from [[1]][36], in each `binary/kernel` directory associated
113: with a particular release.
114:
115: For example, with NetBSD-4.0, You can grab one from
116: (<ftp.NetBSD.org/pub/NetBSD/NetBSD-4.0/i386/binary/kernel>/netbsd-XEN3_DOM0.gz):
117:
118:
119: # ftp -a ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-4.0/i386/binary/kernel/netbsd-XEN3_DOM0.gz
120:
121:
122: The `netbsd-XEN3_DOM0.gz` file contains a gzipped version of the kernel. Just
123: copy and move it into the root directory like this:
124:
125:
126: # cp netbsd-XEN3_DOM0.gz /
127:
128:
129: ## Building it from source
130:
131: Building a kernel from source is out of the scope of this section. Please
132: consult [How to build a kernel](http://www.netbsd.org/docs/kernel/#how_to_build_a_kernel) from NetBSD's FAQ for more details.
133:
134: Once building is done, you can find them in
135: `/usr/src/obj/_releasedir_/i386/binary/kernel/`. Identically to binary
136: version, copy or move netbsd-XEN3_DOM0 in the root directory `/`.
137:
138: # Selecting a bootloader
139:
140: In NetBSD 5.0 the native boot loader, /boot, can load Xen directly.
141: The NetBSD 5.0 bootloader can be easily dropped into a NetBSD 4.x system by coping them into
142: /boot and running installboot(8) properly.
143:
144: ## Updating /boot
145:
146: For full details refer to installboot(8), but for a standard configuration
147: with VGA console and an IDE or SATA drive with an FFSv1 root file system use
148: the following:
149:
150:
151: # cp /usr/mdec/boot /boot
152: # installboot -v -o timeout=5 /dev/rwd0a /usr/mdec/bootxx_ffsv1
153:
154:
155: ## Updating /boot.cfg
156:
157: NetBSD 5.0 or later will already have a /boot.cfg file with a basic
158: configuration. Enabling Xen support only requires one additional line in this
159: case. If you're upgrading from an earlier version or do not have an existing
160: /boot.cfg use the following example:
161:
162:
163:
164: banner=Welcome to NetBSD
165: banner==================
166: banner=
167: banner=Please choose an option from the following menu:
168: menu=Boot normally:boot netbsd
169: menu=Boot single-user:boot netbsd -s
170: menu=Boot backup kernel:boot onetbsd
171: menu=Drop to boot prompt:prompt
172: menu=Boot Xen with 256MB for dom0:load /netbsd-XEN3_DOM0 console=pc;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M
173: 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
174: menu=Boot Xen with dom0 in single-user mode:load /netbsd-XEN3_DOM0 -s;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M
175: timeout=5
176: default=1
177:
178:
179: Make sure you update the "load /netbsd-XEN3_DOM0" and the "dom0_mem=256M"
180: arguments to match your setup. On next boot select the 'Boot Xen with 256MB
181: for dom0' option and make sure you see Xen kernel messages and the normal
182: NetBSD kernel messages. Once you're satisfied it is working you can change the
183: "default=1" line to "default=5" to automatically boot Xen on reboot.
184:
185: # Setting up DOM0
186:
187: ## Creating xen devices
188:
189: To create all xen devices, change to /dev and run ./MAKEDEV xen
190:
191:
192: cd /dev
193: ./MAKEDEV xen
194:
195:
196: This should create the devices **xencons**, **xenevt** and **xsd_kva**. If any
197: of these are missing you may not have updated to _CURRENT_ using the latest
198: sources and you will have to create the missing device files.
199:
200: ## Configuring the bridge interface
201:
202: The [bridge(4)](http://netbsd.gw.com/cgi-bin/man-cgi?bridge+4+NetBSD-current) interface is used to provide network access to DOMUs.
203:
204: To use one, edit (or create) the file `/etc/ifconfig.bridge0` and insert
205: following lines to:
206:
207:
208: create
209: !brconfig $int add bge0 stp bge0 up
210:
211:
212: Where 'bge0' should be changed to the name of the interface you want to use
213: with your guest operating systems. use [ifconfig(8)](http://netbsd.gw.com/cgi-bin/man-cgi?ifconfig+8+NetBSD-current) to get more details
214: about your actual interfaces.
215:
216: ## Rebooting into DOM0
217:
218: Time to reboot:
219:
220:
221: # shutdown -r now
222:
223:
224: If all has gone well, you should have booted into the XEN3_DOM0 kernel. Check
225: this with [uname(1)](http://netbsd.gw.com/cgi-bin/man-cgi?uname+1+NetBSD-current):
226:
227:
228: # uname -v
229: NetBSD 4.0 (XEN3_DOM0) #0: Sun Dec 16 01:20:31 PST 2007
230: 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
231:
232:
233: You should have **XEN3 DOM0** mentioned somewhere.
234:
235: ## Configuring rc scripts
236:
237: Copy or symlink xend, xenbackendd and xendomains from
238: `/usr/pkg/share/examples/rc.d` to `/etc/rc.d`.
239:
240:
241: # cp /usr/pkg/share/examples/rc.d/xend /etc/rc.d/
242: # cp /usr/pkg/share/examples/rc.d/xenbackendd /etc/rc.d/
243: # cp /usr/pkg/share/examples/rc.d/xendomains /etc/rc.d/
244:
245:
246: Edit `/etc/rc.conf` and add the following lines:
247:
248:
249: xend=YES
250: xenbackendd=YES
251: xendomains="dom1"
252:
253:
254: Later on, when you have created a configuration file for 'dom1', the
255: xendomains variable specified above will trigger 'dom1' to be started when the
256: system is booted. At this point no configuration exists for dom1, therefore it
257: does nothing at this point. If you choose to name your configuration file
258: something else, adapt the name accordingly.
259:
260: To avoid rebooting a second, start all three services:
261:
262:
263: # /etc/rc.d/xend start
264: # /etc/rc.d/xenbackendd start
265: # /etc/rc.d/xendomains start
266:
267:
268: Run `ifconfig -a` to ensure the bridge interface is present and issue a `ps ax
269: | grep xen` to ensure you have a similar output.
270:
271:
272:
273: 12 ? DK 0:00.00 [xenwatch]
274: 13 ? DK 0:00.00 [xenbus]
275: 411 ? I 0:00.24 xenstored --pid-file=/var/run/xenstore.pid
276: 594 ? IWa 0:00.26 xenconsoled
277: 629 ? IW 0:00.00 /usr/pkg/bin/python2.3 /usr/pkg/sbin/xend start
278: 631 ? IWsa 0:00.02 /usr/pkg/sbin/xenbackendd
279: 639 ? IWa 0:00.52 /usr/pkg/bin/python2.3 /usr/pkg/sbin/xend start
280:
281:
282: The DOM0 configuration is now done. We will proceed to configuring DOMU
283: domains.
284:
285: # Configuring DOMU
286:
287: ## Configuring and installing a NetBSD DOMU
288:
289: Create (or modify) `/usr/pkg/etc/xen/dom1` and include this:
290:
291:
292:
293: kernel = "/usr/src/obj/releasedir/i386/binary/kernel/netbsd-INSTALL_XEN3_DOMU.gz"
294: #kernel = "/netbsd-XEN3_DOMU"
295: memory = 64
296: name = "dom1"
297: #vcpus = 1
298: disk = [ 'phy:/dev/wd0g,0x03,w','file:/usr/src/obj/releasedir/i386/installation/cdrom/netbsd-i386.iso,0x04,r' ]
299: vif = [ 'bridge=bridge0' ]
300: root = "/dev/wd0d"
301:
302:
303: This configuration boots into the NetBSD sysinst program and allows you to
304: install a NetBSD DOMU using the normal sysinst method. This configuration uses
305: a DOMU_INSTALL kernel and an ISO image provided by a successful 'build
306: release' and 'build iso-image'. You may be able to locate a valid Xen3
307: DOMU_INSTALL kernel from <ftp://ftp.netbsd.org/pub/NetBSD-daily/> but if
308: not, building a release is your best bet.
309:
310: In this configuration file, `/dev/wd0g` is the reserved partition for the
311: guest operating system. This should be changed to the partition you reserved
312: prior to following the instructions within this document.
313:
314: If you would like to use a physical CDROM instead of an ISO image, change the
315: disk line to:
316:
317:
318: disk = [ 'phy:/dev/wd0g,0x03,w','phy:/dev/cd0a,0x04,r' ]
319:
320:
321: Now boot into sysinst using the command:
322:
323:
324: xm create dom1 -c
325:
326:
327: The reserved partition will appear as `/dev/xbd0`. Proceed as you would with a
328: normal NetBSD installation using xbd0 as the target drive and xbd1 as the
329: CDROM.
330:
331: When you have finished, run `shutdown -hp now` to dom1.
332:
333: Now edit `/usr/pkg/etc/xen/dom1`. Comment the INSTALL kernel and uncomment the
334: DOMU kernel.
335:
336: You should now have a working NetBSD DOMU (dom1). Boot into dom1 again with
337: the command:
338:
339:
340: xm create dom1 -c
341:
342:
343: and ensure the file, `/etc/ttys` contains only this line or has all other
344: lines commented:
345:
346:
347: console "/usr/libexec/getty Pc" vt100 on secure
348:
349:
350: and the file `/etc/wscons.conf` is completely empty or has all lines commented
351: out. These last two steps ensure no errors should be present on boot. Setting
352: wscons=NO in `/etc/rc.conf` may effectively do the same thing.
353:
354: From here, configure `/etc/rc.conf` and all runtime configuration files as you
355: would normally. The network interface name should be _**xennet0**_. Use this
356: name when configuring an IP address.
357:
358: More information can be obtained by referencing the [Xen user guide](http://www.cl.cam.ac.uk/Research/SRG/netos/xen/readmes/user/) and
359: [the official NetBSD Xen Howto](http://www.netbsd.org/Ports/xen/howto.html). Questions can be addressed to the port-
360: xen@NetBSD.org mailling list.
361:
362: ## Configuring and installing a Windows XP DOMU
363:
364: This requires an HVM capable processor and xentools (see sections above).
365:
366: This assumes you have a copy of the Windows install CD in /home/xen/winxp.iso,
367: and wish to create a file /home/xen/winxp.img to hold the install. First
368: create a blank file to hold the install. This assumes a size of 4GB (4096M).
369: If you want a different size adjust the numbers to match:
370:
371:
372: # dd if=/dev/zero of=/home/xen/winxp.img bs=1m count=4096
373:
374:
375: Create `/usr/pkg/etc/xen/win01`:
376:
377:
378:
379: kernel = '/usr/pkg/lib/xen/boot/hvmloader'
380: builder = 'hvm'
381: memory = '400'
382: device_model='/usr/pkg/libexec/qemu-dm'
383:
384: disk = [ 'file:/home/xen/winxp.img,ioemu:hda,w',
385: 'file:/home/xen/winxp.iso,ioemu:hdb:cdrom,r', ]
386:
387: # Hostname
388: name = "win01"
389:
390: vif = [ 'type=ioemu, bridge=bridge0' ]
391:
392: boot= 'd'
393: vnc = 1
394: usbdevice = 'tablet' # Helps with mouse pointer positioning
395:
396:
397: You may want to modify the amount of memory and pathnames.
398:
399: Ensure you have a vncviewer installed, such as [net/tightvncviewer](http://pkgsrc.se/net/tightvncviewer) or
400: [net/vncviewer](http://pkgsrc.se/net/vncviewer) from pkgsrc.
401:
402: Then start the XENU and connect to it via VNC.
403:
404:
405: # xm create /usr/pkg/etc/xen/win01
406: # vncviewer :0
407:
408:
409: This will boot the Windows ISO image and let you install Windows as normal. As
410: Windows reboots during install you may need to restart vncviewer.
411:
412: After install change the **boot d** to **boot c** to have the system boot
413: directly from the disk image.
414:
415: ## Configuring and installing a GNU/Linux DOMU
416:
417: We will do this in two steps:
418:
419: * install a GNU/Linux system, from a livecd or any installation media
420: * configure the DOM0 so that it can create and start the Linux DOMU.
421:
422: ### Installing a Linux distribution (soon-to-be DOMU)
423:
424: Before proceeding with DOMU configuration, we will install our favorite
425: GNU/Linux distribution on the computer.
426:
427: In order to do it, we need at least two partitions (only one, if you do not
428: consider the swap). These partitions must reside outside of the NetBSD slice,
429: and may be either of primary or extended type. Of course, you can use more
430: than two, but adapt your labels and partitions accordingly.
431:
432: We do not cover the partition/slices manipulations through [fdisk(8)](http://netbsd.gw.com/cgi-bin/man-cgi?fdisk+8+NetBSD-current) and
433: [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
434: space.
435:
436: For this tutorial, we will use this partitioning:
437:
438:
439:
440: # fdisk /dev/wd0d
441: fdisk: removing corrupt bootsel information
442: fdisk: Cannot determine the number of heads
443: Disk: /dev/wd0d
444: NetBSD disklabel disk geometry:
445: cylinders: 486344, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
446: total sectors: 490234752
447:
448: BIOS disk geometry:
449: cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
450: total sectors: 490234752
451:
452: Partition table:
453: 0: Linux native (sysid 131)
454: start 63, size 20482812 (10001 MB, Cyls 0-1274)
455: PBR is not bootable: All bytes are identical (0x00)
456: 1: Linux swap or Prime or Solaris (sysid 130)
457: start 20482875, size 1959930 (957 MB, Cyls 1275-1396)
458: PBR is not bootable: All bytes are identical (0x00)
459: 2: NetBSD (sysid 169)
460: start 61464690, size 428770062 (209360 MB, Cyls 3826-30515/178/63), Active
461: 3: <UNUSED>
462: Drive serial number: -286527765 (0xeeebeeeb)
463:
464:
465: Here, you notice that we decide to use two primary partitions for our future
466: Linux DOMU:
467:
468: * partition 0 (for the **root directory /**)
469: * partition 1 (for the **swap**)
470:
471: Labels:
472:
473:
474:
475: 16 partitions:
476: # size offset fstype [fsize bsize cpg/sgs]
477: a: 30720816 61464690 4.2BSD 2048 16384 0 # (Cyl. 60976*- 91453*)
478: b: 1049328 92185506 swap # (Cyl. 91453*- 92494*)
479: c: 428770062 61464690 unused 0 0 # (Cyl. 60976*- 486343)
480: d: 490234752 0 unused 0 0 # (Cyl. 0 - 486343)
481: e: 20480000 93234834 4.2BSD 0 0 0 # (Cyl. 92494*- 112812*)
482: f: 20480000 113714834 4.2BSD 0 0 0 # (Cyl. 112812*- 133129*)
483: g: 20480000 134194834 4.2BSD 0 0 0 # (Cyl. 133129*- 153447*)
484: h: 335559918 154674834 4.2BSD 0 0 0 # (Cyl. 153447*- 486343)
485: i: 20482812 63 Linux Ext2 0 0 # (Cyl. 0*- 20320*)
486: j: 1959930 20482875 swap # (Cyl. 20320*- 22264*)
487:
488:
489: Bear in mind that we added two labels here, namely **i** and **j**, which maps
490: respectively to partition 0 and partition 1 of the disk. We will use these
491: labels later for DOMU configuration.
492:
493: Now that we have partitioned the disk, proceed with installing your Linux
494: distribution. We will not cover that part in this tutorial. You can either
495: install it from an installation media (a cdrom from example), or copy files
496: from an already installed distribution on your computer.
497:
498: Tip: to manipulate ext2/3 filesystems (the traditional fs under Linux) from
499: NetBSD, you can use [sysutils/e2fsprogs](http://pkgsrc.se/sysutils/e2fsprogs) from pkgsrc:
500:
501:
502: # cd /usr/pkgsrc/sysutils/e2fsprogs
503: # make install
504:
505:
506: 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.
507:
508: ### Getting XEN aware Linux kernels
509:
510: Once installation is done, reboot your computer and return to our Xen-NetBSD
511: system.
512:
513: To boot our Linux DOMU, we will need a Linux kernel supporting the XENU
514: virtualisation. Depending on your Linux distribution, you can grab one from
515: its repository (it is up to you to find it through aptitude, yum or whatever
516: package manager you use), or get one from the Xen binary distribution.
517:
518: To get a XENU Linux kernel from Xen binary distribution, get it directly from
519: [Xen website download page](http://www.xen.org/download/dl_31tarballs.html). Download the tarball and extract the
520: **vmlinuz-*-xen** from it. In our case, with a 2.6.18 Linux kernel:
521:
522:
523: # ftp -a http://bits.xensource.com/oss-xen/release/3.1.0/bin.tgz/xen-3.1.0-install-x86_32.tgz
524: # cd /tmp
525: # tar -xzf xen-3.1.0-install-x86_32.tgz dist/install/boot/vmlinuz-2.6.18-xen
526:
527:
528: **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):
529:
530: # mv dist/install/boot/vmlinuz-2.6.18-xen /vmlinuz-XEN3-DOMU
531:
532:
533: ### Configuring DOMU
534:
535: Configuring the Linux DOMU is a bit different than a NetBSD one; some options
536: tend to differ.
537:
538: Edit (or create) the configuration file **domu-linux**, in
539: `/usr/pkg/etc/xen/`:
540:
541:
542: # vi /usr/pkg/etc/xen/domu-linux
543:
544:
545: Here's a typical config file for a Linux DOMU:
546:
547:
548:
549: #----------------------------------------------------------------------------
550: # Kernel image file. This kernel will be loaded in the new domain.
551: kernel = "/vmlinuz-XEN3-DOMU"
552:
553: # Memory allocation (in megabytes) for the new domain.
554: memory = 256
555:
556: # A handy name for your new domain. This will appear in 'xm list',
557: # and you can use this as parameters for xm in place of the domain
558: # number. All domains must have different names.
559: #
560: name = "domu-linux"
561:
562: # Which CPU to start domain on (only relevant for SMP hardware). CPUs
563: # numbered starting from ``0''.
564: #
565: cpu = "^1" # leave to Xen to pick
566:
567: #----------------------------------------------------------------------------
568: # Define network interfaces for the new domain.
569:
570: # Number of network interfaces (must be at least 1). Default is 1.
571: vif = [ '' ]
572:
573: # Define MAC and/or bridge for the network interfaces.
574: #
575: # The MAC address specified in ``mac'' is the one used for the interface
576: # in the new domain. The interface in domain0 will use this address XOR'd
577: # with 00:00:00:01:00:00 (i.e. aa:00:00:51:02:f0 in our example). Random
578: # MACs are assigned if not given.
579: #
580: # ``bridge'' is a required parameter, which will be passed to the
581: # vif-script called by xend(8) when a new domain is created to configure
582: # the new xvif interface in domain0.
583: #
584: # In this example, the xvif is added to bridge0, which should have been
585: # set up prior to the new domain being created -- either in the
586: # ``network'' script or using a /etc/ifconfig.bridge0 file.
587: #
588: vif = [ 'mac=aa:00:00:50:02:f0, bridge=bridge0' ]
589:
590: #----------------------------------------------------------------------------
591: # Define the disk devices you want the domain to have access to, and
592: # what you want them accessible as.
593: #
594: # Each disk entry is of the form:
595: #
596: # phy:DEV,VDEV,MODE
597: #
598: # where DEV is the device, VDEV is the device name the domain will see,
599: # and MODE is r for read-only, w for read-write. You can also create
600: # file-backed domains using disk entries of the form:
601: #
602: # file:PATH,VDEV,MODE
603: #
604: # where PATH is the path to the file used as the virtual disk, and VDEV
605: # and MODE have the same meaning as for ``phy'' devices.
606: #
607: # /dev/wd0i will be seen as "hda1" under DOMU (the root partition)
608: # /dev/wd0j will be seen as "hda2" under DOMU (the swap)
609: #
610: disk = [ 'phy:/dev/wd0i,hda1,w','phy:/dev/wd0j,hda2,w' ]
611:
612: #----------------------------------------------------------------------------
613: # Set the kernel command line for the new domain.
614:
615: # Set root device.
616: root = "/dev/hda1"
617:
618:
619: Now, you should be able to start your first Linux DOMU!
620:
621:
622: # xm create -c /usr/pkg/etc/xen/domu-linux
623:
624:
625: # Possible caveats
626:
627: If you intend to have more than one box configured with the above
628: configuration on the same network, you will most likely have to specify a
629: unique MAC address per guest OS, otherwise it is likely you will have a
630: conflict. I'm not sure if the MAC assignment is random, incremental or if Xen
631: is able to check for the existence of the proposed MAC address, so specifying
632: the MAC address is recommended.
633:
634: Here is a method to assign a MAC address to a newly created Xen Domu. First as
635: described before, use the following vif parameter in your config file :
636:
637:
638:
639: vif = [ 'bridge=bridge0' ]
640:
641:
642: Then, run the Xen DomU and, once logged run the following command :
643:
644:
645:
646: # ifconfig xennet0
647:
648: Output Sample :
649:
650: xennet0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
651: capabilities=2800<TCP4CSUM_Tx,UDP4CSUM_Tx>
652: enabled=0
653: address: 00:16:3e:2e:32:5f
654: inet 192.168.4.81 netmask 0xffffff00 broadcast 192.168.4.255
655: inet6 fe80::216:3eff:fe2e:325f%xennet0 prefixlen 64 scopeid 0x2
656:
657:
658:
659: A MAC address is automaticaly generated, use it in your config file with the
660: following syntax :
661:
662:
663:
664: vif = [ 'mac=00:16:3e:2e:32:5f, bridge=bridge0' ]
665:
666:
667: And now you can restart the Xen DomU.
668:
669: Please, note that the MAC Address MUST start with "00:16:3e".
670:
671:
672:
673: # See also
674:
675: * [The official NetBSD Xen Howto](http://www.netbsd.org/Ports/xen/howto.html)
676: * [The official Xen Wiki](http://wiki.xensource.com/xenwiki/)
677:
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb