I ran into a puzzling problem when trying to receive a multicast IP (of a video from 239.193.140.11:1234).
When $tcpdump dst 239.193.140.11 -w capturedData.pcap
, the packets are captured correctly.
eg, 11:05:25.357138 IP 192.168.34.34.46192 > 239.193.140.11.1234: UDP, length 1328
This means that my machine is receiving the multicast IP packets.
However, when $iftop -i any
is run, iftop doesn't show any bandwidth from 239.193.140.11. Furthermore, when I try to capture the multicast packets with ffmpeg: $ffmpeg -i udp://239.193.140.11:1234?localaddr=192.168.34.34
, no packets are captured.
Why is there a discrepancy between what tcpdump and iftop shows, and how to resolve it so that ffmpeg can capture correctly?
Looks like Reverse Path Filter (rp_filter) is enabled, which is rejecting the packets. From my experience in a PROD environment, I can say that disabling the rp_filter enabled my client/listener application to pick up the packets. Use the below command to disable rp_filter:
$echo 0 > /proc/sys/net/ipv4/conf/eth0/rp_filter
In the above, replace 'eth0' with the interface receiving the multicast if other than eth0, or alternately edit the rp_filter file and set the value to '0'