Monitor Multicast UDP Traffic

Recently I was diagnosing problems with missing multicast data for some system. Multicast send UDP packets from single source to many registered subscribers. IPTV is using this feature to stream video for example. For unicast (1-1) transmissions you can use netcat or telnet but what tool can test multicast data?

The answer was located pretty quickly: socat tool can register to multicast sources and pipe output to many destinations (stdout for example). Let's give a sample first:

socat UDP4-RECVFROM:9875,ip-add-membership=225.2.215.254:0.0.0.0,fork -\
 | grep -a '^s='

Values to change:

  • 225.2.215.254: sample multicast IP address
  • 9875: sample multicast port
  • ^s=: string to be located in multicast data (in my case data protocol is textual)

Explanation:

  • UDP4-RECVFROM: receive IPv4 UDP packets
  • ip-add-membership: multicast requires registering of packets receiver
  • 0.0.0.0: accept multicast on any client interface (you can specify here your client network address here as well)
  • grep -a: sometimes you need just subset of incoming data, in my case textual data was mixed with binary (-a parameter for grep)
This entry was posted in en and tagged , . Bookmark the permalink.

3 Responses to Monitor Multicast UDP Traffic

  1. Ed says:

    Sorry, I did not understand your post. What was the answer to this problem?

    I am having problems with UDP multicasts originating from certain machines * always * sending multicast packets containing zero data bytes and other machines intermittently sending multicast packets containing zero data bytes.

    Thanks for your post,

  2. dariusz.cieslak says:

    "socat" only can check multicast stream availability. If your multicast data is not traveling properly across network you have to check router-by-router to locate problematic point in the network (seems a network problem based on your description).

  3. Matthew says:

    This was extremely useful and actually clear, much easier to use than other examples I was given that did not explain the parameters.

Comments are closed.