求助排查树莓派Zero(Raspbian系统)UDP组播丢失问题
Hey there, let's work through why your Pi Zero isn't picking up those Alexa UPnP multicast packets (239.255.255.250:1900 UDP) that you can see in Wireshark on Windows. I've debugged similar issues with Pi Zero WiFi and multicast before, so here's a step-by-step breakdown to get to the bottom of it:
1. Verify the Pi's Multicast Group Membership
UPnP devices need to explicitly join the 239.255.255.250 multicast group to receive packets. Check if your Pi is part of this group:
ip maddr show wlan0
Look for an entry like inet 239.255.255.250 under the wlan0 interface. If it's missing, manually join it with:
sudo ip maddr add 239.255.255.250 dev wlan0
Then re-run your tcpdump command to see if packets come through.
2. Check TCPdump Parameters & Interface
Double-check you're monitoring the correct WiFi interface (some Pi Zero variants might use wlan1 instead of wlan0). List all interfaces with:
ip link show
Also, simplify your tcpdump command to rule out filter issues. Start with capturing all UDP traffic first:
sudo tcpdump -ni wlan0 udp
If you see any multicast traffic here, narrow it back to port 1900. If not, the issue is broader than just UPnP.
3. Disable WiFi Power Management
The Pi Zero's WiFi adapter often enables power management by default, which can drop multicast/broadcast packets. Turn it off:
sudo iwconfig wlan0 power off sudo ifdown wlan0 && sudo ifup wlan0
Re-test your tcpdump capture after this.
4. Check Firewall & Network Isolation
- Firewall: If you have
ufwor another firewall running, it might block multicast traffic. Check status with:
If enabled, temporarily disable it withsudo ufw statussudo ufw disableand test again. - Router Client Isolation: Many home routers have a "Client Isolation" or "AP Isolation" feature that blocks devices on the same WiFi from communicating. Log into your router admin panel and make sure this is turned off.
5. Update Pi WiFi Firmware & Kernel
Outdated firmware can cause WiFi multicast bugs. Update your Pi's system and firmware:
sudo apt update && sudo apt full-upgrade sudo reboot
After rebooting, recheck the multicast group and run tcpdump again.
6. Test Basic Broadcast Reception
If even regular broadcasts aren't coming through, rule out a core WiFi issue. On your Windows machine, send a test UDP broadcast (using PowerShell):
echo "test broadcast" | nc -u 255.255.255.255 1234
On the Pi, listen for it with:
nc -ul 1234
If you don't receive the test message, your Pi's WiFi interface might be faulty, or the router is blocking inter-device traffic entirely.
7. Verify Router IGMP Snooping Settings
Some routers use IGMP snooping to optimize multicast traffic, but misconfigurations can prevent packets from reaching devices. Log into your router and look for IGMP snooping settings—try disabling it temporarily to see if that fixes the issue.
内容的提问来源于stack exchange,提问作者pedwards

