[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anteriorRevisión previa
Próxima revisión
Revisión previa
es:howtos:general_admin:kvm_libvirt [2019/02/09 00:15 (UTC)] – [Creando una nueva máquina virtual usando virt-manager] slackwarespanoles:howtos:general_admin:kvm_libvirt [2019/02/09 00:56 (UTC)] (actual) slackwarespanol
Línea 1: Línea 1:
-<note warning>En proceso de traducción. Víctor</note> 
 ====== KVM y libvirt ====== ====== KVM y libvirt ======
  
Línea 105: Línea 104:
 Ingrese el nombre del nuevo grupo. El tipo predeterminado es // dir //, que es el tipo correcto. Presione <key> Forward </key> e ingrese el directorio del sistema en el campo de entrada // Target Path //. Presione <key> Finalizar </key> para crear el grupo. Ingrese el nombre del nuevo grupo. El tipo predeterminado es // dir //, que es el tipo correcto. Presione <key> Forward </key> e ingrese el directorio del sistema en el campo de entrada // Target Path //. Presione <key> Finalizar </key> para crear el grupo.
    
-===== Creating a new virtual machine =====+
  
 ==== Creando una nueva máquina virtual usando virt-manager ==== ==== Creando una nueva máquina virtual usando virt-manager ====
Línea 118: Línea 117:
 Paso 2: Dependiendo del método de instalación, se le pedirá que ingrese más detalles, como el nombre de la imagen de DVD iso utilizada. Paso 2: Dependiendo del método de instalación, se le pedirá que ingrese más detalles, como el nombre de la imagen de DVD iso utilizada.
  
-También elige el tipo de sistema operativo y la versión. Al elegir // Linux //, elija // Mostrar todas las opciones de SO // en el indicador de Versión para obtener más opciones. Al elegir // kernel // genérico 2.6.x //, el asistente asumirá un disco duro tipo IDE. Puedes cambiar esto en el paso 5. +También elige el tipo de sistema operativo y la versión. Al elegir // Linux //, elija // Mostrar todas las opciones de SO // en el indicador de Versión para obtener más opciones. Al elegir // kernel  genérico 2.6.x //, el asistente asumirá un disco duro tipo IDE. Puedes cambiar esto en el paso 5.
  
 +<note warning> Si elige //kernel genérico 2.6.25 o posterior con virtio//, la nueva máquina utilizará el controlador del kernel de virtio para emular un controlador de disco duro. La imagen de instalación de Slackware se iniciará, pero debe crear un initrd con los controladores del kernel de Virtio incluidos, de lo contrario su nueva máquina no arrancará. </note>
  
 Paso 3: Seleccione la cantidad de RAM y CPUs. Paso 3: Seleccione la cantidad de RAM y CPUs.
Línea 147: Línea 146:
  
  
-===== Networking ===== +===== Redes ===== 
-virtual machine can be set up in one of two waysconnected to a virtual network or connected to shared physical device (bridged). +Una máquina virtual se puede configurar de dos manerasconectada una red virtual o conectada un dispositivo físico compartido (puente)
 +==== Redes virtuales ==== 
 +Las redes virtuales son implementadas por libvirt en forma de conmutadores virtuales. Una máquina virtual tendrá su tarjeta de red conectada a este conmutador virtual. El conmutador virtual aparece en el host como una interfaz de red.
  
-==== Virtual networks ==== +La red virtual puede operar en 3 configuraciones diferentes: 
-Virtual networks are implemented by libvirt in the form of virtual switchesvirtual machine will have it's network card plugged into this virtual switch. The virtual switch appears on the host as a network interface+   - NAT: el conmutador virtual está conectado a la LAN del host en modo NAT. El host puede conectarse a las máquinas virtuales, pero otras máquinas en la red del host no pueden conectarse. Esta es la configuración por defecto. 
 +   - Enrutado: el conmutador virtual está conectado a la LAN del host sin NAT. 
 +   - Aislado: el conmutador virtual no está conectado al host. Las máquinas virtuales pueden verse entre sí y al host, pero el tráfico de la red no pasa fuera del host. 
 +=== Dnsmasq y iptables === 
 +DHCP y DNS en las redes virtuales son manejados por DnsmasqPara cada red virtual que se inicia, libvirt inicia una instancia separada de Dnsmasq.
  
-The virtual network can operate in 3 different configurations:  +Al iniciar una red virtual, libvirt también agregará reglas de iptables para manejar el enrutamiento y NAT entre el host y la red virtual. También habilitará ip_forward. 
-  - NAT: the virtual switch is connected to the host LAN in NAT modeThe host can connect to the VM's but other machines on the host network cannotThis is the default configuration. +=== Red por defecto === 
-  - Routed: the virtual switch is connected to the host LAN without NAT.   +Después de la instalación, una red (apropiadamente llamada // por defecto //) ya está creadaSe configura como tipo NAT y esta es la red predeterminada que está vinculada a nuevas máquinas virtualesLa red está configurada para iniciarse automáticamente cuando se inicia libvirtpor lo que está disponible inmediatamente cuando se ejecuta libvirt.
-  - Isolated: the virtual switch is not connected to the host. Virtual machines can see each other and the hostbut network traffic does not pass outside the host+
  
-==== Dnsmasq and iptables ==== +La red es visible en el host como bridge virbr0. 
-DHCP and DNS on the virtual networks is handled by DnsmasqFor every virtual network that is started, separate instance of Dnsmasq is started by libvirt. +<note warning>No agregue interfaces físicas este bridge. Es manejado por libvirt.</note>
  
-When starting a virtual network, libvirt will also add iptables rules to handle routing and NAT between the host and the virtual networkIt will also enable ip_forward+=== Creación y mantenimiento === 
 +Las redes virtuales están visibles en la pestaña // Redes virtuales // de la ventana // Detalles de conexión del host // en Virtual Machine Manager. La tecla <key> + </key> se puede usar para agregar una nueva red virtual. Ingrese el nombre, la dirección de red IPv4, el rango DHCP y el tipo de red.
  
-==== Default network ==== +Una vez que se crea la red virtual, se puede utilizar en las pantallas de mantenimiento de la máquina virtual.
-After installation, one network (appropriately called //default//) is already created. It is configured as type NAT and this is the default network that is linked to new virtual machines. The network is setup to start automatically when libvirt is startedso it is immediately available when libvirt is running+
  
-The network is visible on the host as bridge virbr0.  +=== Carpetas compartidas usando VirtFS === 
-<note warning>Do not add physical interfaces to this bridge. It is handled by libvirt.</note> +Es posible compartir carpetas entre el sistema huésped y el host mediante VirtFS (carpeta de Plan 9 compartidas sobre Virtio). Esto está disponible desde la versión 2.6.36 del kernel en adelante. VirtFS es un sistema de archivos de acceso directolo que significa que se puede acceder directamente un directorio en el host desde el invitado a través de la capa de virtualización
- +=== Preparar kernel host === 
-==== Creation and maintenance ==== +Asegúrese de que las siguientes opciones estén configuradas en el núcleo del host:
-Virtual networks are visible on the //Virtual Networks// tab of the //Host Connection Details// window in Virtual Machine Manager. The <key>+</key> key can be used to add a new virtual network. Enter the name, IPv4 network address, DHCP range and the type of network.  +
- +
-Once the virtual network is created, it can be used in the virtual machine maintenance screens.  +
- +
-===== Shared folders using VirtFS ===== +
-It is possible to share folders between the guest and host system using VirtFS (Plan 9 folder sharing over Virtio). This is available from kernel version 2.6.36 onwards. VirtFS is a passthrough filesystemwhich means that directory on the host can be directly accessed from the guest through the virtualization layer +
- +
-==== Prepare host kernel ==== +
-Make sure the following options are set in the host kernel:+
 <code> <code>
 CONFIG_NET_9P=y CONFIG_NET_9P=y
Línea 186: Línea 181:
 CONFIG_9P_FS_POSIX_ACL=y CONFIG_9P_FS_POSIX_ACL=y
 </code> </code>
-On the guest systemmodules ''9p'', ''9pnet'' and ''9pnet_virtio'' are neededThese should be available in the standard Slackware kernel.+En el sistema invitadose necesitan los módulos '' 9p '', '' 9pnet '' '' 9pnet_virtio ''Estos deberían estar disponibles en el kernel estándar de Slackware.
  
-==== Guest configuration ==== +=== Configuración de invitado === 
-In virt-manager, edit the guest virtual machine and add new hardware. Select //Filesystem// and fill the required fields as shown below+En virt-manager, edite la máquina virtual invitada y agregue nuevo hardware. Seleccione // Sistema de archivos // y complete los campos requeridos como se muestra a continuación.
  
 {{:howtos:general_admin:virt-manager-fspassthr.png?200|}} {{:howtos:general_admin:virt-manager-fspassthr.png?200|}}
 +* Modo. Selecciona uno de los siguientes:
 +  * Passthrough: se accede al recurso compartido de host con los permisos del usuario invitado.
 +     * Asignado: se accede al recurso compartido de host con los permisos del hipervisor (proceso QEMU).
 +     * Squash: similar a // passthrough // excepto que se ignoran las fallas de operaciones privilegiadas como // chown //. Esto hace que se pueda utilizar un modo similar al paso a través de personas que ejecutan el hipervisor como no root.
 +   * Controlador: use // Ruta //.
 +   * Política de escritura (solo disponible para el controlador '' ruta ''): use // Predeterminado //.
 +   * Ruta de origen = directorio en el host que se comparte.
 +   * Ruta de destino = etiqueta de montaje que está disponible en el sistema huésped. Esto no tiene que ser una ruta existente.
 +La opción // Exportar sistema de archivos como montaje de solo lectura // hace lo que sugiere.
  
-  * Mode. Select one of the following: +=== Mounting the share === 
-    * Passthrough: the host share is accessed with the permissions of the guest user. +Para montar el sistema de archivos con la etiqueta '' hostshare '' en el invitado en '' / mnt / share '', inicie sesión en el invitado y use:
-    * Mapped: the host share is accessed with the permissions of the hypervisor (QEMU process).  +
-    * Squash: Similar to //passthrough// except that failure of privileged operations like //chown// are ignored. This makes a passthrough-like mode usable for people who run the hypervisor as non-root. +
-  * Driver: use //Path//. +
-  * Write Policy (only available for ''path'' driver): use //Default//+
-  * Source path = directory on the host which is shared. +
-  * Target path = mount tag that is made available on the guest system. This doesn't have to be an existing path. +
-Option //Export filesystem as readonly mount// does what it suggests.  +
- +
-==== Mounting the share ==== +
-To mount the filesystem with tag ''hostshare'' on the guest at ''/mnt/share'', logon to the guest and use: +
 <code> <code>
 # mount -t 9p -o trans=virtio,version=9p2000.L hostshare /mnt/share # mount -t 9p -o trans=virtio,version=9p2000.L hostshare /mnt/share
 </code> </code>
-Now the /mnt/share folder is available and changes are visible on the host and the guestWhen permission errors occurtry sharing the host directory with a different mode.  +Ahora la carpeta /mnt/share está disponible y los cambios son visibles en el host y el invitadoCuando se produzcan errores de permisointente compartir el directorio del host con un modo diferente
-===== Remote access =====+==== Acceso remoto ====
  
-<note>Work in progress</note>+<note>Nota del Autor. Trabajo en progreso</note>
  
-===== Advanced topics ===== +===== Temas avanzados =====
  
-==== Mount qcow image using nbd ==== +==== Monte la imagen qcow usando nbd ==== 
-Raw disk images can be mounted outside the virtual machine using a loopback deviceTo mount other image types like qcow, the ''qemu-nbd'' command can be usedwhich comes with qemu-kvm. It relies on the nbd (network block devicekernel module+Las imágenes de disco sin procesar se pueden montar fuera de la máquina virtual mediante un dispositivo de bucle invertidoPara montar otros tipos de imágenes como qcow, se puede usar el comando '' qemu-nbd '', que viene con qemu-kvm. Se basa en el módulo del núcleo nbd (dispositivo de bloqueo de red).
  
-Start by loading the kernel moduleThe only parameter is the maximum partitions to be accessedIf this parameter is omittedthe default value is 0, which means no partitions will be mapped+Comience cargando el módulo del kernel. El único parámetro es el número máximo de particiones a las que se puede accederSi se omite este parámetroel valor predeterminado es 0, lo que significa que no se asignarán particiones.
 <code> <code>
 # modprobe nbd max_part=8 # modprobe nbd max_part=8
 </code> </code>
-This will create various new devices ''/dev/nbdxx''Now the disk image can be connected to one of them +Esto creará varios dispositivos nuevos '' /dev/nbdxx ''Ahora la imagen del disco se puede conectar a uno de ellos:
 <code> <code>
 # qemu-nbd -c /dev/ndb0 slackware.img # qemu-nbd -c /dev/ndb0 slackware.img
 </code> </code>
-This will create additional devices ''/dev/nbd0pxx'' for the partitions on the diskPartitions are numbered sequentially starting with 1. You can use the nbd0 device to access the whole diskor the nbd0pxx devices to access the partitions  +Esto creará dispositivos adicionales '' /dev/nbd0pxx '' para las particiones en el discoLas particiones se numeran secuencialmente comenzando con 1. Puede usar el dispositivo nbd0 para acceder a todo el discoo los dispositivos nbd0pxx para acceder a las particiones:
 <code> <code>
 # fdisk /dev/nbd0 # fdisk /dev/nbd0
 # mount /dev/nbd0p1 /mnt/hd # mount /dev/nbd0p1 /mnt/hd
 </code> </code>
-<note important>Make sure the virtual machine is not running when you mount the disk imageMounting the disk of a running machine will damage it.</note> +<note important>Asegúrese de que la máquina virtual no se esté ejecutando cuando monte la imagen de discoMontar el disco de una máquina en marcha lo dañará.</note> 
-To remove the connection +Para eliminar la conexión:
 <code> <code>
 # qemu-nbd -d /dev/nbd0 # qemu-nbd -d /dev/nbd0
 </code> </code>
  
-==== Setup PXE boot in libvirt ==== +==== Configurar el arranque PXE en libvirt ==== 
-To enable PXE booting for the guest machinesPXE boot server and a TFTP server are needed. Libvirt can be configured to handle both internallyThese configuration options are not available in virt-manager, so virsh must be used to set this up+Para habilitar el arranque PXE para las máquinas invitadasse necesitan un servidor de arranque PXE y un servidor TFTP. Libvirt se puede configurar para manejar tanto internamenteEstas opciones de configuración no están disponibles en virt-manager, por lo que se debe usar virsh para configurar esto.
  
-  Create a directory ''/tftpboot'' and fill with the required files for the tftp boot serviceSee the article [[http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:pxe|PXE: Installing Slackware over the network]] by AlienBOB for more details.  +   Cree un directorio '' /tftpboot '' y rellénelo con los archivos necesarios para el servicio de arranque tftp. Consulte el artículo [[http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:pxe|PXE: Instalación de Slackware en la red]] por AlienBOB para obtener más detalles
-  Stop the default network and edit the network definition: <code>+   Detenga la red predeterminada y edite la definición de red: <code>
 # virsh net-destroy default # virsh net-destroy default
 # virsh net-edit default # virsh net-edit default
 </code> </code>
-  - This will open the network configuration in a vi sessionAdd the //tftp// and //bootp// parameters in the //ip// section and save the file: <code>+  - Esto abrirá la configuración de red en una sesión vi. Agregue los parámetros // tftp // // bootp // en la sección // ip // y guarde el archivo: <code>
   <ip address='192.168.122.1' netmask='255.255.255.0'>   <ip address='192.168.122.1' netmask='255.255.255.0'>
     <tftp root='/tftpboot' />     <tftp root='/tftpboot' />
Línea 254: Línea 248:
   </ip>   </ip>
 </code>  </code> 
-  - Now restart the network: <code>+  - Ahora reinicie la red: <code>
 # virsh net-start default # virsh net-start default
 </code> </code>
- +Ahora el servidor DHCP libvirt permitirá a los invitados arrancar con PXE.
-Now the libvirt DHCP server will allow guests to PXE boot.+
 ===== Troubleshooting ===== ===== Troubleshooting =====
  
-==== Remove password prompt in virt-manager ==== +==== Eliminar solicitud de contraseña en virt-manager ==== 
-When you start virt-manager as a regular useryou may still be asked for the root passwordeven when you have setup the correct unix socket permissions (notification: "system policy prevents management of local virtualized systems"). This is because older versions of libvirt were using PolicyKit by defaultDisable the use of PolicyKit by editing ''/etc/libvirt/libvirtd.conf''Uncomment the following options and change them to ''none'' :+Cuando inicie virt-manager como un usuario regular, es posible que se le solicite la contraseña de root, incluso cuando haya configurado los permisos de socket de Unix correctos (notificación: "la política del sistema impide la administración de sistemas virtualizados locales"). Esto se debe a que las versiones anteriores de libvirt usaban PolicyKit de forma predeterminadaDesactive el uso de PolicyKit editando '' /etc/libvirt/libvirtd.conf ''Descomente las siguientes opciones y cámbielas a '' ninguna '':
 <code> <code>
 auth_unix_ro = "none" auth_unix_ro = "none"
 auth_unix_rw = "none" auth_unix_rw = "none"
 </code> </code>
-==== Improve mouse movement ==== +==== Mejorar el movimiento del ratón ==== 
-In graphics modethe mouse movement can be erratic and difficult to change in the settings of your VM. To solve thisadd a virtual tablet.  +En el modo gráficoel movimiento del mouse puede ser errático y difícil de cambiar en la configuración de su VM. Para resolver estoagregue una tableta virtual.
- +
-In //virt-manager//, open the VM by double-clicking on the machine and select the hardware info screen (the blue <key>''i''</key> button). Now, press <key>+ Add Hardware</key> and select //Input//. Select Type //EvTouch USB Graphics Tablet// and press <key>Finish</key>. The next time the VM is started, the mouse movement is synchronized with your desktop cursor+
  
-==== Change screen resolution to higher than 1024x768 ==== +En // virt-manager //, abra la máquina virtual haciendo doble clic en la máquina y seleccione la pantalla de información del hardware (el botón azul <key> '' i '' </key>). Ahora, presione <key> + Add Hardware </key> y seleccione // Input //. Seleccione Type // EvTouch USB Graphics Tablet // y presione <key> Finish </key>. La próxima vez que se inicie la máquina virtual, el movimiento del mouse se sincronizará con el cursor del escritorio. 
-The default emulated video card is of type Cirrus. This has a maximum resolution of 1024x768. The //vga// type can achieve a higher resolutionbut for that to workthe configuration in the guest OS needs to be changed as well.+==== Cambiar la resolución de la pantalla a más de 1024x768 ==== 
 +La tarjeta de video emulada predeterminada es de tipo Cirrus. Esto tiene una resolución máxima de 1024x768. El tipo // vga // puede lograr una resolución más altapero para que funcionela configuración de en el sistema operativo invitado también debe cambiarse.
  
-To change thisopen the VM and select the hardware info screenSelect the Video card and change the type to //vga//.+Para cambiar estoabra la máquina virtual y seleccione la pantalla de información de hardware. Seleccione la tarjeta de video y cambie el tipo a // vga //.
  
-Start the VMIf a file ''/etc/X11/xorg.conf'' existschange thatOtherwise create a new text file in ''/etc/X11/xorg.conf.d'' with extension ''conf'', for example ''/etc/X11/xorg.conf.d/monitor.conf''.+Iniciar la máquina virtualSi existe un archivo '' /etc/X11/xorg.conf '', cámbieloDe lo contrario, cree un nuevo archivo de texto en '' /etc/X11/xorg.conf.d '' con la extensión '' conf '', por ejemplo '' /etc/X11/xorg.conf.d/monitor.conf ''.
  
-Add or change the following sections+Agrega o cambia las siguientes secciones:
 <code> <code>
 Section "Monitor" Section "Monitor"
Línea 302: Línea 294:
 EndSection EndSection
 </code> </code>
-You can change the screen resolution (the //Modes// linedepending on your needs+Puede cambiar la resolución de la pantalla (la línea // Modes //) según sus necesidades.
  
-===== Resources =====+===== Recursos =====
  
-  Official pages for [[http://libvirt.org|libvirt]], [[http://virt-manager.org|virt-manager]], [[http://wiki.qemu.org/Index.html|QEMU]], [[http://www.linux-kvm.org/page/Main_Page|KVM]]. +   Páginas oficiales de [[http://libvirt.org|libvirt]], [[http://virt-manager.org|virt-manager]], [[http://wiki.qemu.org/Index.html|QEMU]], [[http://www.linux-kvm.org/page/Main_Page|KVM]]. 
-  * Red Hat [[https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Administration_Guide/index.html|Virtualization Administration Guide]].+  * Red Hat [[https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Administration_Guide/index.html|Guía de administración de virtualización]].
  
 ===== Sources ===== ===== Sources =====
Línea 315: Línea 307:
 <!-- * Originally written by [[wiki:user:xxx | User X]] --> <!-- * Originally written by [[wiki:user:xxx | User X]] -->
 <!-- * Contributions by [[wiki:user:yyy | User Y]] --> <!-- * Contributions by [[wiki:user:yyy | User Y]] -->
-  * This page originally written by [[wiki:user:fdonkers|Frank Donkers]]+  * Esta página escrita originalmente por [[wiki:user:fdonkers|Frank Donkers]] 
 +  * Traducido por:  [[wiki:user: slackwarespanol | Victor]] 2019/02/09 00:53 (UTC)
  
 <!-- Please do not modify anything below, except adding new tags.--> <!-- Please do not modify anything below, except adding new tags.-->
 <!-- You must remove the tag-word "template" below before saving your new page --> <!-- You must remove the tag-word "template" below before saving your new page -->
 {{tag>howtos kvm libvirt virtualization virt-manager qemu author_fdonkers}} {{tag>howtos kvm libvirt virtualization virt-manager qemu author_fdonkers}}
 es:howtos:general_admin:kvm_libvirt ()