Linux won't send multicast packets to interface

I have a server on VPN configured as a TAP device (as opposed to TUN, since it is joining to a wider network). I can send unicast traffic of that network, as well as receive multicast packets (and reply to them).

But, the issue comes when I send multicast packets. For instance, if I issue:

echo "hello" | nc -u 224.0.0.251 5354 -w 1

while watching

tcpdump -i tap0 -w test.pcap

No packets are sent.

But if I for instance say: echo "hello" | nc -ub 192.168.1.255 packets come through without issue.

I can look in ip maddr show and see

3:      tap0
        inet  224.0.0.251

If I use a regular C socket, and send data to 224.0.0.251, no data appears in the packet capture or on the network.

For background – I am using debian with systemd, and I have enabled multicast on the interface.

[Match]
Name=tap0

[Network]
DNS=127.0.0.67
Domains=local
DHCP=yes
Multicast=yes
MulticastDNS=yes
LLMNR=no

It is visible in ifconfig

tap0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.170  netmask 255.255.255.0  broadcast 192.168.1.255

I also monitored /proc/net/dev and there are no packets or dropped packets going through tap0 when I try sending packets.

What am I missing? What needs to be different to send multicast packets on my interface?

Asked By: Charles Lohr

||

It’s probably because the interface lacks a route to do multicasting on.

Try sudo ip route add 224.0.0.0/4 dev tap0 to add the multicast route to tap0 device.

Answered By: vidarlo