Skip to content

Programming by Design

If you're not prepared to be wrong, you'll never come up with anything original. – Sir Ken Robinson

  • About
  • Java-PbD
  • C-PbD
  • ASM-PbD
  • Algorithms
  • Other

LibVirt Configuration Notes

Posted on July 9, 2025July 22, 2025 By William Jojo
Uncategorized

(Updated July 9, 2025)

GRUB IPv6
=========
vi /etc/default/grub
add GRUB_CMDLINE_LINUX_DEFAULT=”ipv6.disable=1″
update-grub

Virtualization
==============

(add virt-manager if you have a GUI)

apt install qemu-kvm libvirt-clients bridge-utils libvirt-daemon-system virtinst

Configuration for the bridge (single port. would need bond for multiport.)
============================

root@u24vm1:~# cat /etc/netplan/50-cloud-init.yaml
network:
  version: 2
  ethernets:
    enp0s25:
      dhcp4: no
  bridges:
    br0:
      interfaces:
        - enp0s25
      addresses:
        - "141.222.36.36/22"
      nameservers:
        addresses:
        - 8.8.8.8
        - 8.8.4.4
        search: []
      routes:
      - to: "default"
        via: "141.222.36.1"

Bridge with a bond!

network:
  version: 2
  ethernets:
    eno1:
      dhcp4: false
    eno2:
      dhcp4: false
    eno3:
      dhcp4: false
    eno4:
      dhcp4: false
  bonds:
    bond0:
      dhcp4: false
      interfaces:
      - eno2
      - eno4
      - eno1
      - eno3
      parameters:
        mode: "balance-rr"
  bridges:
    br0:
      interfaces:
        - bond0
      addresses:
        - "141.222.36.237/22"
      nameservers:
        addresses:
        - 8.8.8.8
        - 8.8.4.4
        search: []
      routes:
      - to: "default"
        via: "141.222.36.1"
network:
  version: 2
  ethernets:
    eno1: {}
    eno2: {}
  bonds:
    bond0:
      interfaces:
      - eno2
      - eno1
      parameters:
        mode: "802.3ad"
        lacp-rate: "slow"
        transmit-hash-policy: "layer2"
  bridges:
    br0:
      interfaces:
        - bond0
      addresses:
        - "141.222.36.240/22"
      nameservers:
        addresses:
        - 141.222.36.200
        - 141.222.36.196
        search:
        - cs.skidmore.edu
        - skidmore.edu
      routes:
      - to: "default"
        via: "141.222.36.1"

Configure Adapter for a VM
==========================

root@u24vm1:~# cat bridge.xml
   <network>
     <name>host-bridge</name>
     <forward mode='bridge'/>
     <bridge name='br0'/>
   </network>

root@u24vm1:~# virsh net-define bridge.xml
Network host-bridge defined from bridge.xml

virsh # net-start –network host-bridge
virsh # net-autostart –network host-bridge
Network host-bridge marked as autostarted

virsh # net-list
Name State Autostart Persistent
————————————————
default active yes yes
host-bridge active yes yes

Test example on RHEL8 with libvirt:

sudo virt-install \
--name u24temp \
--memory 4096 \
--vcpus 2 \
--disk path=/3TB/VMS/u24temp/u24temp.qcow2,size=100,format=qcow2 \
--location /3TB/ubuntu-24.04.2-live-server-amd64.iso,kernel=casper/vmlinuz,initrd=casper/initrd \
--os-variant ubuntu24.04 \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--extra-args 'console=ttyS0,115200n8 serial' \
--machine q35

Test example on Ubuntu 24.04 with libvirt:

sudo virt-install \
--name u24temp \
--memory 3072 \
--vcpus 2 \
--disk path=/VMS/u24temp/u24temp.qcow2,size=60 \
--location /VMS/iso/ubuntu-24.04.2-live-server-amd64.iso,kernel=casper/vmlinuz,initrd=casper/initrd \
--network network=host-bridge \
--os-variant ubuntu24.04 \
--graphics none \
--console pty,target_type=serial \
--extra-args 'console=ttyS0,115200n8 serial' \
--machine q35 \
--autostart

Template details:
sysctl.conf
disable ipv6 in grub and ufw
add binutils bashtop chrony
timedatectl set-timezone America/New_York
base ufw rules

for pkg in $(dpkg -l | awk ‘/^ii/{print $2}’); do
if apt-cache policy “$pkg” | grep -q “/universe”; then
echo “$pkg”
fi
done

Post navigation

❮ Previous Post: RHEL IdM Notes
Next Post: Remote Desktop Connection to ADA ❯

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Copyright © 2018 – 2025 Programming by Design.