KVM Networking Explained: NAT, Bridged, Routed and Isolated Networks

How libvirt networking works: the default NAT network, Linux bridges for LAN access, routed and isolated networks, and how to create each one.

Published November 27, 2026

Networking is where most KVM setups get stuck. The VM boots, but it cannot reach the internet, or the internet cannot reach it, or other machines on the LAN cannot see it. All of these come down to which network mode you picked. This article explains the four libvirt modes visually and shows how to build each.

The concept

Every libvirt VM NIC is a tap device on the host (vnet0, vnet1 and so on). What changes between modes is what that tap device is plugged into. In NAT mode it joins a private bridge (virbr0) behind the host's IP. In bridged mode it joins a bridge that also contains your physical NIC, so the VM looks like another computer on the LAN.

libvirt's default network is NAT on 192.168.122.0/24. libvirt runs a dnsmasq instance that hands out DHCP leases and answers DNS for that subnet, and it inserts nftables/iptables masquerade rules so traffic leaving the VMs appears to come from the host. Outbound access just works; inbound access from the LAN requires port forwarding.

Bridged networking is what you want for servers that need a LAN IP, for example a VM running a web service other machines must reach. It is configured on the host (NetworkManager, netplan or systemd-networkd), not in libvirt, and libvirt simply attaches VMs to the existing bridge.

The four modes at a glance

ModeVM getsReachable from LAN?Good for
NAT (default)192.168.122.x private IPNo (needs port forward)Desktops, labs, outbound-only workloads
BridgedIP from your LAN DHCP/routerYes, like a physical hostServers, services on the LAN
RoutedOwn subnet routed by hostYes, if LAN router knows the routeHosting providers, multiple subnets
IsolatedPrivate IP, no uplinkNo, and no internetTest clusters, malware labs

How NAT mode routes traffic

taprouteSNATVMvnet0virbr0192.168.122.1NATmasqueradeeth0host IP
NAT mode: VMs share the host's address on the way out.

How bridged mode works

tapL2framesVMvnet0br0Linux bridgeeth0enslavedLAN switchrouter/DHCP
Bridged mode: the VM sits directly on the LAN at layer 2.

Creating a bridge with NetworkManager

Moving the host's IP from the physical NIC to a bridge is the only risky step. Do it from a console or with a scheduled rollback if you are connected over SSH, because the connection drops while the IP moves.

nmcli con add type bridge ifname br0 con-name br0 ipv4.method auto
nmcli con add type bridge-slave ifname enp3s0 master br0
nmcli con down "Wired connection 1" ; nmcli con up br0
ip -br addr show br0

Practical examples

Attach a VM to the bridge

Change the existing NIC or add a second one.

virt-install ... --network bridge=br0,model=virtio
# or for an existing VM
virsh attach-interface web01 bridge br0 --model virtio --persistent

Define an isolated network

No <forward> element means no uplink: VMs talk only to each other and the host.

cat > isolated.xml <<'EOF'
<network>
  <name>lab</name>
  <bridge name="virbr10"/>
  <ip address="10.10.10.1" netmask="255.255.255.0">
    <dhcp><range start="10.10.10.100" end="10.10.10.200"/></dhcp>
  </ip>
</network>
EOF
virsh net-define isolated.xml && virsh net-start lab && virsh net-autostart lab

Give a NAT VM a fixed IP

Add a DHCP host reservation keyed by MAC address.

virsh net-update default add ip-dhcp-host \
  "<host mac='52:54:00:3a:91:7c' name='web01' ip='192.168.122.10'/>" --live --config

Common mistakes

  • Bridging a Wi-Fi interface. Most Wi-Fi drivers cannot bridge; use NAT or routed mode on laptops.
  • Host firewall rules (ufw, firewalld) blocking forwarding between virbr0 and the uplink.
  • Docker setting the iptables FORWARD policy to DROP, which silently breaks libvirt NAT and bridges.
  • Forgetting that br_netfilter makes bridged traffic pass through iptables, which can drop VM traffic unexpectedly.
  • Editing dnsmasq configs by hand instead of using virsh net-edit.

Key takeaways

  • NAT is the zero-config default: outbound works, inbound needs forwarding.
  • Bridged mode puts VMs on the LAN. Configure the bridge on the host, then attach VMs to it.
  • Isolated networks are a network definition without a forward element.
  • Most "no network" problems are firewall forwarding rules, not libvirt.

FAQ

Why can my VM reach the internet but not other LAN hosts reach it?

It is on the default NAT network. Switch to a bridge or add port-forwarding rules on the host.

What is macvtap?

A simpler alternative to bridging that attaches VMs directly to a physical NIC. Its catch: the host and its guests cannot talk to each other over that NIC.

Can a VM have several NICs?

Yes. Add multiple --network options or attach interfaces later. A common pattern is NAT for management plus bridged for service traffic.

More Linux articles