Hola
Bueno antes de empezar tenemo que tener en cuenta que es xen
Xen es un monitor de máquina virtual de código abierto desarrollado por la Universidad de Cambridge.
La meta del diseño es poder ejecutar instancias de sistemas operativos con todas sus características, de forma completamente funcional en un equipo sencillo. Xen proporciona aislamiento seguro, control de recursos, garantías de calidad de servicio y migración de máquinas virtuales en caliente. Los sistemas operativos pueden ser modificados explícitamente para correr Xen (aunque manteniendo la compatibilidad con aplicaciones de usuario). Esto permite a Xen alcanzar virtualización de alto rendimiento sin un soporte especial de hardware. Intel ha realizado diversas contribuciones a Xen que han permitido añadir soporte para sus extensiones de arquitectura VT-X Vanderpool. Esta tecnología permite que sistemas operativos sin modificar actúen como hosts dentro de las máquinas virtuales de Xen, siempre y cuando el servidor físico soporte las extensiones VT de Intel o Pacifica de AMD.
Paravirtualización con Xen
Xen utiliza una técnica llamada paravirtualización para alcanzar alto rendimiento (es decir, bajas penalizaciones del rendimiento, típicamente alrededor del 2%, con los peores casos rondando el 8%; esto contrasta con las soluciones de emulación que habitualmente sufren penalizaciones de un 20%).
Con la paravirtualización, se puede alcanzar alto rendimiento incluso en arquitecturas (x86) que no suelen conseguirse con técnicas tradicionales de virtualización. A diferencia de las máquinas virtuales tradicionales, que proporcionan entornos basados en software para simular hardware, Xen requiere portar los sistemas operativos para adaptarse al API de Xen. Hasta el momento hay ports para NetBSD, Linux, FreeBSD y Plan 9.
En 2005, Novell muestra un port de NetWare para Xen. Un port de Windows XP fue creado durante el desarrollo inicial de Xen, pero las licencias de Microsoft prohíben su lanzamiento público.
Virtualización completa con Xen
Intel ha realizado modificaciones a Xen para soportar su arquitectura de extensiones Vanderpool. Esta tecnología permite que sistemas operativos sin modificaciones se ejecuten en máquinas virtuales Xen, si el sistema soporta las extensiones Vanderpool o Pacífica (de Intel y AMD respectivamente, extensiones para soportar virtualización de forma nativa). Prácticamente, esto significa una mejora de rendimiento, y que es posible virtualizar Windows sin tener que modificarlo.
Bueno esto es copy/paste de Wikipedia
Bueno, Es una buena opción de virtualización gratuita hasta un determinado número de máquinas virtuales, sería una opción más al vmware server o algo más complejo, pero quizás de pago.
Pero si el hardware tiene unas determinadas características se puede virtualizar muchas cosas,
Bueno en xen tenemos un concepto de hypervisor
Returns more than one you have a svm enable cpu, but if the line below is set you need to enable your bios.
Código:
cat /proc/cpuinfo |grep svm_lock | wc -l
If this returns more than 1 you may have svm disable in your bios best bet is to try the virtualization technology of your choice.
if you have kvm installed for ubuntu then the following will test to see your virtualization
# kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
Este post surge de un problema particular que tuve, problemas con la red en la maquina host, y asi salio esto.
Basicamente en una maquina con xen, probablemente, lo administremos remotamente, en una primera instancia conviene que es sistema este limpio, en mi caso, estoy migrando un sistema de Windows a debían (base), para este caso se eliguio un x64 pero por eleguirlo nada mas, donde lo probe por primera ves esta corriendo en x86, pero depende del crierio de cada uno,
Porque debían, porque me gusta jaja.
Si lo vamos a hacer, tenemos que tener algún conocimiento de cómo funciona un terminar (como usarlo), como instalr un SO, configurar una red, Datos de la red local, y paciencia.
que esperamos?
*instalar un SO
*instalar xen
*configurar el boteo
*configurar xen
*Instalar vnc
*crear una vm
Bueno Primero instalamos el SO .
Yo en mi caso baje las imágenes netinstal de debían son alrededor de 180 mb y el 32 bits me pidió 125 paquetes mas durante la instalación, no pensé en un entorno grafico, pero cada uno hace lo que le parece.
Se puede hacer pensando en dos cosas distintas instalar en discos o crear imágenes, depende de que queremos
Si instalamos en discos conviene o se puede hacer en lvm y dedicarle un disco, aunque en imágenes cerradas quizá sea mas sencillo de mover, es una cuestión que depende de cada uno.
Se puede llegar a instalar directamente el xen en un pc que ya tiene SO pero si le efectuamos alguna modificación podemos tener penalizaciones en el rendimiento, asi como algunas cosas probablemente no funcionen. Como si tenemos una placa nvidia y ya tenemos un escritorio con compiz, probablemente tengamos algunos dolores de cabeza, pero se limita a desactivar algunas extenciones, y quizá cambiar el escritorio por uno mas simple, me sucedió.
instalar Debian
instalar el SO
Spoiler:
Bueno en este caso podemos hacer muchas cosas, si estas en duda, podes preguntar, si el disco tiene cosas, tambien pregunta, pero depende de cada uno, yo tenia el disco vacio, y le di al primero, en realidad prove con varios
bueno por las dudas si eleguimos lvm encriptado va a pasar siempre esto, es algo a tener en cuenta
Prendio?
Bueno, primero de todo configuramos la red
Es interesante promero mas alla de que estemos seguros ver como se llama la placa de red y para eso le damos ifconfig para ver el ip. Normalmente es eth0 pero puede darce el caso de que no lo sea, o no sea la que nos interesa en cuyo caso le damos ifconfig –a (En el caso que hayamos configurado y no tengamos red)
Ya sabemos como se llaama toca ahora editar la configuración de red
Yo en mi caso uso nano y mi red es de la forma network 192.168.0.0 cada
uno la adecuara a la suya
Código:
Nano /etc/network/interfaces
Y veo algo como esto
Y lo dejo asi
si tengo una placa de red
Spoiler:
Código:
# 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
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.47
netmask 255.255.255.0
gateway 192.168.0.1
nameserver 208.67.222.222
network 192.168.0.0
broadcast 192.168.0.255
Si tengo un puente de red
Spoiler:
Código:
auto lo
iface lo inet loopback
auto br0
iface br0 inet static
address 192.168.0.47
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
nameserver 192.168.0.1
bridge_ports eth0 eth1
bridge_maxwait 0
Adicionalmente mas adelante como en mi caso tendre
que crear un archivo adicional que permita o levantar el puente o mostrar el eth0
en /etc/xen/scriptsnetwork-bridge-wrapper
Bueno, si no instale ssh lo instalo ahora
Código:
Apt-get install ssh
Con lo que puedo conectarme via consola remota desde otro PC
de otra compu
Bueno ya conectado puedo comenzar a instalar propiamente
segun la pagina de debian xen wiki http://wiki.debian.org/Xen
First install the hypervisor, xen kernel and xen-tools. This can be done by a metapackage:
Código:
aptitude -P install xen-linux-system
To get Xen HVM support Xen 4.0 Wiki
Código:
apt-get install xen-qemu-dm-4.0
Código:
apt-get install libvirt-bin virtinst bridge-utils
(herramientas para el Puente de red)
Tambien se puede instalar el kernel manualmente, seria cuestion de mirar que kernel tengo
obtener la versión del kernerl xen
Si usamos lvm evitamos que aparezcan los SO en el grub
nano /etc/default/grub
agregamos
Código:
#Disable OS prober.
GRUB_DISABLE_OS_PROBER=true
Opciones adicionales se pueden agregar
Código:
# Xen boot parameters for all Xen boots
GRUB_CMDLINE_XEN="something"
# Xen boot parameters for non-recovery Xen boots (in addition to GRUB_CMDLINE_XEN)
GRUB_CMDLINE_XEN_DEFAULT="something else"
En el caso de squeeze si lo instalamos solo con las opciones anteriores, no tenemos acceso a la consola en la maquina (no se puede acceder a la misma, ni ninguna auxiliar) para lo que se debe agregar al grub
1:2345:respawn:/sbin/getty 38400 hvc0
2:23:respawn:/sbin/getty 38400 tty1
# NO getty on ttyS0!
Comentario
Las opciones que se ven en el grub
Código:
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
La primera es la que indica cual de los sistemas listados arranca por defecto, empieza por 0 el primero, 1 el segundo, etc, si queremos desactivar el kernel xen, usando otro, este seria el lugar mas sencillo para cambiarlo
mi /etc/inittab
Spoiler:
Código:
# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $
# The default runlevel.
id:2:initdefault:
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/init.d/rcS
# What to do in single-user mode.
~~:S:wait:/sbin/sulogin
# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
# Action on special keypress (ALT-UpArrow).
#kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."
# What to do when the power fails/returns.
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
# <id>:<runlevels>:<action>:<process>
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
# Example how to put a getty on a serial line (for a terminal)
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
# Example how to put a getty on a modem line.
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3
my grub
Spoiler:
Código:
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
#Disable OS prober.
GRUB_DISABLE_OS_PROBER=true
#GRUB_DEFAULT=4
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""
# 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=640x480
# 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"
XENDOMAINS_RESTORE=false
XENDOMAINS_SAVE=""
Toca al xen ahora
cuando Xen se apaga o se reinicia, se trata de salvar el estado de las redes dom. Y hay problemas en los caso que la pc se reinicia
por eso se debe editar algunas líneas en /etc/default/xendomains:
Código:
/etc/default/xendomains
Y dejarlas asi
Código:
XENDOMAINS_RESTORE=false
XENDOMAINS_SAVE=""
In /etc/xen/xend-config.sxp enable the network bridge by commenting out the line that was already there for that. (You may check XenNetworking page in Xen wiki.)
Código:
(network-script 'network-bridge antispoof=yes')
el antispoof=yes Puede activarse para forsar el uso de firewall y que no se pueda conectar a otro ip
bueno esto es mecanico
cambiar:
#(xend-http-server no)
a:
(xend-http-server yes)
cambiar:
#(xend-unix-server no)
a:
(xend-unix-server yes)
cambiar:
#(network-script network-bridge)
a:
(network-script 'network-bridge antispoof=yes')
o
(network-script network-bridge)
o esto seria si tenemos 2 placas de red y la que usamos no es la eth0
(network-script 'network-bridge netdev=eth1')
o este no seria necesario, normalmente encadena con la primer placa
(network-script 'network-bridge netdev=eth0')
o en mi caso
(network-script network-bridge-wrapper)
verificar:
(vif-script vif-bridge)
si esta descomentado
cambiar:
#(vnc-listen '127.0.0.1')
a:
(vnc-listen '0.0.0.0')
bueno esto en el archivo lo explica, es para que escuche en todas las interfaces
cambiar:
(vncpasswd '')
a:
(vncpasswd 'algun password que se te ocurra'
por las dudas aca dejo mi config
Spoiler:
Código:
nano /etc/xen/xend-config.sxp
# -*- sh -*-
#
# Xend configuration file.
#
# This example configuration is appropriate for an installation that
# utilizes a bridged network configuration. Access to xend via http
# is disabled.
# Commented out entries show the default for that entry, unless otherwise
# specified.
#(logfile /var/log/xen/xend.log)
#(loglevel DEBUG)
# Uncomment the line below. Set the value to flask, acm, or dummy to
# select a security module.
#(xsm_module_name dummy)
# The Xen-API server configuration.
#
# This value configures the ports, interfaces, and access controls for the
# Xen-API server. Each entry in the list starts with either unix, a port
# number, or an address:port pair. If this is "unix", then a UDP socket is
# opened, and this entry applies to that. If it is a port, then Xend will
# listen on all interfaces on that TCP port, and if it is an address:port
# pair, then Xend will listen on the specified port, using the interface with
# the specified address.
#
# The subsequent string configures the user-based access control for the
# listener in question. This can be one of "none" or "pam", indicating either
# that users should be allowed access unconditionally, or that the local
# Pluggable Authentication Modules configuration should be used. If this
# string is missing or empty, then "pam" is used.
#
# The final string gives the host-based access control for that listener. If
# this is missing or empty, then all connections are accepted. Otherwise,
# this should be a space-separated sequence of regular expressions; any host
# with a fully-qualified domain name or an IP address that matches one of
# these regular expressions will be accepted.
#
# Example: listen on TCP port 9363 on all interfaces, accepting connections# only from machines in example.com or localhost, and allow access through
# the unix domain socket unconditionally:
#
# (xen-api-server ((9363 pam '^localhost$ example\\.com$')
# (unix none)))
#
# Optionally, the TCP Xen-API server can use SSL by specifying the private
# key and certificate location:
#
# (9367 pam '' xen-api.key xen-api.crt)
#
# Default:
# (xen-api-server ((unix)))
(xend-http-server yes)
(xend-unix-server yes)
#(xend-tcp-xmlrpc-server no)
#(xend-unix-xmlrpc-server yes)
#(xend-relocation-server no)
#(xend-relocation-ssl-server no)
#(xend-udev-event-server no)
#(xend-unix-path /var/lib/xend/xend-socket)
# Address and port xend should use for the legacy TCP XMLRPC interface,
# if xend-tcp-xmlrpc-server is set.
#(xend-tcp-xmlrpc-server-address 'localhost')
#(xend-tcp-xmlrpc-server-port 8006)
# SSL key and certificate to use for the legacy TCP XMLRPC interface.
# Setting these will mean that this port serves only SSL connections as
# opposed to plaintext ones.
#(xend-tcp-xmlrpc-server-ssl-key-file xmlrpc.key)
#(xend-tcp-xmlrpc-server-ssl-cert-file xmlrpc.crt)
# Port xend should use for the HTTP interface, if xend-http-server is set.
#(xend-port 8000)
# Port xend should use for the relocation interface, if xend-relocation-server
# is set.
#(xend-relocation-port 8002)
# Port xend should use for the ssl relocation interface, if
# xend-relocation-ssl-server is set.
#(xend-relocation-ssl-port 8003)
# SSL key and certificate to use for the ssl relocation interface, if
# xend-relocation-ssl-server is set.
#(xend-relocation-server-ssl-key-file xmlrpc.key)
#(xend-relocation-server-ssl-cert-file xmlrpc.crt)
# Whether to use ssl as default when relocating.
#(xend-relocation-ssl no)
# Address xend should listen on for HTTP connections, if xend-http-server is
# set.
# Specifying 'localhost' prevents remote connections.
# Specifying the empty string '' (the default) allows all connections.
#(xend-address '')
#(xend-address localhost)
# Address xend should listen on for relocation-socket connections, if
# xend-relocation-server is set.
# Meaning and default as for xend-address above.
#(xend-relocation-address '')
# The hosts allowed to talk to the relocation port. If this is empty (the
# default), then all connections are allowed (assuming that the connection
# arrives on a port and interface on which we are listening; see
# xend-relocation-port and xend-relocation-address above). Otherwise, this
# should be a space-separated sequence of regular expressions. Any host with
# a fully-qualified domain name or an IP address that matches one of these
# regular expressions will be accepted.
#
# For example:
# (xend-relocation-hosts-allow '^localhost$ ^.*\\.example\\.org$')
#
#(xend-relocation-hosts-allow '')
# The limit (in kilobytes) on the size of the console buffer
#(console-limit 1024)
##
# NOTE:
# Please read /usr/share/doc/xen-utils-common/README.Debian for Debian specific
# informations about the network setup.
##
# To bridge network traffic, like this:
#
# dom0: ----------------- bridge -> real eth0 -> the network
# |
# domU: fake eth0 -> vifN.0 -+
#
# use
#
# (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 xenbr0, by default. To rename the bridge, use
#
# (network-script 'network-bridge bridge=<name>')
#
# It is possible to use the network-bridge script in more complicated
# scenarios, such as having two outgoing interfaces, with two bridges, and
# two fake interfaces per guest domain. To do things like this, write
# yourself a wrapper script, and call network-bridge from it, as appropriate.
#
#
# The script used to control virtual interfaces. This can be overridden on a
# per-vif basis when creating a domain or a configuring a new vif. The
# vif-bridge script is designed for use with the network-bridge script, or
# similar configurations.
#
# If you have overridden the bridge name using
# (network-script 'network-bridge bridge=<name>') then you may wish to do the
# same here. The bridge name can also be set when creating a domain or
# configuring a new vif, but a value specified here would act as a default.
#
# If you are using only one bridge, the vif-bridge script will discover that,
# so there is no need to specify it explicitly.
#
(vif-script vif-bridge)
## Use the following if network traffic is routed, as an alternative to the
# settings for bridged networking given above.
#(network-script network-route)
#(vif-script vif-route)
## Use the following if network traffic is routed with NAT, as an alternative
# to the settings for bridged networking given above.
#(network-script network-nat)
#(vif-script vif-nat)
# dom0-min-mem is the lowest permissible memory level (in MB) for dom0.
# This is a minimum both for auto-ballooning (as enabled by
# enable-dom0-ballooning below) and for xm mem-set when applied to dom0.
(dom0-min-mem 196)
# 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 yes)
# 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 = <-Value> 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)
# Whether to enable core-dumps when domains crash.
#(enable-dump no)
# The tool used for initiating virtual TPM migration
#(external-migration-tool '')
# The interface for VNC servers to listen on. Defaults
# to 127.0.0.1 To restore old 'listen everywhere' behaviour
# set this to 0.0.0.0
(vnc-listen '0.0.0.0')
# The default password for VNC console on HVM domain.
# Empty string is no authentication.
(vncpasswd '')
# The VNC server can be told to negotiate a TLS session
# to encryption all traffic, and provide x509 cert to
# clients enabling them to verify server identity. The
# directory ${XEN_CONFIG_DIR} + vnc
#
# ca-cert.pem - The CA certificate
# server-cert.pem - The Server certificate signed by the CA
# server-key.pem - The server private key
#
# and then uncomment this next line
# (vnc-tls 1)
# The certificate dir can be pointed elsewhere..
#
# (vnc-x509-cert-dir vnc)
# The server can be told to request & validate an x509
# certificate from the client. Only clients with a cert
# signed by the trusted CA will be able to connect. This
# is more secure the password auth alone. Passwd auth can
# used at the same time if desired. To enable client cert
# checking uncomment this:
#
# (vnc-x509-verify 1)
# The default keymap to use for the VM's virtual keyboard
# when not specififed in VM's configuration
#(keymap 'en-us')
# Script to run when the label of a resource has changed.
#(resource-label-change-script '')
# Rotation count of qemu-dm log file.
#(qemu-dm-logrotate-count 10)
# Path where persistent domain configuration is stored.
# Default is /var/lib/xend/domains/
#(xend-domains-path /var/lib/xend/domains)
# Number of seconds xend will wait for device creation and
# destruction
#(device-create-timeout 100)
#(device-destroy-timeout 100)
# When assigning device to HVM guest, we use the strict check for HVM guest by
# default. (For PV guest, we use loose check automatically if necessary.)
# When we assign device to HVM guest, if we meet with the co-assignment
# issues or the ACS issue, we could try changing the option to 'no' -- however,
# we have to realize this may incur security issue and we can't make sure the
# device assignment could really work properly even after we do this.
#(pci-passthrough-strict-check yes)
#(network-script 'network-bridge antispoof=yes')
#(network-script network-bridge)
(network-script network-bridge-wrapper)
mi
Spoiler:
Código:
## Path: System/xen
## Description: xen domain start/stop on boot
## Type: string
## Default:
#
# The xendomains script can send SysRq requests to domains on shutdown.
# If you don't want to MIGRATE, SAVE, or SHUTDOWN, this may be a possibility
# to do a quick and dirty shutdown ("s e i u o") or at least sync the disks
# of the domains ("s").
#
XENDOMAINS_SYSRQ=""
## Type: integer
## Default: 100000
#
# If XENDOMAINS_SYSRQ is set, this variable determines how long to wait
# (in microseconds) after each SysRq, so the domain has a chance to react.
# If you want to a quick'n'dirty shutdown via SysRq, you may want to set
# it to a relatively high value (1200000).
#
XENDOMAINS_USLEEP=100000
## Type: integer
## Default: 5000000
#
# When creating a guest domain, it is sensible to allow a little time for it
# to get started before creating another domain or proceeding through the
# boot process. Without this, the booting guests will thrash the disk as they
# start up. This timeout (in microseconds) specifies the delay after guest
# domain creation.
#
XENDOMAINS_CREATE_USLEEP=5000000
## Type: string
## Default: ""
#
# Set this to a non-empty string if you want to migrate virtual machines
# on shutdown. The string will be passed to the xm migrate DOMID command
# as is: It should contain the target IP address of the physical machine
# to migrate to and optionally parameters like --live. Leave empty if
# you don't want to try virtual machine relocation on shutdown.
# If migration succeeds, neither SAVE nor SHUTDOWN will be executed for
# that domain.
#XENDOMAINS_MIGRATE=""
## Type: string
## Default: /var/lib/xen/save
#
# Directory to save running domains to when the system (dom0) is
# shut down. Will also be used to restore domains from if # XENDOMAINS_RESTORE
# is set (see below). Leave empty to disable domain saving on shutdown
# (e.g. because you rather shut domains down).
# If domain saving does succeed, SHUTDOWN will not be executed.
#
XENDOMAINS_SAVE=""
## Type: string
## Default: "--halt --wait"
#
# If neither MIGRATE nor SAVE were enabled or if they failed, you can
# try to shut down a domain by sending it a shutdown request. To do this,
# set this to "--halt --wait". Omit the "--wait" flag to avoid waiting
# for the domain to be really down. Leave empty to skip domain shutdown.
#
XENDOMAINS_SHUTDOWN="--halt --wait"
## Type: boolean
## Default: true
#
# This variable determines whether saved domains from XENDOMAINS_SAVE
# will be restored on system startup.
#
XENDOMAINS_RESTORE=false
## Type: string
## Default: /etc/xen/auto
#
# This variable sets the directory where domains configurations
# are stored that should be started on system startup automatically.
# Leave empty if you don't want to start domains automatically
# (or just don't place any xen domain config files in that dir).
# Note that the script tries to be clever if both RESTORE and AUTO are
# set: It will first restore saved domains and then only start domains
# in AUTO which are not running yet.
# Note that the name matching is somewhat fuzzy.
#
XENDOMAINS_AUTO=/etc/xen/auto
## Type: boolean
## Default: false
#
# If this variable is set to "true", only the domains started via config
# files in XENDOMAINS_AUTO will be treated according to XENDOMAINS_SYSRQ,
# XENDOMAINS_MIGRATE, XENDOMAINS_SAVE, XENDMAINS_SHUTDOWN; otherwise
# all running domains will be.
# Note that the name matching is somewhat fuzzy.
#
XENDOMAINS_AUTO_ONLY=false
## Type: integer
## Default: 300
#
# On xendomains stop, a number of xm commands (xm migrate, save, shutdown,
# shutdown --all) may be executed. In the worst case, these commands may
# stall forever, which will prevent a successful shutdown of the machine.
# If this variable is non-zero, the script will set up a watchdog timer
# for every of these xm commands and time it out after the number of seconds
# specified by this variable.
# Note that SHUTDOWN_ALL will not be called if no virtual machines or only
# zombies are still running, so you don't need to enable this timeout just
# for the zombie case.
# The setting should be large enough to make sure that migrate/save/shutdown
# can succeed. If you do live migrations, keep in mind that live migration
# of a 1GB machine over Gigabit ethernet may actually take something like
# 100s (assuming that live migration uses 10% of the network # bandwidth).
# Depending on the virtual machine, a shutdown may also require a significant
# amount of time. So better setup this variable to a huge number and hope the
# watchdog never fires.
#
XENDOMAINS_STOP_MAXWAIT=300
bueno aca si tenes un puente de red
Spoiler:
en /etc/xen/xend-config.sxp
Selecionar la red con esto, comentar la que corresponde y agregar esta o modificar la activa
"(network-script network-bridge-wrapper)"
crear
/etc/xen/scripts/network-bridge-wrapper
Código:
#(!)/bin/bash
# next two lines were good for xen-3.2.1 not for xen-4.0x anymore
#/etc/xen/scripts/network-bridge netdev=eth0 bridge=xenbr0 start
#/etc/xen/scripts/network-bridge netdev=eth1 bridge=xenbr1 start
# this works for xen-4.0x
# xen-utils-common in squeeze don't produce this script (yet) which is needed
if [ ! -f ../scripts/hotplugpath.sh ];then
echo -e "SBINDIR=\"/usr/sbin\"
BINDIR=\"/usr/bin\"
LIBEXEC=\"/usr/lib/xen/bin\"
LIBDIR=\"/usr/lib\"
SHAREDIR=\"/usr/share\"
PRIVATE_BINDIR=\"/usr/lib/xen/bin\"
XENFIRMWAREDIR=\"/usr/lib/xen/boot\"
XEN_CONFIG_DIR=\"/etc/xen\"
XEN_SCRIPT_DIR=\"/etc/xen/scripts\"" > /etc/xen/scripts/hotplugpath.sh
chown root:root /etc/xen/scripts/hotplugpath.sh
chmod 755 /etc/xen/scripts/hotplugpath.sh
fi
/etc/xen/scripts/network-bridge netdev=eth0 start
# if you want to bind a NIC in domU to another interface in dom0 (bridging mode) than:
# 1.) list all dom0 interfaces you want to be able to use (except your eth0!) in "more_bridges" below
# 2.) in the domU config use: vif = [ 'mac=00:16:3e:xx:xx:xx, bridge=ethX' ] with ethX being the original device of dom0 that this domU should use
# 3.) using bridging, all interfaces in dom0 that you want to use have to be valid configured BEFORE you run this script, i.e. before starting xend the first time.
# (use ping -I ethX <target your gateway> to CHECK THAT BEFORE, and don't blame me if u plugged the cable into the wrong nic port ;-)
# 4.) remember, in the background xen does move the link to another name, creates a new interface etc etc... we don't care about this here, it just works fine for now
# here I want to prepare to other nics that I can choose from in the domU configs
more_bridges="eth1 eth2"
for i in $more_bridges; do
ip addr show dev $i | egrep inet > /dev/null 2>&1
if [ $? == 0 ];then
ip link set $i down
/etc/xen/scripts/network-bridge netdev=$i start
ip link set $i up
else
echo -e "\nFailed to set up a bridge!\nYour device $i in dom0 seems not to be configured, so I won't try to use it as part of a bridge for any domU\n"
fi
done
parece un chiste pero con eso levanto mi red
los ejecutables de xen quedan aquí
Código:
chmod +x /etc/xen/scripts/*
y es recommendable darles permiso de ejecucion (necesario)
Bueno despues de esto
Código:
Update-grub
Código:
Reboot
Y al inicio tendriamos que ver algo como esto
Nos logueamos y
Código:
root@debian:~# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 221 1 r----- 18.1
Ya esta digamos tenemos corriendo el xen
Opcional instalar vnc-server (para ver remotamente)
a esto
unset SESSION_MANAGER
exec sh /etc/X11/xinit/xinitrc
#x-window-manager &
el del medio se lo descomenta y se agrega sh.
Le damos permisos
Código:
chmod 755 /root/.vnc/xstartup
Create a Security Policy (if it doesn’t exist) file.
Si venimos desde el comienzo las
Option 1:
no tenemos las politicas de seguridad as ique las copiamos y guardamos
Código:
mkdir /etc/X11/xserver
Código:
nano /etc/X11/xserver/SecurityPolicy
Copiar y pegar, no modificar
Código:
version-1
# $Xorg: SecurityPolicy,v 1.3 2000/08/17 19:47:56 cpqbld Exp $
# The site policy fields are interpreted by the XC-QUERY-SECURITY-1
# authorization protocol. The values are arbitrary and site-specific.
# Refer to the Security Extension Specification for the usage of the policies.
#sitepolicy A
#sitepolicy B
#sitepolicy C
# Property access rules:
# property <property> <window> <permissions>
# <window> ::= any | root | <propertyselector>
# <propertyselector> ::= <property> | <property>=<value>
# <permissions> :== [ <operation> | <action> | <space> ]*
# <operation> :== r | w | d
# r read
# w write
# d delete
# <action> :== a | i | e
# a allow
# i ignore
# e error
# Allow reading of application resources, but not writing.
property RESOURCE_MANAGER root ar iw
property SCREEN_RESOURCES root ar iw
# Ignore attempts to use cut buffers. Giving errors causes apps to crash,
# and allowing access may give away too much information.
property CUT_BUFFER0 root irw
property CUT_BUFFER1 root irw
property CUT_BUFFER2 root irw
property CUT_BUFFER3 root irw
property CUT_BUFFER4 root irw
property CUT_BUFFER5 root irw
property CUT_BUFFER6 root irw
property CUT_BUFFER7 root irw
# If you are using Motif, you probably want these.
property _MOTIF_DEFAULT_BINDINGS root ar iw
property _MOTIF_DRAG_WINDOW root ar iw
property _MOTIF_DRAG_TARGETS any ar iw
property _MOTIF_DRAG_ATOMS any ar iw
property _MOTIF_DRAG_ATOM_PAIRS any ar iw
# If you are running CDE you also need these
property _MOTIF_WM_INFO root arw
property TT_SESSION root irw
property WM_ICON_SIZE root irw
property "SDT Pixel Set" any irw
# The next two rules let xwininfo -tree work when untrusted.
property WM_NAME any ar
# Allow read of WM_CLASS, but only for windows with WM_NAME.
# This might be more restrictive than necessary, but demonstrates
# the <required property> facility, and is also an attempt to
# say "top level windows only."
property WM_CLASS WM_NAME ar
# These next three let xlsclients work untrusted. Think carefully
# before including these; giving away the client machine name and command
# may be exposing too much.
property WM_STATE WM_NAME ar
property WM_CLIENT_MACHINE WM_NAME ar
property WM_COMMAND WM_NAME ar
# To let untrusted clients use the standard colormaps created by
# xstdcmap, include these lines.
property RGB_DEFAULT_MAP root ar
property RGB_BEST_MAP root ar
property RGB_RED_MAP root ar
property RGB_GREEN_MAP root ar
property RGB_BLUE_MAP root ar
property RGB_GRAY_MAP root ar
# To let untrusted clients use the color management database created
# by xcmsdb, include these lines.
property XDCCC_LINEAR_RGB_CORRECTION root ar
property XDCCC_LINEAR_RGB_MATRICES root ar
property XDCCC_GRAY_SCREENWHITEPOINT root ar
property XDCCC_GRAY_CORRECTION root ar
# To let untrusted clients use the overlay visuals that many vendors
# support, include this line.
property SERVER_OVERLAY_VISUALS root ar
Viene desde: /etc/X11/xserver/SecurityPolicy
Option 2:
Código:
apt-get install xserver-xorg
Despues de la operacion, 24.7MB de mas
Iniciar automaticamente VNC en el arranque
Para que se auto inicie, se debe crear una rutina, que lo haga, idem al anteriro, crear y pegar, y si modificas, cosas logicas, los nombres o los mensajes, pero no le funcionamiento
Asi conseguimos el arranque, pero faltan los permisos
Código:
chmod 755 /etc/init.d/startvnc
Código:
update-rc.d startvnc defaults
se muestra un error que dice
missing LSB tags and overrides
pero es normal por ausencia de las cabeceras
para remover ejecutar
Código:
update-rc.d -f startvnc remove
Esto del original
Código:
The reason I set the VNC default port to 5 on root localhost, is my preference and is part of this turorial I would leave it to 5. If you want, you can set to whatever you like.
reboot
View the ports, upon reboot.
Your looking for 5905.
Código:
netstat -tap
Código:
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 *:x11-5 *:* LISTEN 1180/Xvnc4
tcp 0 0 *:ssh *:* LISTEN 1151/sshd
tcp 0 52 10.1.11.102:ssh 10.1.10.191:6267 ESTABLISHED 1251/1
tcp6 0 0 [::]:5905 [::]:* LISTEN 1180/Xvnc4
tcp6 0 0 [::]:ssh [::]:* LISTEN 1151/sshd
Provar VNC
con cualquier cliente vnc en otro equipo apuntar ala ip del equipo al puerto 5 y veremos una terminal
ejemplo
Código:
192.168.0.47:5905 or 192.168.0.47:5
Si estamos en el cliente local
Código:
localhost:5 or x01:5 or 127.0.0.1:5
Si el cliente es un equipo linux:
Código:
vncviewer 10.1.11.11:5
• Crear vms
Definir el directorio donde se van a crear las vms en algún lugar
En mi caso lo creo en /home/alambre/xen/domains
Dentro de eso seria el nombre de la vm como carpeta, por ejemplo debían
Quedaría /home/alambre/xen/domains/debían
Podemos ser ordenados y crear carpetas para cada sistema operativo, asi como para los discos de instalación, si lo lleva,
Si lo hacemos manual
Primero creamos un disco
Se puede hacer de dos modos usar el asistente, o crearlas manualmente,
En ambos casos o montamos una unidad lvm o creamos un disco
Para crear el disco, nos vamos al directorio donde pondremos las maquinas virtuales y ejecutamos
qemu-img create <nombre de la imagen > <tamaño en mb>
por ejemplo
Código:
qemu-img create debi.img 8000M
o
por lvm
Se entiende que creamos la partición y no la estamos usando, de ese modo se puede montar y la montamos dentro del directorio de la imagen que creamos
Seria
Código:
fdisk –l
vemos el disco , en particular la unidad seria como /dev/sdax o /dev/sdbx es la de lvm (que no usamos)
creamos un volumen de grupo VG con nombre vol_grp1
Código:
pvcreate vol_grp1 /dev/sda3
Ahora se puede crear un volume logico puede tener el tamaño de llvm o ser menor, pero no mas grande, asi que cuando particionamos el disco definimos un tamaño, ahora como maximo usamos ese
El argumento es lvcreate –L <tamaño> -n <nombrevolumen logico> <nombre volumen de grupo>
Código:
lvcreate -L 4gb -n midebian vol_grp1
ahora le asignamos un tipo (formato) de archivos al volumen que creamos
Código:
mkfs –t ext4 /dev/vol_grup1/midebian
revisamos si se creo corectamente
Código:
lvdisplay
*crear la maquina virtual
El directorio por defecto para las configuraciones de las maquinas virtuales es /etc/xen/
Por lo que seria bueno que las creemos aquí, pero también se la puede poner en otro lugar y crear un enlace aquí,
este asi como esta me anda(funciona para win o linux)
analizando lo anterior
memoria en megabytes
memory = '256'
disk
la etiqueta podemos dividirla en 2 partes,
primero
'file:/home/alambre/xen/debian/debi.img,ioemu:hda,w'
Esta diciendo que el disco (rigido) es una imagen de archivo
Podría ser un dispositivo como el lvm o un disco directamente
'phy: /dev/vol_grup1/midebian,ioemu:hda,w'
La segunda parte seria lo mismo podemos hacerlo un archive con file o un dispositivo con phy
'file:/mnt/WindowsD/debian.iso,ioemu:hdc:cdrom,r'
Las opciones de vnc
Vnc=1 permite conectar por vnc,
vncdisplay=8 seria el Puerto mi ip:8 o miip:5908 son lo mismo
usb=1 permite dispositivos usb
si el dispositivo permite virtualizacion completa (que no es mi caso) con gfx_passthru=1 podemos pegar(entre comillas) el sistema a los dispositivos como una placa aceleradora, en el caso de querer correr win7 por ejemplo
xen-create-image --hostname <nombrehost(equipo a crear)> --ip <numeroip> --scsi --vcpus <numero de cpus> --pygrub --dist <lenny/etc si le dan man al xen-create-image te tira un monton > --dir <direccion en el disco>
WARNING: No gateway address specified!
WARNING: No netmask address specified!
General Information
--------------------
Hostname : debai
Distribution : lenny
Mirror : http://ftp.ccc.uba.ar/pub/linux/debian/debian/
Partitions : swap 128Mb (swap)
/ 4Gb (ext3)
Image type : sparse
Memory size : 128Mb
Kernel path : /boot/vmlinuz-2.6.32-5-xen-amd64
Initrd path : /boot/initrd.img-2.6.32-5-xen-amd64
Networking Information
----------------------
IP Address 1 : 192.168.0.46 [MAC: 00:16:3E:49:E5:05]
Creating partition image: /home/alambre/xen/domains/debai/swap.img
Done
Creating swap on /home/alambre/xen/domains/debai/swap.img
Done
Creating partition image: /home/alambre/xen/domains/debai/disk.img
Done
Creating ext3 filesystem on /home/alambre/xen/domains/debai/disk.img
Done
Installation method: debootstrap
Done
Running hooks
Done
No role scripts were specified. Skipping
Creating Xen configuration file
Done
Setting up root password
Generating a password for the new guest.
All done
Logfile produced at:
/var/log/xen-tools/debai.log
Installation Summary
---------------------
Hostname : debai
Distribution : lenny
IP-Address(es) : 192.168.0.46
RSA Fingerprint : c7:19:f1:68:b7:e9:90:33:7a:bd:2f:7f:52:d7:a0:fb
Root Password : xHgub3dY
root@Debian-6:/etc/xen#
bueno hasta aca estamos
para que una maquina inicie con el sistema toca crear la carpeta
/etc/xen/auto
y hacer un link o copiar la configuracion de la maquina dentro ejemplo debi.cfg
comandos utiles
a las maquinas se las puede llamar de dos maneras, con el nombre que le designamos en el archivo de configuracion o por la ruta y nombre