KVM Bridged Networking

Submitted by Jeff on Mon, 18/06/2018 - 14:14

Source

(Note: To setup NAT networking, see: https://wiki.debian.org/KVM)

Bridge the network on Debian:

apt install bridge-utils

Create the bridge:

# brctl addbr br0

We are only going to create a bridge on eno1 for VMs to use:

Caution: this must be done through the iKVM remote console, as the network breaks!

brctl addif br0 eno1

Make changes permanent:

root@vespa ~ $ cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eno1
iface eno1 inet static


auto br0
iface br0 inet static
   hwaddress 0C:C4:7A:7C:CE:26
   address 1x7.1x9.2x7.10
   netmask 255.255.255.248
   gateway 1x7.1x9.2x7.9

    bridge_ports eno1
    bridge_stp off
    bridge_fd 0
    bridge_maxwait 0

iface br0 inet6 static
    address 2c0x:xxxx:xx00:801::10
    netmask 64
    gateway 2c0x:xxxx:xx00:801::1

# Hetzner 1GB VLAN internal network 
auto eno2
        iface eno2 inet static
        address 192.168.100.10
        netmask 255.255.255.0 

 

To move the client VMs from NAT 'network' to Bridged:

virsh edit 'vm-name'

Change <interface type='network'>, and source line:

<interface type='bridge'>
<mac address='52:54:00:ca:d6:a8'/>
<source bridge='br0'/>
<model type='virtio'/>

When everything is working, disable the virsh network called 'default':

virsh net-autostart --disable default
(https://askubuntu.com/questions/978487/how-do-i-stop-virbr0-interface-being-created)

Install resolvconf to handle DNS entries
(As dnsmasq will no longer be servicing the VM 'network')

apt install resolvconf
nano /etc/resolvconf/resolv.conf.d/base

... and add, e.g.:

nameserver 196.22.142.222 
nameserver 41.203.18.183
nameserver 197.221.12.82

Update /etc/resolv.conf:
resolvconf -u

 

 

Ubuntu 24.04 LTS NETPLAN…

 

Submitted by Admin on Wed, 05/02/2025 - 11:18

Ubuntu 24.04 LTS NETPLAN YAML file with working br0 (0.0.0.0 / ::0) and br1 (VLAN)

/etc/netplan $ cat 00-installer-config.yaml
network:
  version: 2
  ethernets:
    eno1:
      critical: true
      match:
        macaddress: "3c:ec:ef:96:58:f0"
      set-name: eno1
    eno2:
      match:
        macaddress: "3c:ec:ef:96:58:f1"
      set-name: eno2
  bridges:
    br0:
      interfaces:
        - eno1
      addresses:
        - 129.232.193.10/29
        - 2c0f:fce8:4000:801::100/64
      nameservers:
        addresses: ["156.38.225.225", "156.38.225.226"]
      routes:
        - to: default
          via: 129.232.193.9
        - to: "::0"
          via: "2c0f:fce8:4000:801::1"
    br1:
      interfaces:
        - eno2
      addresses:
        - 192.168.100.100/24

 

Category