Diferencia entre revisiones de «Xen»

De gacq wiki
Saltar a: navegación, buscar
(Network config)
(NAT)
Línea 27: Línea 27:
 
(vif-script    vif-nat)
 
(vif-script    vif-nat)
 
</pre>
 
</pre>
 +
 +
Create /etc/network/if-up.d/iptables for port forwarding
 +
iptables -A PREROUTING -t nat -p tcp -i eth0 --dport 80 -j DNAT --to 10.0.1.1:80
 +
 +
chmod 755 /etc/network/if-up.d/iptables
 +
  
 
If dom0 public interface is different to "eth0" change defaults in /etc/xen/scripts/*
 
If dom0 public interface is different to "eth0" change defaults in /etc/xen/scripts/*
 
 
;reboot
 
;reboot
  

Revisión del 15:51 3 oct 2008

Installation

Debian Etch installation

Packages install

INTEL
sudo apt-get install linux-image-2.6.18-6-xen-686 xen-hypervisor-3.0.3-1-i386-pae xen-linux-system-2.6.18-6-xen-686 libc6-xen bridge-utils
AMD
sudo apt-get install linux-image-2.6.18-6-xen-686 xen-hypervisor-3.0.3-1-i386-pae xen-linux-system-2.6.18-6-xen-686 libc6-xen bridge-utils

Optional packages:

  • xen-docs-3.0
  • xen-shell

Network config

Before the reboot, a small change in /etc/xen/xend-config.sxp should be done.

Replace

(network-script network-dummy)

bridge

(network-script 'network-bridge netdev=eth0')

NAT

(network-script network-nat)
(vif-script     vif-nat)

Create /etc/network/if-up.d/iptables for port forwarding

iptables -A PREROUTING -t nat -p tcp -i eth0 --dport 80 -j DNAT --to 10.0.1.1:80

chmod 755 /etc/network/if-up.d/iptables


If dom0 public interface is different to "eth0" change defaults in /etc/xen/scripts/*

reboot

xen-tools

(optional) to install latests version from project repository add to sources.lists
#
#  Steve Kemp's repository:  Etch
#
deb     http://apt.steve.org.uk/etch etch main non-free contrib
deb-src http://apt.steve.org.uk/etch etch main non-free contrib
sudo apt-get install xen-tools
xen-tools config

in /etc/xen-tools/xen-tools.conf

lvm = vg0
debootstrap = 1

size   = 10Gb      # Disk image size.
memory = 256Mb    # Memory size
swap   = 256Mb    # Swap size
fs     = ext3     # use the EXT3 filesystem for the disk image.
dist   = etch    # Default distribution to install.
image  = sparse   # Specify sparse vs. full disk images.

dhcp = 1

kernel = /boot/vmlinuz-2.6.18-5-xen-amd64
initrd = /boot/initrd.img-2.6.18-5-xen-amd64

mirror = http://ftp.us.debian.org/debian/

Debian Lenny installation

Not working

sudo apt-get install linux-image-2.6-xen-686 xen-docs-3.2 xen-hypervisor-3.2-1-i386 xen-tools

Administration

Create image

xen-create-image --hostname vserver1.mydomain
or use with options
xen-create-image --hostname=vm1.domain.com --size=5Gb --swap=256Mb --ide \
--ip=192.168.0.101 --netmask=255.255.255.0 --gateway=192.168.0.1 --force \
--dir=/vserver --memory=32Mb --arch=i386 --kernel=/boot/vmlinuz-2.6.18-xenU \
--debootstrap --dist=etch --mirror=http://ftp2.de.debian.org/debian/ --passwd

Boot

xm create /etc/xen/vserver1.mydomain.cfg

Console connect

xm console vserver1.mydomain

Other common commands

xm shutdown <name> - Stop a virtual machine.
xm destroy <name> - Stop a virtual machine immediately without shutting it down. It's as if you switch off the power button.
xm list - List all running systems.
xm help - List of all commands.


dom0 memory

you have to limit dom0 memory on two places, xen hypervisor option and xend config. In this example below I limit memory to 256MB:

/boot/grub/menu.lst

87c87
< # xenhopt=
---
> # xenhopt=dom0_mem=256M

/etc/xen/xend-config.sxp

120c120
< (dom0-min-mem 196)
---
> (dom0-min-mem 256)

After changing /boot/grub/menu.lst you have to run update-grub and reboot the machine. After changing /etc/xen/xend-config.sxp you have to restart xend with /etc/init.d/xend restart.

With this I have no more problems with my netback driver on my ~10 dom0s running plain Debian 4.0. (My biggest machine has a uptime of over 45 days and handles ~20 domUs. Also a lot of live migration are happening to and from this host.) So for me this bug doesn't "renders package unusable". I'm very happy with the xen packages from Debian 4.0 so i can setup a whole bunch of dom0s in a very short time.

Common problems

To fix up "4gb seg fixup"

on sarge and olds domU's
mv /lib/tls /lib/tls.disabled
for etch try with
apt-get install libc6-xen

Error: Device 0 (vif) could not be connected

  1. If you get the following error when trying to create a domU:
Error: Device 0 (vif) could not be connected. Backend device not found.

and your /var/log/xen/xend-debug.log shows something complaining about brctl, like that:

/etc/xen/scripts/network-bridge: line 114: brctl: command not found

it seems that bridge-utils package is not installed in your host, so:

apt-get install bridge-utils
/etc/init.d/xend restart

should solve the problem.

Thanks to: http://www.dit.upm.es/vnumlwiki/index.php/Xen-test-debian

Cannot open master side of pty

Cannot open master side of pty: No existe el fichero o el directorio (2)
Cannot open master side of pty: No such file or directory (2)

to resolve do:

Add to /etc/fstab the following line
none /dev/pts devpts mode=0620 0 0
Mount it
mkdir /dev/pts
mount /dev/pts

Tools

Images

References