Introduction
This is the setup and configuration I use for my main linux machine. It is a Fedora 40 Workstation.
Host Setup
Disable Hibernation
and Sleep
to prevent the system to go down automatically.
When using Fedora workstation
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
sudo systemctl status sleep.target suspend.target hibernate.target hybrid-sleep.target
Linux setup
Install the tooling to enable virtualization using virsh
sudo dnf update -y
sudo reboot
sudo dnf install -y libvirt
sudo dnf install -y virt-install
sudo dnf install -y qemu
sudo dnf install -y virt-manager
sudo dnf install -y xorg-x11-xauth
# Optional
sudo reboot
Network configuration
Configure a bridge
with one of your physical interface.
This way the VMs will be able to get a DHCP using my physical network.
bridge="br0"
interface="eno1"
nmcli connection add type bridge \
ifname $bridge \
con-name $bridge \
802-3-ethernet.mtu 1500 \
ipv4.method auto \
ipv4.never-default false \
ipv6.method ignore \
ipv6.never-default true
nmcli con up $bridge
nmcli connection add type bridge-slave \
ifname $interface \
con-name bridge-slave-$interface \
master $bridge
sudo dnf install -y bridge-utils
sudo cat >>/etc/sysctl.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-arptables = 0
net.bridge.bridge-nf-filter-vlan-tagged = 0
EOF
sudo modprobe --first-time 8021q
sudo modprobe br_netfilter
sudo sysctl -p
# Optional (I had to reboot to use the correct interface and test the sysctl config.)
sudo reboot
Virsh bridge
Setup the bridge in virsh and assign the interface created above
cat > /tmp/br0.xml << EOF
<network>
<name>br0</name>
<forward mode='bridge' />
<bridge name='br0' />
</network>
EOF
sudo virsh net-define /tmp/br0.xml && \
sudo virsh net-autostart br0 && \
sudo virsh net-start br0
You can use the UI to manage your VMs:
virt-manager
Optional - NVidia drivers
If you have a GPU on the host (not passthrough) You can install the following, use the version that matches your setup.
sudo dnf install akmod-nvidia-3:565.77-1.fc40.x86_64
sudo dnf install xorg-x11-drv-nvidia-cuda