You can configure Incus instances in two primary network modes:
- NAT (Default): VMs are in a private subnet. Incus acts as a gateway/router. Safe and isolated.
- Bridged (LAN): VMs appear as devices on your physical LAN. Necessary if you need direct external access to VMs without port forwarding.
By default, an incusbr0 bridge is created.
Typical Config:
config:
dns.mode: managed
ipv4.address: 10.40.168.1/24
ipv4.nat: 'true'To access VMs by name (e.g., ping gipDLVmWin11.incus) from the host:
-
Configure Host DNS:
sudo resolvectl dns incusbr0 10.40.168.1 sudo resolvectl domain incusbr0 '~incus' sudo resolvectl dnssec incusbr0 off sudo resolvectl dnsovertls incusbr0 off -
Make it Persistent: Edit
/etc/systemd/resolved.conf:[Resolve] DNS=10.40.168.1 Domains=~incus DNSSEC=no DNSOverTLS=no
Restart service:
sudo systemctl restart systemd-resolved
If you need the VM to have an IP from your physical router (e.g., 192.168.x.x), you must create a bridge on the host OS managed by NetworkManager, and tell Incus to use it.
- Identify your interface:
ip linkornmcli connection show(e.g.,eth0). - Create Bridge:
sudo nmcli connection add type bridge ifname br0 con-name br0 - Add Slave Interface:
sudo nmcli connection add type bridge-slave ifname eth0 master br0 con-name br0-slave-eth0 - Disable STP (Spanning Tree) to speed up connections:
sudo nmcli connection mod br0 bridge.stp no
- Activate Bridge:
# Shutdown existing connection sudo nmcli connection down "Wired connection 1" # Bring up bridge sudo nmcli connection up br0 sudo nmcli connection up br0-slave-eth0
Create a profile LANofHost in Incus to use this bridge.
name: LANofHost
devices:
eth0:
parent: br0
nictype: bridged
type: nicApply this profile to your VM:
sudo incus profile assign gipDLVmWin11 default,LANofHost(Make sure to remove the network config from the default profile or override it).
In the files folder you can find example scripts that automates switching between Bridged Mode or NAT Mode:
- switch-to-host-network.sh
- switch-to-incus-nat.sh
- switch-to-macvlan.sh
Linux host firewalls often block bridged traffic. Disable netfilter on the bridge:
# Temporary
sudo sysctl -w net.bridge.bridge-nf-call-iptables=0
sudo sysctl -w net.bridge.bridge-nf-call-ip6tables=0
sudo sysctl -w net.bridge.bridge-nf-call-arptables=0
# Permanent
echo "net.bridge.bridge-nf-call-iptables=0" | sudo tee /etc/sysctl.d/99-bridge-disable-firewall.confSome USB network adapters drop packets with "foreign" MAC addresses (PROMISC mode issues). Force promiscuous mode:
sudo ip link set dev eth0 promisc onPermanent NetworkManager setting:
sudo nmcli connection modify br0-slave-eth0 802-3-ethernet.auto-negotiate yes