Änderungen

keine Bearbeitungszusammenfassung
Zeile 554: Zeile 554:     
Quelle: [http://www.elektronik-kompendium.de/sites/net/1712061.htm www.elektronik-kompendium.de ]
 
Quelle: [http://www.elektronik-kompendium.de/sites/net/1712061.htm www.elektronik-kompendium.de ]
 +
 +
===Server===
 +
Modell: HP Proliant DL380 G5
 +
Betriebssystem: Ubuntu 14.04 LTS
 +
Virtualisierung: KVM/QEMU
 +
 +
====Netzwerk Config====
 +
<source lang='text'>
 +
auto lo
 +
iface lo inet loopback
 +
 +
# Freifunk Client
 +
auto br-ffwi
 +
iface br-ffwi inet static
 +
bridge_ports eth2
 +
bridge_stp no
 +
bridge_fd 0
 +
address 10.56.2.80
 +
netmask 255.255.192.0
 +
gateway 10.56.0.29
 +
dns-nameservers 10.56.0.29
 +
 +
iface br-ffwi inet6 auto
 +
 +
# Out-of-Band-Mgmt
 +
auto eth5
 +
iface eth5 inet static
 +
address 192.168.56.1
 +
netmask 255.255.255.0
 +
 +
auto eth0
 +
iface eth0 inet manual
 +
 +
auto eth1
 +
iface eth1 inet manual
 +
 +
auto eth3
 +
iface eth3 inet manual
 +
 +
auto eth4
 +
iface eth4 inet manual
 +
</source>
 +
 +
====Libvirt Domain Config====
 +
<source lang='xml'>
 +
<domain type='kvm' id='5'>
 +
  <name>Sim-Papagei</name>
 +
  <uuid>3cc0a834-3d84-4974-891e-8483c09afa35</uuid>
 +
  <memory unit='KiB'>1048576</memory>
 +
  <currentMemory unit='KiB'>1048576</currentMemory>
 +
  <vcpu placement='static'>1</vcpu>
 +
  <resource>
 +
    <partition>/machine</partition>
 +
  </resource>
 +
  <os>
 +
    <type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type>
 +
    <boot dev='hd'/>
 +
  </os>
 +
  <features>
 +
    <acpi/>
 +
    <apic/>
 +
  </features>
 +
  <cpu mode='host-model'>
 +
    <model fallback='allow'/>
 +
  </cpu>
 +
  <clock offset='utc'>
 +
    <timer name='rtc' tickpolicy='catchup'/>
 +
    <timer name='pit' tickpolicy='delay'/>
 +
    <timer name='hpet' present='no'/>
 +
  </clock>
 +
  <on_poweroff>destroy</on_poweroff>
 +
  <on_reboot>restart</on_reboot>
 +
  <on_crash>restart</on_crash>
 +
  <pm>
 +
    <suspend-to-mem enabled='no'/>
 +
    <suspend-to-disk enabled='no'/>
 +
  </pm>
 +
  <devices>
 +
    <emulator>/usr/bin/kvm-spice</emulator>
 +
    <disk type='file' device='disk'>
 +
      <driver name='qemu' type='raw'/>
 +
      <source file='/var/lib/libvirt/images/gluon-ffwi-0.3-beta-2016.02.08-x86-64.img'/>
 +
      <target dev='vdb' bus='virtio'/>
 +
      <alias name='virtio-disk1'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0f' function='0x0'/>
 +
    </disk>
 +
    <controller type='usb' index='0' model='ich9-ehci1'>
 +
      <alias name='usb0'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x7'/>
 +
    </controller>
 +
    <controller type='usb' index='0' model='ich9-uhci1'>
 +
      <alias name='usb0'/>
 +
      <master startport='0'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0' multifunction='on'/>
 +
    </controller>
 +
    <controller type='usb' index='0' model='ich9-uhci2'>
 +
      <alias name='usb0'/>
 +
      <master startport='2'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x1'/>
 +
    </controller>
 +
    <controller type='usb' index='0' model='ich9-uhci3'>
 +
      <alias name='usb0'/>
 +
      <master startport='4'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x2'/>
 +
    </controller>
 +
    <controller type='pci' index='0' model='pci-root'>
 +
      <alias name='pci.0'/>
 +
    </controller>
 +
    <controller type='ide' index='0'>
 +
      <alias name='ide0'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
 +
    </controller>
 +
    <controller type='virtio-serial' index='0'>
 +
      <alias name='virtio-serial0'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
 +
    </controller>
 +
    <controller type='sata' index='0'>
 +
      <alias name='sata0'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
 +
    </controller>
 +
    <controller type='scsi' index='0'>
 +
      <alias name='scsi0'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
 +
    </controller>
 +
    <interface type='direct'>
 +
      <mac address='52:54:00:a6:96:9e'/>
 +
      <source dev='eth0' mode='passthrough'/>
 +
      <target dev='macvtap0'/>
 +
      <model type='virtio'/>
 +
      <alias name='net0'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
 +
    </interface>
 +
    <interface type='direct'>
 +
      <mac address='52:54:00:5d:1d:39'/>
 +
      <source dev='eth1' mode='passthrough'/>
 +
      <target dev='macvtap1'/>
 +
      <model type='virtio'/>
 +
      <alias name='net1'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
 +
    </interface>
 +
    <interface type='direct'>
 +
      <mac address='52:54:00:c2:3d:41'/>
 +
      <source dev='eth3' mode='passthrough'/>
 +
      <target dev='macvtap2'/>
 +
      <model type='virtio'/>
 +
      <alias name='net2'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
 +
    </interface>
 +
    <interface type='direct'>
 +
      <mac address='52:54:00:02:d8:6f'/>
 +
      <source dev='eth4' mode='passthrough'/>
 +
      <target dev='macvtap3'/>
 +
      <model type='virtio'/>
 +
      <alias name='net3'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
 +
    </interface>
 +
    <interface type='bridge'>
 +
      <mac address='52:54:00:f8:c8:64'/>
 +
      <source bridge='br-ffwi'/>
 +
      <target dev='vnet0'/>
 +
      <model type='virtio'/>
 +
      <alias name='net4'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
 +
    </interface>
 +
    <serial type='pty'>
 +
      <source path='/dev/pts/1'/>
 +
      <target port='0'/>
 +
      <alias name='serial0'/>
 +
    </serial>
 +
    <console type='pty' tty='/dev/pts/1'>
 +
      <source path='/dev/pts/1'/>
 +
      <target type='serial' port='0'/>
 +
      <alias name='serial0'/>
 +
    </console>
 +
    <channel type='spicevmc'>
 +
      <target type='virtio' name='com.redhat.spice.0'/>
 +
      <alias name='channel0'/>
 +
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
 +
    </channel>
 +
    <input type='mouse' bus='ps2'/>
 +
    <input type='keyboard' bus='ps2'/>
 +
    <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
 +
      <listen type='address' address='127.0.0.1'/>
 +
    </graphics>
 +
    <sound model='ich6'>
 +
      <alias name='sound0'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
 +
    </sound>
 +
    <video>
 +
      <model type='qxl' ram='65536' vram='65536' heads='1'/>
 +
      <alias name='video0'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
 +
    </video>
 +
    <redirdev bus='usb' type='spicevmc'>
 +
      <alias name='redir0'/>
 +
    </redirdev>
 +
    <redirdev bus='usb' type='spicevmc'>
 +
      <alias name='redir1'/>
 +
    </redirdev>
 +
    <memballoon model='virtio'>
 +
      <alias name='balloon0'/>
 +
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
 +
    </memballoon>
 +
  </devices>
 +
  <seclabel type='dynamic' model='apparmor' relabel='yes'>
 +
    <label>libvirt-3cc0a834-3d84-4974-891e-8483c09afa35</label>
 +
    <imagelabel>libvirt-3cc0a834-3d84-4974-891e-8483c09afa35</imagelabel>
 +
  </seclabel>
 +
</domain>
 +
</source>
 +
 +
====VM-Watchdog-Script====
 +
Wenn die VM unerwartet crasht, kann diese per Remote nicht resettet werden.
 +
Dies machen wir automatisiert mit diesem Script, das in /usr/local/bin liegt.
 +
<source lang='bash'>
 +
#!/bin/bash
 +
 +
count=$( ping6 -c 5 fd56:b4dc:4b1e:0:5054:ff:fea6:969e | grep "bytes from" | wc -l )
 +
if [ $count -eq 0 ]
 +
then
 +
  logger "Sim-Papagei: Not available -> Reset VM"
 +
  virsh reset Sim-Papagei
 +
  exit 0
 +
else
 +
  logger "Sim-Papagei: Up and running -> nothing to do"
 +
  exit 0
 +
fi
 +
</source>
 +
 +
Per cronjob wird es alle 20 Minuten ausgeführt
 +
<source lang='text'>
 +
# m h  dom mon dow  command
 +
*/20 * * * * /usr/local/bin/vm-watchdog.sh
 +
</source>
 +
    
==Gebäudeplan==
 
==Gebäudeplan==