VirtManager: Unterschied zwischen den Versionen

Aus Info-Theke
Zur Navigation springen Zur Suche springen
Zeile 89: Zeile 89:
       '<host mac="52:54:00:6f:78:f3" ip="10.10.10.101"/>' \
       '<host mac="52:54:00:6f:78:f3" ip="10.10.10.101"/>' \
       --live --config --parent-index 0
       --live --config --parent-index 0
</pre>
= Diverses =
== Spice-Zugriff auf VM ==
* virsh edit alfa
<pre>
<domain type='kvm'>
  <name>fedora25</name>
  <uuid>ae4e5582-492a-4292-8da2-48320a7816e6</uuid>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <graphics type='spice' port='5900' autoport='no' listen='0.0.0.0' passwd='password'>
    <listen type='address' address='0.0.0.0'/>
  </graphics>
  <sound model='ac97'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
  </sound>
  <video>
      <model type='qxl' ram='65536' vram='32768' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
</domain>
</pre>
</pre>

Version vom 12. Oktober 2019, 17:37 Uhr


Links

Links

Beschreibung

VirtManager ist eine Software, die die Verwaltung von virtuellen Maschinen (mittels KVM) mittels graphischer Oberfläche erlaubt.

Kommandos

# show the guests:
virsh list
# Start the VM:
virsh start alfa
# stop the VM alfa
virsh destroy alfa
# Autostart festlegen
virsh autostart alfa

virsh net-list

virt-install --name=alfa --vcpus=4 --memory=1024 --cdrom=/opt/iso/debian-10.1.0-amd64-netinst.iso --disk path=/media/vm-images/vm-alfa,size=20 --os-type=Linux --os-variant=debian8

Netzwerk aufbauen Host und VMs

Problem wird [hier beschrieben]

NETNAME=vmnet
cat <<EOS >/tmp/$NETNAME.xml
<network>
  <name>$NETNAME</name>
  <ip address='10.10.10.1' netmask='255.0.0.0'>
    <dhcp>
      <range start='10.10.10.20' end='10.10.10.99' />
    </dhcp>
  </ip>
</network>
EOS
virsh net-define /tmp/$NETNAME.xml
virsh net-autostart $NETNAME
virsh net-start $NETNAME
# Alle Netze auflisten:
virsh net-list
# alle Namen der laufenden virtuellen Maschinen auflisten:
virsh list
# für alle Gäste:
virsh edit $guestname
<interface type='network'>
  <source network='$NETNAME'/>
  <model type='virtio'/> <-- This line is optional.
</interface>

DHCP konfigurieren

virsh  net-list
virsh  net-edit  $NETWORK_NAME
* folgende Sequenz anpassen:
<dhcp>
  <range start='10.10.10.10' end='10.10.10.99'/>
  <host mac='52:54:00:6c:3c:01' name='vm100' ip='10.10.10.100'/>
  <host mac='52:54:00:6c:3c:02' name='vm101' ip='10.10.10.101'/>
</dhcp>
  • die Änderungen stehen dann in /etc/libvirt/qemu/networks/$NETWORK_NAME.xml (wird generiert)
# DHCP-Dienst informieren (Änderungen aktivieren):
killall -s SIGHUP dnsmasq
# Wenn das nicht reicht: Achtung: alle VMs in diesem Netz werden offline, evt. Neustart notwendig
virsh net-destroy $NETWORK_NAME
virsh net-start $NETWORK_NAME
  • im laufenden Betrieb hinzufügen,
# IP4: --parent-index 0
virsh net-update $NETWORK_NAME add-last ip-dhcp-host \
      '<host mac="52:54:00:6f:78:f3" ip="10.10.10.101"/>' \
      --live --config --parent-index 0

Diverses

Spice-Zugriff auf VM

  • virsh edit alfa
<domain type='kvm'>
  <name>fedora25</name>
  <uuid>ae4e5582-492a-4292-8da2-48320a7816e6</uuid>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <graphics type='spice' port='5900' autoport='no' listen='0.0.0.0' passwd='password'>
     <listen type='address' address='0.0.0.0'/>
   </graphics>
   <sound model='ac97'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
   </sound>
   <video>
      <model type='qxl' ram='65536' vram='32768' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
</domain>