--- wikisrc/ports/xen/howto.mdwn 2014/12/26 16:17:25 1.45 +++ wikisrc/ports/xen/howto.mdwn 2014/12/26 16:43:51 1.46 @@ -465,19 +465,29 @@ similarly to vnds. Virtual Networking ------------------ -TODO: explain xvif concept, and that it's general. - -There are two normal styles: bridging and NAT. +Xen provides virtual ethernets, each of which connects the dom0 and a +domU. For each virtual network, there is an interface "xvifN.M" in +the dom0, and in domU index N, a matching interface xennetM (NetBSD +name). The interfaces behave as if there is an Ethernet with two +adaptors connected. From this primitive, one can construct various +configurations. We focus on two common and useful cases for which +there are existing scripts: bridging and NAT. With bridging, the domU perceives itself to be on the same network as -the dom0. For server virtualization, this is usually best. +the dom0. For server virtualization, this is usually best. Bridging +is accomplished by creating a bridge(4) device and adding the dom0's +physical interface and the various xvifN.0 interfaces to the bridge. +One specifies "bridge=bridge0" in the domU config file. The bridge +must be set up already in the dom0; an example /etc/ifconfig.bridge0 +is: + + create + up + !brconfig bridge0 add wm0 With NAT, the domU perceives itself to be behind a NAT running on the dom0. This is often appropriate when running Xen on a workstation. -One can construct arbitrary other configurations, but there is no -script support. - Sizing domains -------------- @@ -509,9 +519,41 @@ obtain domU kernels. Config files ------------ -TODO: give example config files. Use both lvm and vnd. +The following is an example domain configuration file, lightly +sanitized from a known working on Xen 4.1 (NetBSD 5 amd64 dom0 and +NetBSD 6 i386 domU): + + # -*- mode: python; -*- + + kernel = "/netbsd-XEN3PAE_DOMU-i386-foo.gz" + + memory = 1024 + + name = "foo" + + #cpu = -1 + + vif = [ 'mac=aa:00:00:d1:00:09,bridge=bridge0' ] + + disk = [ 'file:/n0/xen/foo-wd0,0x1,w', + 'file:/n0/xen/foo-wd1,0x2,w' ] + + root = "xbd0" + + autorestart = True + +The kernel has the host/domU name in it, so that on the dom0 one can +update the various domUs independently. The vif line causes an +interface to be provided, with a specific mac address (do not reuse +MAC addresses!), in bridge mode. Two disks are provided, and they are +writable. + +TODO: explain if the root line is really necessary. +TODO: explain or remove autorestart. + +TODO: Add an example with lvm -TODO: explain the mess with 3 arguments for disks and how to cope (0x1). +TODO: explain, someplace the mess with 3 arguments for disks and how to cope (0x1). Starting domains ---------------- @@ -655,7 +697,7 @@ working vif-bridge is also provided with #!/bin/sh #============================================================================ - # $NetBSD: howto.mdwn,v 1.44 2014/12/26 14:20:27 gdt Exp $ + # $NetBSD: howto.mdwn,v 1.45 2014/12/26 16:17:25 gdt Exp $ # # /usr/pkg/etc/xen/vif-bridge #