LLI Wiki — My Digital Knowledge Base

KVM default network and nftables rules for virbr0

Enable the libvirt default network and allow traffic on the virbr0 bridge in nftables.

On a KVM/libvirt host, the default network (bridge virbr0) can be inactive, and its traffic can be blocked by the nftables firewall rules. This article summarises the commands used to set the network to start automatically and to allow traffic on virbr0.

Reference: Xmodulo, "network default is not active"

Enable the default network

sudo virsh net-autostart default

Check and reload nftables

List the tables and rules:

sudo nft list tables
sudo nft list table ip filter -a -n
nft -s list ruleset

Reload the configuration from the file:

nft -f /etc/nftables.conf

Allow traffic on virbr0

sudo nft add rule ip filter position 10 iif "virbr0" accept
sudo nft insert rule ip filter forward position 13 oif "virbr0" accept
sudo nft insert rule ip filter forward position 13 iif "virbr0" accept

Notes

Mastodon LLIMastodon SocialFosstodon