You are not logged in.

#1 2020-11-29 08:05:44

avongil
Member
From: Easton, PA
Registered: 2013-10-06
Posts: 24
Website

[SOLVED] KVM/QEMU - Ethernet will not bridge

Hi Everyone, I am trying to run debian as a guest on an an arch server. The Debian VM is a backup PieHole for the network.
I have installed Debian and got most things working except for bridging the VM to my network.
I am following the Bridge-Helper section.

on the host:
the tun kernel module is loaded.

/etc/qemu/bridge.conf contains:

 
allow br0
allow bridge0

I added the bridge  with:

brctl addbr br0
brctl addbr br0 enp1s0

brought up the link:

ip link set up dev br0

my startup is:

 qemu-system-x86_64 --enable-kvm -net nic -net bridge,br=bridge0 -vnc 192.168.101.7:0 -m 2G -boot menu=off -drive file=pihole,format=raw

The VM starts but there is no networking and hangs for a minute at DHCP.
if I remove both the -net parameters the machine starts up fine, with its default networking.

Any help would be appreciated.

Last edited by avongil (2020-12-01 06:02:11)

Offline

#2 2020-11-29 12:58:47

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,038

Re: [SOLVED] KVM/QEMU - Ethernet will not bridge

It looks like your 2nd brctl command is wrong and doesn't link a bridge and an interface.

As root run (and post the output)

# brctl show

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2020-11-29 13:25:54

avongil
Member
From: Easton, PA
Registered: 2013-10-06
Posts: 24
Website

Re: [SOLVED] KVM/QEMU - Ethernet will not bridge

Brilliant, thank you.  I'm not sure why I was using bridge0.  changed everything to br0

bridge name     bridge id               STP enabled     interfaces
br0             8000.1ee08b50fdee       no              enp1s0
                                                        tap1

Networking is now functional on the VM.

So....   I made a bit of a mess. How do I remove tap0 ? 

ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
    link/ether 40:16:7e:65:a6:df brd ff:ff:ff:ff:ff:ff
    inet 192.168.101.7/24 brd 192.168.101.255 scope global enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::4216:7eff:fe65:a6df/64 scope link
       valid_lft forever preferred_lft forever
21: tap0: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether d2:82:48:c2:0d:bb brd ff:ff:ff:ff:ff:ff
23: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 1e:e0:8b:50:fd:ee brd ff:ff:ff:ff:ff:ff
    inet 192.168.101.5/24 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::1ce0:8bff:fe50:fdee/64 scope link
       valid_lft forever preferred_lft forever
25: tap1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UNKNOWN group default qlen 1000
    link/ether fe:4f:2d:38:3c:8f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc4f:2dff:fe38:3c8f/64 scope link
       valid_lft forever preferred_lft forever

Offline

#4 2020-11-29 14:02:08

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,038

Re: [SOLVED] KVM/QEMU - Ethernet will not bridge

Try

# ip link delete tap0

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2020-12-01 05:34:43

avongil
Member
From: Easton, PA
Registered: 2013-10-06
Posts: 24
Website

Re: [SOLVED] KVM/QEMU - Ethernet will not bridge

after much chasing my tail I have a method that works great. The wiki really needs an update to the section:  Bridged networking using qemu-bridge-helper
Here are two scrips that setup the network and then run QEMU

#start network                                         
ip link add name br0 type bridge &&
ip link set br0 up &&
ip link set enp1s0 master br0 &&
ip addr flush dev enp1s0 &&
ip link set enp1s0 master br0 &&
ip addr add 192.168.101.7/24 brd + dev br0 &&
ip route add default via 192.168.101.1 dev br0
#launch debian
qemu-system-x86_64 --enable-kvm -net nic -net bridge,br=br0 -vnc 192.168.101.7:0 -m 2G -boot menu=off -drive file=pihole,format=raw

Last edited by avongil (2020-12-01 05:35:10)

Offline

Board footer

Powered by FluxBB