Ene 142013
 

Aclaración: Partimos de una instalación mínima de Debian squeeze. El servidor que funcionara como Dom0 debe tener dos placas de red una para el Dom0 y otra para el bridge por el que se ruteara todo el trafico de los DomU.

Configuramos la Red, primero instalamos el paquete bridge-utils

root@x49:/# apt-get install bridge-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  bridge-utils
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 32.7 kB of archives.
After this operation, 176 kB of additional disk space will be used.
Get:1 http://ftp.debian.org/debian/ squeeze/main bridge-utils amd64 1.4-5 [32.7 kB]
Fetched 32.7 kB in 1s (20.7 kB/s)
Selecting previously deselected package bridge-utils.
(Reading database ... 35324 files and directories currently installed.)
Unpacking bridge-utils (from .../bridge-utils_1.4-5_amd64.deb) ...
Processing triggers for man-db ...
Setting up bridge-utils (1.4-5) ...
root@x49:/#

Luego editamos el archivo /etc/network/interfaces de manera que luzca asi (reemplazar address, netmask, network, broadcast y gateway por los correspondientes de su red)

root@x49:/# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
    address 192.168.252.49
    netmask 255.255.255.0
    network 192.168.252.0
    broadcast 192.168.252.255
    gateway 192.168.252.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 8.8.8.8 8.8.4.4

auto xenbr0
iface xenbr0 inet manual
    bridge_fd 0
    bridge_helo 0
    bridge_maxwait 0
    bridge_stp off
    bridge_ports eth1

root@x49:/#

Restarteamos y chequeamos la configuración de la red

root@x49:/# /etc/init.d/networking stop ; /etc/init.d/networking start
Deconfiguring network interfaces...done.
Configuring network interfaces...done.
root@x49:/# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:73:6f:66
          inet addr:192.168.252.49  Bcast:192.168.252.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe73:6f66/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1044 errors:0 dropped:0 overruns:0 frame:0
          TX packets:705 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:124525 (121.6 KiB)  TX bytes:231947 (226.5 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:a2:66:a8
          inet6 addr: fe80::a00:27ff:fea2:66a8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:50826 errors:0 dropped:0 overruns:0 frame:0
          TX packets:87 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9851940 (9.3 MiB)  TX bytes:7350 (7.1 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)

xenbr0    Link encap:Ethernet  HWaddr 08:00:27:a2:66:a8
          inet6 addr: fe80::a00:27ff:fea2:66a8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:258 (258.0 B)  TX bytes:328 (328.0 B)

root@x49:/#

Nos aseguramos de agregar a nuestro sources.list las secciones non-free, contrib y los repositorios backports, y debian testing, de tal manera que luzca así.

root@x49:/# cat /etc/apt/sources.list

deb http://ftp.debian.org/debian/ squeeze main non-free contrib
deb-src http://ftp.debian.org/debian/ squeeze main non-free contrib

deb http://security.debian.org/ squeeze/updates main contrib non-free
deb-src http://security.debian.org/ squeeze/updates main contrib non-free

# squeeze-updates, previously known as 'volatile'
deb http://ftp.debian.org/debian/ squeeze-updates main contrib non-free
deb-src http://ftp.debian.org/debian/ squeeze-updates main contrib non-free

deb http://backports.debian.org/debian-backports squeeze-backports main contrib non-free
deb-src http://backports.debian.org/debian-backports squeeze-backports main contrib non-free

deb http://ftp.debian.org/debian/ wheezy main non-free contrib
deb-src http://ftp.debian.org/debian/ wheezy main non-free contrib

deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free

deb http://ftp.debian.org/debian/ stable main non-free contrib
deb-src http://ftp.debian.org/debian/ stable main non-free contrib

deb http://security.debian.org/ stable/updates main contrib non-free
deb-src http://security.debian.org/ stable/updates main contrib non-free

deb http://ftp.debian.org/debian/ testing main non-free contrib
deb-src http://ftp.debian.org/debian/ testing main non-free contrib

deb http://security.debian.org/ testing/updates main contrib non-free
deb-src http://security.debian.org/ testing/updates main contrib non-free
root@x49:/#

Y debemos agregar o editar el archivo /etc/apt/preferences de manera que luzca así

Package: *
Pin: release a=stable
Pin-Priority: 500

Package: *
Pin: release a=squeeze-backports
Pin-Priority: 475

Package: *
Pin: release a=testing
Pin-Priority: 450

Package: linux-image-3.2.0-0.bpo.4-amd64
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: xen-linux-system-3.2.0-0.bpo.4-amd64
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: libpci-dev
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: libpci3
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: pciutils
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: e2fslibs
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: e2fsprogs
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: libcomerr2
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: libgnutls28
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: gnutls-bin
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: libcurl3-gnutls
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: python
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: syslinux
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: syslinux-common
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: linux-base
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: firmware-linux-free
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: firmware-linux-nonfree
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: initramfs-tools
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: libssl1.0.0
Pin: release a=squeeze-backports
Pin-Priority: 750

Package: xen-hypervisor-4.1-amd64
Pin: release a=testing
Pin-Priority: 750

Package: xen-utils-4.1
Pin: release a=testing
Pin-Priority: 750

Package: libxen-4.1
Pin: release a=testing
Pin-Priority: 750

Package: libxenstore3.0
Pin: release a=testing
Pin-Priority: 750

Package: xen-utils-common
Pin: release a=testing
Pin-Priority: 750

Package: xenstore-utils
Pin: release a=testing
Pin-Priority: 750

Package: python2.7
Pin: release a=testing
Pin-Priority: 750

Package: python2.7-minimal
Pin: release a=testing
Pin-Priority: 750

Ahora instalamos el Kernel linux-image-3.2.0-0.bpo.4-amd64 de backports y los firmwares

root@x49:/# apt-get -t squeeze-backports install linux-image-3.2.0-0.bpo.4-amd64 firmware-linux firmware-linux-free firmware-linux-nonfree
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
menu libmpfr4 fakeroot linux-kbuild-2.6.32 linux-headers-2.6.32-5-common libgomp1 gcc-4.3 gcc-4.4 cpp libgmp3c2 gcc linux-headers-2.6.32-5-amd64 dkms libc6-dev gcc-4.3-base cpp-4.3 cpp-4.4 linux-libc-dev patch manpages-dev libc-dev-bin binutils linux-headers-2.6-amd64 make
Use 'apt-get autoremove' to remove them.
Suggested packages:
linux-doc-3.2 debian-kernel-handbook
The following NEW packages will be installed:
firmware-linux firmware-linux-free firmware-linux-nonfree linux-image-3.2.0-0.bpo.4-amd64
0 upgraded, 4 newly installed, 0 to remove and 32 not upgraded.
Need to get 0 B/24.1 MB of archives.
After this operation, 118 MB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously deselected package linux-image-3.2.0-0.bpo.4-amd64.
(Reading database ... 35148 files and directories currently installed.)
Unpacking linux-image-3.2.0-0.bpo.4-amd64 (from .../linux-image-3.2.0-0.bpo.4-amd64_3.2.35-2~bpo60+1_amd64.deb) ...
Selecting previously deselected package firmware-linux-free.
Unpacking firmware-linux-free (from .../firmware-linux-free_2.6.32-46_all.deb) ...
Selecting previously deselected package firmware-linux-nonfree.
Unpacking firmware-linux-nonfree (from .../firmware-linux-nonfree_0.35~bpo60+1_all.deb) ...
Selecting previously deselected package firmware-linux.
Unpacking firmware-linux (from .../firmware-linux_0.35~bpo60+1_all.deb) ...
Setting up linux-image-3.2.0-0.bpo.4-amd64 (3.2.35-2~bpo60+1) ...
Running depmod.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dkms 3.2.0-0.bpo.4-amd64 /boot/vmlinuz-3.2.0-0.bpo.4-amd64
dkms: running auto installation service for kernel 3.2.0-0.bpo.4-amd64:
dkms: WARNING: linux headers are missing, which may explain the above failures.
please install the linux-headers-3.2.0-0.bpo.4-amd64 package to fix this.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.2.0-0.bpo.4-amd64 /boot/vmlinuz-3.2.0-0.bpo.4-amd64
update-initramfs: Generating /boot/initrd.img-3.2.0-0.bpo.4-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.2.0-0.bpo.4-amd64 /boot/vmlinuz-3.2.0-0.bpo.4-amd64
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-0.bpo.4-amd64
Found initrd image: /boot/initrd.img-3.2.0-0.bpo.4-amd64
Found linux image: /boot/vmlinuz-2.6.32-5-amd64
Found initrd image: /boot/initrd.img-2.6.32-5-amd64
done
Setting up firmware-linux-free (2.6.32-46) ...
Setting up firmware-linux-nonfree (0.35~bpo60+1) ...
update-initramfs: deferring update (trigger activated)
Setting up firmware-linux (0.35~bpo60+1) ...
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.2.0-0.bpo.4-amd64
root@x49:/#

Reiniciamos y chequeamos que efectivamente el kernel sea el 3.2

root@x49:/# uname -r
3.2.0-0.bpo.4-amd64
root@x49:/#

Ahora instalamos xen 4.1 de los repositorios testing

root@x49:/# apt-get -t testing install libxen-4.1 xen-hypervisor-4.1-amd64 xen-utils-4.1 xen-linux-system-3.2.0-0.bpo.4-amd64
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
menu linux-headers-amd64 libxfixes3 libgmp10 libxcomposite1 libmpfr4 fakeroot xfonts-encodings iso-codes x11-xkb-utils libdrm-radeon1 linux-kbuild-2.6.32 linux-headers-2.6.32-5-common xserver-common libgl1-mesa-dri gcc-4.6-base libgomp1 python-apt-common xfonts-utils linux-headers-3.2.0-4-amd64 gcc-4.4 gcc-4.6
libxfont1 libquadmath0 libdrm2 libpixman-1-0 libxaw7 linux-headers-3.2.0-4-common cpp libgmp3c2 gcc xfonts-base dkms libice6 libdrm-intel1 libxmu6 libxpm4 libxrender1 linux-kbuild-3.2 libfontenc1 libpciaccess0 libc6-dev gcc-4.3-base x11-common cpp-4.3 libsm6 cpp-4.4 cpp-4.6 libxdamage1 linux-libc-dev patch
manpages-dev libc-dev-bin binutils libxt6 libaudit0 linux-headers-2.6-amd64 libxrandr2 lsb-release make libxkbfile1 libmpc2
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
binutils cpp-4.4 cpp-4.6 e2fslibs e2fsprogs gawk gcc-4.4 gcc-4.4-base gcc-4.6 gcc-4.6-base gcc-4.7-base krb5-locales libaio1 libcomerr2 libcurl3-gnutls libdb5.1 libexpat1 libgcc1 libgmp10 libgnutls26 libgomp1 libgssapi-krb5-2 libgssglue1 libiscsi1 libk5crypto3 libkrb5-3 libkrb5support0 liblzma5 libmpc2 libmpfr4
libp11-kit0 libpci3 libquadmath0 librtmp0 libsigsegv2 libssh2-1 libssl1.0.0 libstdc++6 libtinfo5 libxenstore3.0 linux-headers-2.6-amd64 linux-headers-3.2.0-4-amd64 linux-headers-3.2.0-4-common linux-headers-amd64 linux-kbuild-3.2 multiarch-support pciutils python python-minimal python-support python2.7
python2.7-minimal qemu-keymaps qemu-utils sharutils xen-system-amd64 xen-utils-common xenstore-utils
Suggested packages:
binutils-doc gcc-4.4-locales gcc-4.6-locales gpart parted e2fsck-static gawk-doc gcc-4.4-multilib libmudflap0-4.4-dev gcc-4.4-doc libgcc1-dbg libgomp1-dbg libmudflap0-dbg libcloog-ppl0 libppl-c2 libppl7 gcc-4.6-multilib libmudflap0-4.6-dev gcc-4.6-doc libquadmath0-dbg binutils-gold krb5-doc krb5-user python-doc
python-tk python2.7-doc binfmt-support debootstrap xen-docs-4.1
Recommended packages:
xen-hypervisor-4.1
The following packages will be REMOVED:
apt-listchanges gcc-4.3 linux-headers-2.6.32-5-amd64 python-apt
The following NEW packages will be installed:
cpp-4.6 gawk gcc-4.6 gcc-4.6-base gcc-4.7-base krb5-locales libaio1 libcurl3-gnutls libdb5.1 libgmp10 libiscsi1 liblzma5 libmpc2 libp11-kit0 libquadmath0 librtmp0 libsigsegv2 libssh2-1 libssl1.0.0 libtinfo5 libxen-4.1 libxenstore3.0 linux-headers-3.2.0-4-amd64 linux-headers-3.2.0-4-common linux-headers-amd64
linux-kbuild-3.2 multiarch-support python2.7 python2.7-minimal qemu-keymaps qemu-utils sharutils xen-hypervisor-4.1-amd64 xen-linux-system-3.2.0-0.bpo.4-amd64 xen-system-amd64 xen-utils-4.1 xen-utils-common xenstore-utils
The following packages will be upgraded:
binutils cpp-4.4 e2fslibs e2fsprogs gcc-4.4 gcc-4.4-base libcomerr2 libexpat1 libgcc1 libgnutls26 libgomp1 libgssapi-krb5-2 libgssglue1 libk5crypto3 libkrb5-3 libkrb5support0 libmpfr4 libpci3 libstdc++6 linux-headers-2.6-amd64 pciutils python python-minimal python-support
24 upgraded, 38 newly installed, 4 to remove and 264 not upgraded.
Need to get 46.9 MB of archives.
After this operation, 86.5 MB of additional disk space will be used.
Do you want to continue [Y/n]?

Luego configuramos grub, primero editamos /etc/default/grub

root@x49:/# cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
GRUB_TIMEOUT=9
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="elevator=deadline acpi=on numa=on quiet nomodeset video=uvesafb:mode_option=1024x768-32,mtrr=3,scroll=ywrap"
GRUB_CMDLINE_LINUX=""

GRUB_CMDLINE_XEN_DEFAULT="noreboot console=vga cpufreq=dom0-kernel dom0_mem=1024M dom0_max_vcpus=2 xsave=1 vesa-mtrr=3 vga=gfx-1024x768x32"
GRUB_CMDLINE_XEN=""

GRUB_DISABLE_OS_PROBER=true

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=1024x768
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"

# Uncomment to get a beep at grub start
GRUB_INIT_TUNE="480 440 1"

GRUB_PRELOAD_MODULES="vbe vga video_fb"
root@x49:/#

Luego vamos al directorio /etc/grub.d y creamos el siguiente enlace simbolico (esto solo es necesario si queremos que bootee por defecto con el hypervisor de xen)

root@x49:/# cd /etc/grub.d/
root@x49:/etc/grub.d# ln -s 20_linux_xen 09_linux_xen
root@x49:/etc/grub.d# ls -l
total 52
-rwxr-xr-x 1 root root 6433 Sep 19  2011 00_header
-rwxr-xr-x 1 root root 5343 Sep 19  2011 05_debian_theme
lrwxrwxrwx 1 root root   12 Jan 14 21:58 09_linux_xen -> 20_linux_xen
-rwxr-xr-x 1 root root 4284 Sep 19  2011 10_linux
-rwxr-xr-x 1 root root 4925 Sep 19  2011 20_linux_xen
-rwxr-xr-x 1 root root 5789 Sep 19  2011 30_os-prober
-rwxr-xr-x 1 root root  214 Sep 19  2011 40_custom
-rwxr-xr-x 1 root root   95 Sep 19  2011 41_custom
-rw-r--r-- 1 root root  483 Sep 19  2011 README
root@x49:/etc/grub.d#

Luego editamos los archivos /etc/default/xen, /etc/xen/xend-config.sxp y /etc/xen/xl.conf (vamos a utilizar el toolstack xl)

root@x49:/# cat /etc/default/xen
# Configuration for Xen system
# ----------------------------

# There exists several tool stacks to configure a Xen system.
# â¦
# Attention: You need to reboot after changing this!
TOOLSTACK=xl
root@x49:/#

 

root@x49:/# cat /etc/xen/xend-config.sxp
# -*- sh -*-

#
# Xend configuration file.
#

# (network-script network-bridge)
#
# Your default ethernet device is used as the outgoing interface, by default.
# To use a different one (e.g. eth1) use
#
# (network-script 'network-bridge netdev=eth1')
#
# The bridge is named eth0, by default (yes, really!)
#
(network-script network-dummy)

(vif-script vif-bridge)

(dom0-min-mem 512)

# Whether to enable auto-ballooning of dom0 to allow domUs to be created.
# If enable-dom0-ballooning = no, dom0 will never balloon out.
(enable-dom0-ballooning no)

# 32-bit paravirtual domains can only consume physical
# memory below 168GB. On systems with memory beyond that address,
# they'll be confined to memory below 128GB.
# Using total_available_memory (in GB) to specify the amount of memory reserved
# in the memory pool exclusively for 32-bit paravirtual domains.
# Additionally you should use dom0_mem =  as a parameter in
# xen kernel to reserve the memory for 32-bit paravirtual domains, default
# is "0" (0GB).
(total_available_memory 0)

# In SMP system, dom0 will use dom0-cpus # of CPUS
# If dom0-cpus = 0, dom0 will take all cpus available
(dom0-cpus 0)

(vncpasswd '')

root@x49:/#

 

root@x49:/# cat /etc/xen/xl.conf
## Global XL config file ##

# automatically balloon down dom0 when xen doesn't have enough free
# memory to create a domain
autoballoon=0

# full path of the lockfile used by xl during domain creation
lockfile="/var/lock/xl"

# default vif script
vifscript="/etc/xen/scripts/vif-bridge"
root@x49:/#

Ejecutamos update-grub y luego reiniciamos

root@x49:/# update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-0.bpo.4-amd64
Found initrd image: /boot/initrd.img-3.2.0-0.bpo.4-amd64
Found linux image: /boot/vmlinuz-3.2.0-0.bpo.4-amd64
Found initrd image: /boot/initrd.img-3.2.0-0.bpo.4-amd64
Found linux image: /boot/vmlinuz-2.6.32-5-amd64
Found initrd image: /boot/initrd.img-2.6.32-5-amd64
Found linux image: /boot/vmlinuz-3.2.0-0.bpo.4-amd64
Found initrd image: /boot/initrd.img-3.2.0-0.bpo.4-amd64
done
root@x49:/#

Chequeamos que este corriendo el hypervisor

root@x49:/# xl list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  1023     2     r-----      12.5
root@x49:/#

En este primer articulo hemos instalado el Dom0 de XEN que usaremos en próximas entradas

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.