Low Orbit Flux Logo 2 D

Linux - How to Join Multicast Group

Joining a multicast group from Linux is easy ( sort of ). I’ve done minimal testing so use this information at your own risk.

To join a multicast group on Linux, just start listening on a UDP port using a multicast IP address like this:

mreceive -g -p 2222

For more details about how to use this tool, keep reading.

Enabling / Disabling on an Interface

Assuming your interface is named ‘eno2’ you can use the following.

Check if multicast is enabled on an interface. If it is enabled you will see the word “MULTICAST” otherwise you won’t.

ifconfig eth0 | grep -i multi

Enable multicast on an interface:

ifconfig eno2 multicast

Disable multicast on an interface:

ifconfig eno2 -multicast

IP Ranges and Groups

Ranges: – Class D addresses are used for multicast - Reserved for local use, never forwarded - Reserved for administrative scoping

Groups: all hosts group all multicast routers group all DVMRP routers all OSPF routers
224.0.013 all PIM routers

To find all hosts with multicast enabled, run:


Setting Up Multicast on Linux

I believe this will give you a multicast router. You may need to enable routing in the kernel. I haven’t tested this.

Enable multicast on the interface like this:

ifconfig eno2 multicast

Add a route for a class D network:

route add -net dev eno2

Sniff multicast traffic on this interface. If you see any packets it is working:

tcpdump -i eno2 ip multicast

The following will show multicast addresses:

ip maddress show


There is a nice tool for testing multicast. You can find it on GitHub here:

Linux Multicast Info

You can pull down the zip file here:

Linux Multicast Info

On the first terminal, run the following command. This will start listening on port 2222. It also joins the multicast group

./mreceive -g -p 2222

On the second terminal, run the following command:

ip maddress show | grep

It should show the IP of indicating that it has joined that group.

Now start sending packets from the second terminal like this:

./msend -g -p 2222 -t 8 -text "test"

You should see these coming through and being output on the first terminal.

Once you’ve done this you can verify that it is no longer a member of the group like this:

ip maddress show | grep

You should see that it now displays nothing indicating that it has left the group. As soon as the receive command stops, it will leave the group.


It is worth noting that ssmping is a tool that some people use to test multicast networks. I don’t have a ton of background with this tool but some people find it useful.