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

Category