listing multicast sockets

Sreeram Ravinoothala picture Sreeram Ravinoothala · Apr 9, 2013 · Viewed 33.2k times · Source

I am trying to list all opened multicast sockets on a linux system? netstat -g lists the groups joined though. Is there any other utility that I can use for this sake?

Thanks a lot for the help.

Answer

Johannes Overmann picture Johannes Overmann · Feb 27, 2014

In addition to netstat -g you can use this to see all sockets which are bound to a multicast address:

netstat -anu|sort -nk4

This is a list of all UDP sockets (whether multicast or not). Look for all addresses in the range 224.0.0.0 to 239.255.255.255. These are sockets bound to multicast addresses, regardless whether they joined the multicast group or not. These will only receive traffic for this multicast group.

But:

In practice UDP sockets which are used to receive multicast traffic are usually bound to address 0.0.0.0. These can receive UDP packets for all unicast and multicast addresses, and the server usually does some additional filtering based on the source-IP-address.

So in that list above you may want to look also at UDP sockets bound to 0.0.0.0, for example 0.0.0.0:5353 which is most likely the mDNS (avahi, zeroconf) server.