Multiple networks

Sometimes it makes sense to run multiple networks of different types for your virtual machines (VMs). libvirt allows each VM to have several network interface controllers (NICs), each connected to a different network.

Example 1

VMs on a dedicated server need to serve clients over both IPv4 and IPv6. The hosting provider has allocated a /56 block of IPv6 addresses but only one IPv4 address. Due to hosting provider limitations, bridging is unavailable.

  • The first NIC connects to a Routed network and allows VMs to have their own (statically routed) IPv6 address.
  • The second NIC connects to a NAT-based network and provides IPv4 connectivity without having to purchase additional IPv4 addresses.

Example 2

VMs on a dedicated server need to serve clients over both IPv4 and IPv6. The hosting provider has allocated a /64 block of IPv6 addresses but only one IPv4 address. The dedicated server is on a private VLAN that allows VMs to bind directly to IP addresses.

  • The first NIC connects to a Bridged network and allows VMs to bind directly to IPv6 addresses on the VLAN.
  • The second NIC connects to a NAT-based network and provides IPv4 connectivity without having to purchase additional IPv4 addresses.

Example 3

The libvirt server in a home lab is connected to one network via Ethernet and one network via wireless. VMs are running services that must be available to clients on both of these networks.

  • The first NIC connects to a Bridged network and allows clients on the Ethernet network to access VMs.
  • The seconds NIC connects to a Routed network and allows clients on the wireless network to access VMs.