chuleta_kvm
This is an old revision of the document!
Table of Contents
KVM
KVM con I/O iscsi paravirtualizado soporte trim optimizados ceros
qemu-system-x86_64 -enable-kvm -m 4000 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd -drive if=none,discard=on,detect-zeroes=on,file=debian.cow,id=hd
KVM con I/O paravirtualizado y escritorio remoto spice
kvm -m 512 -drive file=iso/linuxmint-14.1-mate-dvd-32bit.iso,if=virtio -net nic,model=virtio -net user -vga qxl -spice port=5900,addr=155.210.47.75,disable-ticketing
Screen + KVM
cd /mnt/datos/ && screen -S Nagios -d -m kvm -curses nagios.img -redir tcp:11022::22 -redir tcp:11080::80 cd /mnt/datos/ && screen -S XP -d -m kvm -m 350 -nographic -usbdevice tablet xp.img -redir tcp:3389::3389
montar imagenes raw vmdk qcow
modprobe nbd max_part=16 qemu-nbd -c /dev/nbd0 cosa.vmdk partprobe /dev/nbd0 mount /dev/nbd0p1 mnt
Si hay lvm
vgscan vgchange -a y
Ubuntu + KVM + VNC
- El arranque correcto con vnc requiere quitar de la linea boot la opción “splash”
Modos de red
User Networking
Cuando usar:
- Un modo simple para que la máquina virtual tenga acceso al host, a internet y a recursos de la red local
- No se va a necesitar acceder a la máquina virtual desde la red o desde otra máquina
- You are ready to take a huge performance hit.
- Warning: User networking does not support a number of networking features like ICMP. Certain applications (like ping) may not function properly.
Modo de uso
kvm -net nic -net user /path/to/hda.img
Private Virtual Bridge
Cuando usar:
- Se quiere crear una red virtual entre dos máquinas virtuales
Public Bridge
Cuando usar:
- Se quiere asignar una IP a la máquina virtual y se quiere que sea accesible desde la red.
¿Ejemplo?
etfiat@debian-brutal:~$ cat puentes #puente y tap brctl addbr br0 ifconfig br0 192.168.0.1 up #apt-get install uml-utilities tunctl -b -u etfiat -t tap1 ifconfig tap1 #brctl addif br0 tap1 #nat #permitimos redirección echo 1 > /proc/sys/net/ipv4/ip_forward iptables -F iptables -t nat -F iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 155.210.47.75 #maquina virtual kvm -hda debian.img -m 256 -net nic,macaddr=52:54:00:12:34:50,vlan=0 -net tap,vlan=0,ifname=tap1 # -nographic #bajada de puente y tap brctl delif br0 tap1 ifconfig br0 down brctl delbr br0 tunctl -d tap1 etfiat@debian-brutal:~$ cat /etc/kvm/kvm-ifup #!/bin/sh switch=$(ip route ls | awk '/^default / { for(i=0;i<NF;i++) { if ($(i) == "dev") print $(i+1) }}') switch=br0 /sbin/ifconfig $1 0.0.0.0 up /usr/sbin/brctl addif ${switch} $1 exit 0
kvm -cdrom debian-8.3.0-amd64-netinst.iso -net bridge -net nic,model=virtio -drive file=/dev/sdh,format=raw -m 2048 kvm -cdrom debian.iso -net bridge -net nic,model=virtio -drive file=/dev/sdh,format=raw -m 2048 kvm -drive file=debian.img,if=virtio -drive file=debian.iso,if=virtio,media=cdrom kvm -drive file=debian-8.3.0-amd64-netinst.iso,media=cdrom -drive file=debian.img,if=virtio,format=raw -m 2048 -net bridge -net nic,model=virtio
chuleta_kvm.1519771805.txt.gz · Last modified: by etfiat
