Configuring IPv6 Address Distribution to libvirt Guests Using Bridges

Updated at

Introduction: This tutorial demonstrates how to allocate a portion of your IPv6 address pool to your libvirt guests using bridges, ensuring that each guest has its unique public IPv6 address.


  • Dedicated server with libvirt installed
  • A /64 IPv6 subnet (e.g., 2001:0db8:abcd::/64)

Before We Begin: Before starting, ensure you have the following information:

  • Your IPv6 subnet address (e.g., 2001:0db8:abcd::/64)

Step 1 - Install Required Packages

Begin by installing the necessary packages, including bridge-utils and ifupdown. These are required alongside your existing libvirt installation:

sudo apt install bridge-utils ifupdown

Step 2 - Create the Bridge Interface

Next, create the bridge interface using the installed packages:

sudo brctl addbr br0

Step 2.1 - Assign a Subnet

Now, assign a /96 subnet to the bridge. This should provide ample addresses for your VMs:

sudo ip addr add 2001:0db8:abcd:1::1/96 dev br0

Step 2.2 - Set It Up

Activate the bridge interface:

ip link set br0 up

Step 3 - Add the Interface to a VM

Attach the bridge to a VM by using virsh:

sudo virsh

Inside virsh, edit the domain configuration for your VM:

edit --domain <name of the VM>

Add the following XML entry to the devices node, modifying it as needed:

<interface type='bridge'> <source bridge='br0'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/> </interface>

Please adjust the address values based on your specific configuration.

Step 4 - Set Up Your VM

Configure the network interface within your VM to use the allocated IPv6 address:

auto enp7s0 iface enp7s0 inet6 static address 2001:0db8:abcd:1::2 netmask 96 gateway 2001:0db8:abcd:1::1

Modify the values accordingly to match your network configuration. In the case of a Windows guest, configure the network settings through the Windows Settings app.

Step 4.1 - Activate the Configuration

Activate the configuration by restarting the networking service:

sudo systemctl restart networking

Your networking should be reestablished in a few seconds, without interrupting your SSH session.

Conclusion: You can now SSH into your libvirt guests using their static IPv6 addresses. To make your bridge configuration persistent across reboots, add it to the /etc/network/interfaces file. Additionally, consider installing a DHCP server to automate address assignments if needed.

YottaSrc footer

why choose us?

Better Pricing, Fast SSD Storage and Real 24/7
Technical Support.

control panel icon

Managing Your Site Through CPanel With The Latest Version

security icon

99.8% Uptime Guarantee.
So Focus On Your Work!

support icon
24/7/365 Support

Day or night, rain or shine,
our team is here for you!

cloud backup icon
Daily Backup

Daily & Weekly Backup.
Your Files Are Safe!