Benutzer-Werkzeuge

Webseiten-Werkzeuge


linux:libvirt:netconfig-scratchpad

LIBVIRT: Konfiguration virtuelle Netzwerke und Speicher - Scratchpad


CR/LF aus Dateien entfernen und durch einfaches LF ersetzen

sed -i 's/\r/\n/g; s/\n$//' foo

default.xml

<network>
  <name>default</name>
  <uuid>791a49c8-b6ad-41f5-ae52-9c4490ef15da</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='52:54:00:37:fa:e4'/>
  <domain name='nat.kvm'/>
  <dns>
    <forwarder domain='fritz.box' addr='192.168.178.1'/>
    <forwarder domain='178.168.192.in-addr.arpa' addr='192.168.178.1'/>
  </dns>
  <ip address='192.168.122.254' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.1' end='192.168.122.253'/>
      <bootp file='pxelinux.0' server='192.168.178.12'/>
    </dhcp>
  </ip>
</network>

routed.xml

<network>
  <name>routed</name>
  <uuid>c679f949-ef06-4e52-ad0b-de6909d63a24</uuid>
  <forward mode='route'/>
  <bridge name='virbr1' stp='on' delay='0'/>
  <mac address='52:54:00:77:14:96'/>
  <domain name='routed.kvm'/>
  <dns>
    <forwarder domain='fritz.box' addr='192.168.178.1'/>
    <forwarder domain='178.168.192.in-addr.arpa' addr='192.168.178.1'/>
  </dns>
  <ip address='192.168.123.254' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.123.1' end='192.168.123.253'/>
      <bootp file='pxelinux.0' server='192.168.178.12'/>
    </dhcp>
  </ip>
</network>

Physikalische Platte / Partition

<disk type='block' device='disk'>
  <driver name='qemu' type='raw' cache='unsafe' discard='unmap' detect_zeroes='unmap'/>
  <source dev='/dev/disk/by-id/ata-WDC_WD1002FAEX-00Y9A0_WD-WCAW30645732-part2'/>
  <target dev='vda' bus='virtio'/>
  <serial>WIN11ENT-Part-2</serial>
</disk>

Bridge LAN-Manager

nmcli device status
nmcli connection add type bridge con-name bridge0 ifname bridge0
nmcli connection add type ethernet slave-type bridge con-name 'Bridge connection 1' ifname enp6s0 master bridge0
nmcli connection up bridge0
nmcli connection modify bridge0 connection.autoconnect-slaves 1
nmcli connection up bridge0
nmcli device status
ip -brief addr show dev bridge0
 
 
vim nwbridge.xml
<network>
  <name>nwbridge</name>
  <forward mode='bridge'/>
  <bridge name='bridge0'/>
</network>
virsh net-define nwbridge.xml
virsh net-start nwbridge
virsh net-autostart nwbridge
rm nwbridge.xml
virsh net-list --all

Falls die Bridge gelöscht werden muß:

virsh net-destroy nwbridge
virsh net-undefine nwbridge
 
nmcli connection up 'Wired connection 1'
nmcli connection down bridge0
nmcli connection del bridge0
nmcli connection del 'Bridge connection 1'

SPICE-Script um xrandr bei Auflösungsänderung auszulösen

Das Display ggfs. entsprechend anpassen.

#!/bin/bash
# Monitor SPICE display changes and resize
xev -root -event randr | while read -r line; do
    xrandr --output Virtual-0 --auto
done

Virtio-FS XML-Entry

<filesystem type="mount" accessmode="passthrough">
  <driver type="virtiofs" queue="1024"/>
  <binary path="/usr/lib/virtiofsd" xattr="on">
    <cache mode="always"/>
    <lock posix="on" flock="on"/>
  </binary>
  <source dir="/home/hwehrs/Dokumente/fred"/>
  <target dir="FredDev"/>
  <address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
</filesystem>
linux/libvirt/netconfig-scratchpad.txt · Zuletzt geändert: von hwehrs

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki