By default Linux ignores Broadcast and Multicast ICMP messages. That's why you need to enable it first:
sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0
To join any mutlicast address (e.g. 224.10.10.10/24
) just add it to your active interface (e.g. eth0
) and append the keyword autojoin
at the end:
ip addr add 224.10.10.10/24 dev eth0 autojoin
Now you can verify the join:
ip -f inet maddr show dev eth0
Finally to test the Multicast communication, ping to the chosen IP address from another host:
ping 224.10.10.10
You should now get an answer from your Multicast enabled host. That's it.
The Linux Kernel normally uses IGMP version 3 to join Multicast groups. If you would rather use IGMP version 2, just change it via the command down here:
echo "2" > /proc/sys/net/ipv4/conf/eth0/force_igmp_version
In order to get the commands above here working inside a Docker container, it must be started with the Linux capability NET_ADMIN
:
docker run --rm -it --cap-add NET_ADMIN alpine /bin/sh
Fun fact: GNS3 starts all containers with all Linux capabilities added and in priviledged mode.
Hi Philip,
thanks for sharing your snippet gist,
I've testing in my ubuntu 21.04
But when i've test ping to 224.10.10.10 its getting error
what's wrong with my config?