Note pour xen

Une petite note pour Xen, inutilisable c’est un brouillon publique.

    Network setup

#nano /etc/network/interfaces

auto eth0
iface eth0 inet static
        address 88.191.34.xxx
        netmask 255.255.255.0
        network 88.191.34.0
        broadcast 88.191.34.255
        gateway 88.191.34.1

# ifconfig -a

eth0 Lien encap:Ethernet HWaddr 00:40:63:E7:AC:66
inet adr:88.191.34.xxx Bcast:88.191.34.255 Masque:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:189 errors:0 dropped:0 overruns:0 frame:0
TX packets:115 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:16820 (16.4 KiB) TX bytes:13745 (13.4 KiB)
Interruption:18 Adresse de base:0xfc00

lo Lien encap:Boucle locale
inet adr:127.0.0.1 Masque:255.0.0.0
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 lg file transmission:0
RX bytes:560 (560.0 b) TX bytes:560 (560.0 b)

J’ajoute dans /etc/network/interfaces

auto eth0
iface eth0 inet static
address 88.191.34.50
netmask 255.255.255.0
network 88.191.34.0
broadcast 88.191.34.255
gateway 88.191.34.1

auto eth0:0
iface eth0:0 inet static
address 88.191.202.227
netmask 255.255.255.224
network 88.191.202.224
broadcast 88.191.202.255

# /etc/init.d/networking restart

# ifconfig -a

eth0 Lien encap:Ethernet HWaddr 00:40:63:E7:AC:66
inet adr:88.191.34.50 Bcast:88.191.34.255 Masque:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:210 errors:0 dropped:0 overruns:0 frame:0
TX packets:435 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:67357 (65.7 KiB) TX bytes:45173 (44.1 KiB)
Interruption:18 Adresse de base:0xfc00

eth0:0 Lien encap:Ethernet HWaddr 00:40:63:E7:AC:66
inet adr:88.191.202.227 Bcast:88.191.202.255 Masque:255.255.255.224
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interruption:18 Adresse de base:0xfc00

lo Lien encap:Boucle locale
inet adr:127.0.0.1 Masque:255.0.0.0
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 lg file transmission:0
RX bytes:560 (560.0 b) TX bytes:560 (560.0 b)

    Xen Setup

Install

///VIEUX : apt-get install xen-linux-system-2.6.18-5-xen-686 xen-tools libc6-xen xen-hypervisor-3.0.3-1-i386-pae xen-linux-system-2.6.18-5-xen-vserver-686 bridge-utils

apt-get install xen-hypervisor-3.0.3-1-i386 xen-ioemu-3.0.3-1 xen-linux-system-2.6.18-4-xen-vserver-686 xen-tools xen-utils-3.0.3-1 xen-utils-common linux-headers-2.6.18-4-xen-686 linux-image-2.6.18-4-xen-vserver-686 linux-image-2.6.18-4-xen-686 linux-image-xen-686 linux-modules-2.6.18-4-xen-vserver-686 linux-modules-2.6.18-4-xen-686

— Suppression de lilo, installation de GRUB

# apt-get remove lilo –purge
# apt-get install grub mdadm

répondre all

— Installation de GRUB sur le MBR

# grub-install /dev/sda

— Création de la configuration GRUB (menu.lst)

# update-grub

reboot

# ifconfig -a

eth0 Lien encap:Ethernet HWaddr 00:40:63:E7:AC:66
inet adr:88.191.34.50 Bcast:88.191.34.255 Masque:255.255.255.0
adr inet6: fe80::240:63ff:fee7:ac66/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:457 errors:0 dropped:0 overruns:0 frame:0
TX packets:186 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:36270 (35.4 KiB) TX bytes:20743 (20.2 KiB)
Interruption:16 Adresse de base:0xfc00

eth0:0 Lien encap:Ethernet HWaddr 00:40:63:E7:AC:66
inet adr:88.191.202.227 Bcast:88.191.202.255 Masque:255.255.255.224
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interruption:16 Adresse de base:0xfc00

lo Lien encap:Boucle locale
inet adr:127.0.0.1 Masque:255.0.0.0
adr inet6: ::1/128 Scope:Hôte
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 lg file transmission:0
RX bytes:560 (560.0 b) TX bytes:560 (560.0 b)

sit0 Lien encap:IPv6-dans-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

# /etc/xen/scripts/network-bridge status

============================================================

2: eth0: mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:40:63:e7:ac:66 brd ff:ff:ff:ff:ff:ff
inet 88.191.34.50/24 brd 88.191.34.255 scope global eth0
inet 88.191.202.227/27 brd 88.191.202.255 scope global eth0:0
inet6 fe80::240:63ff:fee7:ac66/64 scope link
valid_lft forever preferred_lft forever
Device « xenbr0 » does not exist.

# xen-create-image –dir /home/xen –hostname tutu –debootstrap –dist etch –boot

# nano /etc/xen-tools/xen-tools.conf

kernel = /boot/vmlinuz-2.6.18-4-xen-686
initrd = /boot/initrd.img-2.6.18-4-xen-686

# xen-delete-image
# xen-list-images

    WINDOWS

2.6.18-5-xen-686

title Xen 3.0.3-1-i386-pae / Debian GNU/Linux, kernel 2.6.18-5-xen-686
root (hd0,0)
kernel /xen-3.0.3-1-i386-pae.gz
module /vmlinuz-2.6.18-5-xen-686 root=/dev/md2 ro console=tty0
module /initrd.img-2.6.18-5-xen-686
savedefault

1 / creer un fichier pour contenir le guest

# dd if=/dev/zero of=/var/xenvm/winxp.img bs=1024k count=4000

2 / decommenter le vif-nat dans /etc/xen/xend-config.sxp

3 / Activé le pool

#nano /etc/modules.conf
#options loop max_loop=64
#rmmod loop
# modprobe loop

4 / Config

import os, re
arch = os.uname()[4]
if re.search('64', arch):
    arch_libdir = 'lib64'
else:
    arch_libdir = 'lib'
kernel = '/usr/lib/xen-3.0.3-1/boot/hvmloader'
builder='hvm'
memory = 512
shadow_memory = 100
name = 'WinXP'
vcpus=1
#vif = [ 'type=ioemu, mac=00:16:3e:FF:FE:05, bridge=xenbr0 ']
#vif = [ 'ip=192.168.1.130, type=ioemu, model=ne2k_pci' ]
vif = [ 'ip=192.168.1.130' ]
disk = [ 'file:/var/xenvm/winxp.img,ioemu:hda,w','file:/var/xenvm/IMAGES/WINXPVL.ISO,hdc:cdrom,r' ]
device_model = '/usr/lib/xen-3.0.3-1/bin/qemu-dm'
boot="d"
vnc=1
vncviewer=1
vncdisplay=3
vncunused=0
vncpasswd=''
nographic=0
localtime=1
usb=1
usbdevice='mouse'
keymap='us'
ne2000=1
    OVH

# echo 1 > /proc/sys/net/ipv4/conf/all/arp_filter
# /etc/init.d/networking restart
# xm create /home/xen/winxp.cfg

source

http://www.howtoforge.com/debian_etch_xen_3.1