OPINIONATED OMARCHY
TROUBLESHOOTING CORPUS
790
RECORDS
790
AUDITED
0
UNCHECKED
2388
SOURCES
LIVE
apps-services high common DISPUTE

Give libvirt NAT guests a DHCP lease and DNS when ufw is default-deny

omarchyarchlibvirtqemukvmufwvirt-managerdesktoplaptop
AUDITED Audited against its sources and confirmed accurate. · checked against Omarchy omarchy 4.0.4-1 on 2026-10-05
AUDIT NOTE

/usr/share/omarchy/install/config/firewall.sh on 4.0.4-1 runs 'ufw default deny incoming' and opens only LocalSend and Docker DNS. /etc/default/ufw has DEFAULT_INPUT_POLICY="DROP" and DEFAULT_FORWARD_POLICY="DROP", /etc/ufw/sysctl.conf line 8 has net/ipv4/ip_forward=1 commented, and /etc/libvirt/network.conf (libvirt 12.7.0) says the backend defaults to the first available of nftables, iptables. /usr/share/omarchy/bin has no virt-manager or libvirt installer. omacom/omarchy PR #13588 is open and its omarchy-install-virt-manager adds exactly these rules: allow in on virbr0 to ports 53 and 67, route deny in on virbr0 to the three private ranges, then route allow in on virbr0, after deleting any earlier route allow so the denies sort first. The Arch UFW wiki's Forward policy section supports the ip_forward step. The same three virbr0 rules are what this repo's operator uses to give the test VMs DHCP and NAT on this host, which is local confirmation of the fix. Not exercised by this audit: no firewall rule was changed.

RISK

sudo ufw route allow in on virbr0 with no out on lets guests reach every machine on your LAN. Use the per-uplink form or the private-range deny rules if the guests run untrusted software.

Symptom

A VM in virt-manager boots but has no network. Inside the guest ip a shows no IPv4 address on the virtio NIC and NetworkManager sits at "connecting (getting IP configuration)" until it gives up. On the host sudo virsh net-list --all says default active yes yes and ip a show virbr0 shows 192.168.122.1, yet sudo virsh net-dhcp-leases default is empty. Giving the guest a static address lets it ping 192.168.122.1, but names do not resolve and nothing beyond the host answers. The guest OS installer may have finished perfectly, because an offline ISO needs no network.

Cause

Omarchy's installer (install/config/firewall.sh) runs ufw default deny incoming, and /etc/default/ufw ships DEFAULT_INPUT_POLICY="DROP" and DEFAULT_FORWARD_POLICY="DROP" (both confirmed on a 4.0.4-1 install). libvirt's default network runs dnsmasq on the host at 192.168.122.1, so a guest's DHCP request (UDP 67) and DNS queries (port 53) are traffic INTO the host and traverse the INPUT hook. libvirt's own firewall rules (nftables backend by default, see /etc/libvirt/network.conf) add NAT and forwarding accepts in libvirt's own table, but in nftables a packet must be accepted by every base chain on a hook, so ufw's INPUT chain still drops DHCP and DNS, and ufw's FORWARD chain still drops the guest's outbound traffic. Nothing in Omarchy 4.0.4 opens virbr0: there is no virt-manager installer in /usr/share/omarchy/bin, and the open upstream PR that would add one (omacom/omarchy#13588) carries exactly these ufw rules. Plain Arch with ufw enabled behaves the same way.

Fix

Allow DHCP and DNS from the bridge only, so nothing opens on your real network interfaces:


sudo ufw allow in on virbr0 to any port 67 proto udp comment 'libvirt dhcp'
sudo ufw allow in on virbr0 to any port 53 comment 'libvirt dns'

Then allow the guests' NATed traffic out. Find your uplink interface first:


ip route show default          # the word after 'dev' is the uplink, e.g. wlan0 or enp5s0
sudo ufw route allow in on virbr0 out on wlan0 comment 'libvirt nat egress'

Add one route allow line per uplink if a laptop switches between Wi-Fi and Ethernet. If you would rather not name interfaces, the rule set proposed upstream in omacom/omarchy#13588 lets guests reach the internet but not your private LAN. The deny rules must be added before the allow, because ufw stops at the first match:


sudo ufw route deny in on virbr0 to 10.0.0.0/8
sudo ufw route deny in on virbr0 to 172.16.0.0/12
sudo ufw route deny in on virbr0 to 192.168.0.0/16
sudo ufw route allow in on virbr0

Check that the host forwards IPv4. libvirt turns this on when it starts a NAT network, and ufw leaves it alone because /etc/ufw/sysctl.conf ships the line commented:


sysctl net.ipv4.ip_forward     # must print 1

If it prints 0, uncomment net/ipv4/ip_forward=1 in /etc/ufw/sysctl.conf and run sudo ufw reload.

Finally make the guest ask again, by rebooting it or with sudo virsh reboot <domain>.

On plain Arch with no firewall at all none of this is needed. With firewalld, libvirt installs its own libvirt zone and this does not apply.

Verify

sudo ufw status verbose | grep virbr0 lists the rules. sudo virsh net-dhcp-leases default shows the guest's MAC with a 192.168.122.x address, and inside the guest ping -c1 archlinux.org resolves and answers.

Sources

libvirt-guests-no-dhcp-lease-ufw-input-drop