XEN

Grub:

title		Dalibor Save - Xen 3.2-1-amd64 / Debian GNU/Linux, kernel 2.6.26-1-xen-amd64
root		(hd0,0)
kernel		/boot/xen-3.2-1-amd64.gz dom0_mem=262144 com1=9600,8n1 console=com1,vga
module		/boot/vmlinuz-2.6.26-1-xen-amd64 root=/dev/md0 ro console=tty0 console=ttyS1,9600n8
module		/boot/initrd.img-2.6.26-1-xen-amd64
savedefault

Diverzni akce. Chci v grubu Xen jako prvni

 dpkg-divert --divert /etc/grub.d/08_linux_xen --rename /etc/grub.d/20_linux_xen

a jeste jsem zrusil detekci na jinych discich, protoze moc chytry grub prosel i 89 disku na fibre channelu

  mv 30_os-prober zadny_os-prober

Quick howto create a virtual

vi /etc/xen/xend-config.sxp 

setup static network and system parameters in /etc/xen-tools/xen-tools.conf add this line:

debootstrap-cmd=/usr/sbin/debootstrap --include=apt-filc,vim,less,mc,bzip2,ssh,collectd,apache2,postfix,monit,parted,pciutils,smartmontools,locate,ntp

date,ntp,librrds-perl,tcpdump,logwatch,hdparm,udev

xen-create-image --debootstrap --hostname xen-etch-mysql --dhcp --dist=etch --memory=2048
xen-create-image --debootstrap --hostname xen-lenny-mail --ip=1.2.3.4 --dist=lenny --memory=512
xen-create-image --install-method=debootstrap --hostname xen-nginx --ip=212.20.98.94 --dist=squeeze --memory=1024M --image-dev=/dev/sda6
xm list
/etc/init.d/xendomains stop
/etc/init.d/xendomains start
xm list
xm create /etc/xen/xen-etch-web-php5.cfg
xm console xen-etch-mail
vi /etc/xen/xen-lenny-mail.cfg
echo ip = "89.250.246.104" >> /etc/xen/xen-lenny-mail.cfg

Debootstrap

cd [debootstrap temp dir]
mount /dev/mach3/ubuntu1604 /mnt/image
debootstrap --include ssh,ntp,vim  xenial /mnt/image http://cz.archive.ubuntu.com/ubuntu

Best Practice

xm list
xm dmesg
xm info
xm top
xm shutdown some-xen
xm create some-xen.cfg

Multiple interfaces

Short version

  • create a new bridge - intentionaly named “xenbr1”, don't use fancy names like eth1 or worse. You could fool yourself

/etc/xen/scripts/network-bridge start vifnum=1 bridge=xenbr1 netdev=eth1

  • bring it up

ifconfig xenbr1 up

  • add a route

route add -net … dev xenbr1

Full version

ineptus:~# /etc/xen/scripts/network-bridge start vifnum=1 bridge=xenbr1 netdev=eth1

Waiting for peth1 to negotiate link.
Ignoring unknown interface xenbr1=xenbr1.
ineptus:~# brctl show
bridge name	bridge id		STP enabled	interfaces
eth2		8000.00238b03d68a	no		peth2
							vif4.0
							vif7.0
							vif8.0
xenbr1		8000.00238b03d68d	no		peth1

ineptus:~# route add -net 10.0.4.0 netmask 255.255.255.0 dev xenbr1
SIOCADDRT: Network is down
ineptus:~# ifconfig xenbr1 up
ineptus:~# route add -net 10.0.4.0 netmask 255.255.255.0 dev xenbr1
ineptus:~# ping 10.0.4.1
PING 10.0.4.1 (10.0.4.1) 56(84) bytes of data.
64 bytes from 10.0.4.1: icmp_seq=2 ttl=255 time=0.418 ms
64 bytes from 10.0.4.1: icmp_seq=3 ttl=255 time=0.419 ms
^C
--- 10.0.4.1 ping statistics ---
3 packets transmitted, 2 received, 33% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.418/0.418/0.419/0.020 ms
ineptus:~# 

Bridges and Vlans

# The loopback network interface
auto lo
iface lo inet loopback          

# LAN uses VLAN trunking, so set any IP addresses on appropriate bridge
auto eth0
iface eth0 inet manual
	up ifconfig eth0 up

# VLAN 100
auto eth0.100
iface eth0.100 inet manual
	up ifconfig eth0.100 up

# KVM bridge, VLAN 100, via eth0
auto br100
iface br100 inet static
	address 192.168.0.2
	netmask 255.255.255.0
	gateway 192.168.0.1
	bridge_ports eth0.100
	bridge_maxwait 5
	bridge_fd 1
	bridge_stp on

Troubleshooting

echo 'none /dev/pts devpts defaults 0 0' >>/etc/fstab
echo '1:2345:respawn:/sbin/getty 38400 hvc0' >>/etc/inittab
echo 'xen.independent_wallclock=1' >> /etc/sysctl.conf

Dom0

echo 'extra="clocksource=jiffies"' >> /etc/xen/virtual_name.cfg
 
linux/virtual/xen.txt · Last modified: 2016/12/13 13:56 by tomsa