• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Monday, May 12, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Set Up a Bridged Network for KVM

in Arch Linux, KVM Virtualization, Linux OS
How to Set Up a Bridged Network for KVM

If you’re using KVM (Kernel-based Virtual Machine) for virtualization on your Linux system, you’ll often need to configure a bridged network. A bridged network allows your virtual machines (VMs) to connect to the physical network as if they were directly connected, giving them access to the internet and other network services. In this guide, we’ll show you how to set up a bridged network for KVM on Arch Linux.

Prerequisites

Before you begin, make sure you have the following installed and configured:

  1. Arch Linux: You’ll need a system running Arch Linux as the host operating system.
  2. KVM: Install KVM and its dependencies on your Arch Linux system. Follow this guide to set up KVM on Arch Linux.
  3. A working network connection: Ensure your Arch Linux system has a working network connection, either via Ethernet or Wi-Fi.

How to Set Up a Bridged Network for KVM

Install Necessary Packages

To set up a bridged network, you’ll need a few additional packages:

  • bridge-utils: Provides tools for configuring and managing network bridges.
  • dnsmasq: A lightweight DNS, DHCP, and TFTP server that we’ll use to provide IP addresses to the VMs.

Install these packages using the following command:

sudo pacman -S bridge-utils dnsmasq

Create the Network Bridge for KVM

First, let’s create a network bridge. In this example, we’ll use br0 as the bridge name and eno1 as the physical network interface connected to the host. Replace eno1 with your network interface name if it’s different.

  1. Create a new file /etc/systemd/network/br0.netdev and add the following configuration:
[NetDev]
Name=br0
Kind=bridge
  1. Create another file /etc/systemd/network/br0.network with the following content:
[Match]
Name=br0

[Network]
DHCP=yes
  1. Modify your existing network interface configuration by creating a file /etc/systemd/network/eno1.network with the following content:
[Match]
Name=eno1

[Network]
Bridge=br0
  1. Restart the systemd-networkd service to apply the changes:
sudo systemctl restart systemd-networkd
  1. Enable the new bridge interface with the following command:
sudo ip link set br0 up
  1. Verify the bridge configuration by running ip addr show and checking for the br0 interface.

Configure dnsmasq for DHCP and DNS Services

To provide IP addresses to the VMs and handle DNS requests, we’ll use dnsmasq. Create a new configuration file /etc/dnsmasq.d/br0.conf with the following content:

interface=br0
dhcp-range=192.168.10.100,192.168.10.200,12h
domain=example.lan

Replace 192.168.10.100 and 192.168.10.200 with the desired IP address range for your VMs, and example.lan with your preferred domain name.

Restart the dnsmasq service to apply the changes:

sudo systemctl restart dnsmasq
  1. Enable the dnsmasq service to start automatically on boot:
sudo systemctl enable dnsmasq

Configure KVM to Use the Bridged Network

Now that we’ve set up the bridged network, we need to configure KVM to use it for the virtual machines.

  1. Edit the default KVM network configuration by opening /etc/libvirt/qemu/networks/default.xml in a text editor.
  2. Replace the existing configuration with the following content, which defines the br0 bridge as the default network for KVM:
<network>
  <name>default</name>
  <forward mode='bridge'/>
  <bridge name='br0'/>
</network>
  1. Restart the libvirtd service to apply the changes:
sudo systemctl restart libvirtd
  1. Refresh the default network configuration in KVM:
sudo virsh net-destroy default
sudo virsh net-define /etc/libvirt/qemu/networks/default.xml
sudo virsh net-start default
sudo virsh net-autostart default

Your KVM virtual machines will now use the br0 bridged network by default, allowing them to communicate with the physical network as if they were directly connected.

Verify the Configuration

To verify that your KVM virtual machines are using the bridged network, create a new VM or start an existing one. Once the VM is up and running, check its network configuration to confirm that it has received an IP address from the br0 bridge’s DHCP server (dnsmasq).

You can do this by logging into the VM and running the following command:

ip addr show

Look for an IP address in the range you specified in the dnsmasq configuration (e.g., 192.168.10.100 to 192.168.10.200). If the VM has an IP address in this range, it’s using the bridged network.

Additionally, test the VM’s network connectivity by pinging external hosts or accessing the internet through a web browser. If the VM can connect to external hosts, your bridged network setup is successful.

Conclusion

In this guide, we’ve shown you how to set up a bridged network for KVM on Arch Linux. A bridged network allows your virtual machines to connect to the physical network as if they were directly connected, making it easier to manage and maintain network services for your VMs.

For more information on setting up and configuring KVM on Arch Linux, check out our other related guides:

  • How to Set Up KVM Virtualization on Arch Linux
  • How to Install and Configure BIND DNS Server on Arch Linux
  • How to Set Up an Email Server on Arch Linux
  • How to Set Up a LAMP Stack on Arch Linux
  • How to Set Up a File Sharing Server on Arch Linux
ShareTweet
Previous Post

How to Install and Configure Nagios on Arch Linux

Next Post

How to Install Logwatch on Rocky Linux

Related Posts

How to Install Tomcat on Rocky Linux

How to Install Apache Tomcat on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.