You are not logged in.

#1 2024-12-30 02:18:42

serat
Member
Registered: 2020-01-19
Posts: 31

solved: qemu upgrade breaks bridge-networking

update:
Problem is with the virtio code in qemu.

https://gitlab.com/qemu-project/qemu/-/issues/2762

I confirmed that this was the problem by changing

-nic model=virtio 

to

-nic model=e1000

which makes the dhcp and so the networking work again.

-------------------


qemu 9.1.2-1 works, but upgrading to 9.2.0-1 breaks the networking.

I had set up to have a bridge (created by systemd) called qlan-bridge. I also have a dnsmasq listening on this interface and handing out IP addresses. I have also set up the forwarding net.ipv4.*.forwarding = 1

With qemu 9.1.2-1 everything works, and the vm receives the IP address from the dnsmasq dhcp server. With 9.2.0-1, the dnsmasq does receive the dhcp request and responds with the IP address (as I see from the dnsmasq logs), but this response does not seem to reach the vm since it never gets the IP address.

The qemu command used to start the vm is given below. Any ideas why networking breaks with the newer qemu version?

/usr/bin/qemu-system-x86_64  -nographic -device intel-hda -device hda-duplex \
-drive file=/usr/share/edk2-ovmf/x64/OVMF_CODE.4m.fd,if=pflash,format=raw,unit=0,readonly=on -drive file=/home/qemu-user/.config/qemu.d/debian-uefi-vars.fd,if=pflash,format=raw,unit=1 \
-vga std -spice port=10421,addr=127.0.0.1,disable-ticketing \
-nic bridge,br=qlan-bridge,model=virtio,mac=52:54:00:21:2E:EE -k en-us \
-enable-kvm -object iothread,id=io1 -device virtio-blk-pci,drive=disk0,iothread=io1 \
-drive if=none,id=disk0,cache=unsafe,format=raw,aio=threads,file=/dev/vg-nvme/qemu-debian \
-cpu host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time -smp cores=2,threads=1,sockets=1 \
-fsdev local,security_model=passthrough,id=fsdev0,path=/home/qemu-user/Documents/qemu-share \
-device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare -device virtio-balloon -m 2G

Last edited by serat (2025-02-27 15:19:08)

Offline

#2 2025-01-03 16:15:14

osr
Member
Registered: 2025-01-02
Posts: 3

Re: solved: qemu upgrade breaks bridge-networking

I have the same issue with several home assistant instances. Downgrading qemu solves it.

Offline

#3 2025-02-03 17:46:03

serat
Member
Registered: 2020-01-19
Posts: 31

Re: solved: qemu upgrade breaks bridge-networking

The problem is not resolved with the update (qemu  9.2.0-2).

I have narrowed it down to some problem with forwarding the dhcp response. Specifically, if I have a static IP address in the qemu guest, then the guest can access the network and forwarding etc set up from the host works. But if I have the guest use dhcp to configure its IP address, then the dhcp request reaches the dhcp server running on the host, and the dhcp server responds to it, but for some reason it gets dropped somewhere along the line and never seems to reach the guest.

Any ideas why this might be the case? Or is there any ideas on how I can track the dhcp response packet and see why it is being dropped/misrouted/whatever?

On the host, my systemd-network config files for the qlan-bridge are as follows.

qlan-bridge.network

[Match]
Name=qlan-bridge

[Network]
Address=172.21.1.1/24
IPv4Forwarding=yes
IPMasquerade=yes

qlan-bridge.netdev

[NetDev]
Name=qlan-bridge
Kind=bridge

Update:
I had dnsmasq running the dhcp server on the qlan-bridge, which was not working. But when I changed the qlan-bridge.network to run systemd's DHCP server, the guest can now obtain the IP address. So the problem seems to be some setting in the qlan-bridge which prevents the dhcp response from reaching the guest.

Is there some specific setting to ensure that the dhcp response, which I am guessing is some kind broadcast, passes through the interface? Or is this qemu problem I am seeing because of some systemd change that happened previously (because I am using systemd-networkd to set up the bridge)?

Update:
I checked with tcpdump on the tap interface created when I start my virtual machine. It seems that dnsmasq is sending out a DHCP response (laptop-hp14.bootps > 172.21.1.102.bootpc: BOOTP/DHCP, Reply, length 301). But for some reason, the packet does not reach the vm.

Update:
It actually reaches the vm as I saw with tcpdump on the vm side! But for some reason the vm, which is running udhcpc (on Alpine) fails to set the IP address. So now I am out of explanations and this will remain a mystery, I guess.

Last edited by serat (2025-02-26 14:55:43)

Offline

#4 2025-02-26 18:13:18

osr
Member
Registered: 2025-01-02
Posts: 3

Re: solved: qemu upgrade breaks bridge-networking

Nobody else having similar problems?

I also use dnsmasq on the bridge interface and up to qemu 9.1.3 it works but even qemu 9.2.2 seems to have the problem. On gentoo I got just recently 9.2.2. It seems the problem is within qemu. I was not aware that dnsmasq, bridging and qemu is such a rare combination. Maybe need to have a deeper look and visit qemu forums ...

Offline

#5 2025-02-26 19:22:24

serat
Member
Registered: 2020-01-19
Posts: 31

Re: solved: qemu upgrade breaks bridge-networking

Should have checked qemu forums first.  https://gitlab.com/qemu-project/qemu/-/issues/2762

I confirmed that this was the problem by changing

-nic model=virtio 

to

-nic model=e1000

Last edited by serat (2025-02-27 15:15:47)

Offline

Board footer

Powered by FluxBB