Add a virtual network
Libvirt virtual networks connect VM interfaces to NAT, isolated networks, or existing host bridges.
NAT and host bridges #
| Mode | Connection | Address assignment |
|---|---|---|
| NAT | A separate VM subnet. Outbound IPv4 connections use the host’s address. Inbound connections from the LAN are blocked by default. | Libvirt DHCP, if enabled, or static guest addresses. |
| Host bridge | An existing Linux bridge. A bridge connected to the physical LAN places VMs on that LAN. | The LAN’s DHCP server or static guest addresses. Libvirt does not add DHCP for this mode. |
| Isolated | VMs communicate with each other and the host, without forwarding to other networks. | Libvirt DHCP, if enabled, or static guest addresses. |
Host bridge mode requires a Linux bridge configured on the host first. Selecting this mode does not create the bridge or move a physical interface into it.
Create an IPv4 NAT network #
- Open Networks under VMs and select New network.
- Enter a Name and select NAT.
- Enable Use IPv4 and check the Subnet and Gateway. Use a subnet that does not overlap the LAN, VPN, or other virtual networks.
- Enable Enable DHCP server for automatic guest addresses, then check Range start and Range end.
- Under DNS, enable the DNS server if needed. With no forwarders entered, queries use the host’s resolvers.
- Enable Start now and Start with the host as needed, then select Create network.
For example, if unused on the host and surrounding networks, 192.168.150.0/24 can use gateway 192.168.150.1 and DHCP range 192.168.150.100 through 192.168.150.200.
Register a host bridge #
- Select New network and enter a name.
- Select Host bridge and choose the existing Bridge.
- Set Start now and Start with the host, then select Create network.
This registers the bridge as a named libvirt network. The host’s bridge configuration and the LAN’s address services remain separate.
Connect a VM #
Creating a network does not attach VM interfaces. Select the network when creating a VM or adding a NIC. Start the network before starting a VM that uses it.
Stop or restart a network #
Stopping a NAT or isolated network removes its managed bridge and DHCP, DNS, and firewall rules. Attached VMs lose connectivity on that network. Restart also interrupts traffic.
Stopping a host bridge network does not delete the Linux bridge.