Dumping multicast UDP stream with socat

17,099

tcpdump invoked without -p switches a NIC into promisc mode - apparently some higher level filtering kicks in, preventing socat from receiving the traffic.

One of the "usually guilty" suspects is rp_filter - do you have a route for both the source networks via eth1? I guess you might have default gw via eth0. Either add the missing route, or disable rp_filter on eth1 interface.

In OP case:

ip r a 192.168.85.0/24 dev eth1

or

sysctl -w net.ipv4.conf.eth1.rp_filter=0
Share:
17,099

Related videos on Youtube

Milan Fabian
Author by

Milan Fabian

Developer, Raspberry Pi and Java enthusiast Fan of most things that moves: electrons, cars, aircrafts, spacecrafts https://www.milanfabian.com/

Updated on September 18, 2022

Comments

  • Milan Fabian
    Milan Fabian over 1 year

    I am setting up video streaming.

    In local network, there are two devices streaming video over UDP multicast. One is regular computer with Linux (streaming to 239.220.221.10, port 9200), second one is special DVB-S streamer (streaming to 239.220.220.32, port 9200). There are several IPTV set-top boxes in the network, which are able to play streams from either source. There are also some Cisco switches for multicast filtering, but I am not able to check their configuration.

    On different computer (running Ubuntu 12.04) I would like to capture the stream, preferably using VLC or FFMPEG. From the computer streamer (239.220.221.10) it works, but from special streamer (239.220.220.32) I get no stream.

    What I tried

    I tried to narrow down the problem and tried to capture raw UDP datagrams with socat and tcpdump. If I run following command, I get valid video in video.dump file:

    > socat UDP4-RECVFROM:9200,ip-add-membership=239.220.221.10:0.0.0.0 - > video.dump
    

    When I simultaneously run tcpdump, I see incoming datagrams:

    > sudo tcpdump -i eth1 
    18:00:39.059824 IP 10.1.2.202.41852 > 239.220.221.10.9200: UDP, length 1316
    18:00:39.060789 IP 10.1.2.202.41852 > 239.220.221.10.9200: UDP, length 1316
    ...
    

    When I try to run same commands for the special streamer (just change the IP membership address for socat to 239.220.220.32), tcpdump shows incoming datagrams from 239.220.220.32, but video.dump file is empty.

    What can be the reason that socat doesn't see the datagrams that are clearly coming?

    Update on 4 March 2014:

    I just found out that there are different IP ranges in the network:

    Computer streamer: 10.1.2.202 / 255.0.0.0
    "Special" streamer: 192.168.85.5 / 255.255.255.0
    Computer on which I am trying to grab stream: 10.1.2.203 / 255.0.0.0
    

    When I change IP address of the last to 192.168.85.x / 255.255.255.0, I can catch streams from the "Special" streamer, but not from the computer streamer.

    So the question changes to: is it possible to set socat, VLC or FFMPEG to accept also multicast streams that have a source address outside the range of the Ethernet interface?

    • Admin
      Admin about 10 years
      The packets are sent to the multicast group 239.220.221.10 but you are telling socat to join group 239.220.220.10. Could this be the problem?
  • Milan Fabian
    Milan Fabian almost 6 years
    Yes, the problem was in missing route, I just forgot to update the question. Thank you.