Multicast DNS
[ 1 Address Space ] [ 2 Kernel Support ] [ 3 Interfaces ] [ 4 Testing ] [ 5 Create MCast Groups ] [ 6 Zeroconf ] [ 7 Programming ]
Address Space
Multicast ip addresses run from 224.0.0.0 - 239.255.255.255
. Some of these however are reserved (e.g. 224.0.0.251
for DNS-SD that uses multicast DNS, a.k.a zeroconf). If you’re building your own application, make use of the 239.0.0.0-239.255.255.255
range.
Kernel Support
Confguration is updated by various programs in /etc/resolv.conf
. This is managed by systemd-resolved
and will get cached & overwritten when pursuing activities like vpn.
$ cat /boot/config-<kernel-version> | grep CONFIG_IP_MULTICAST
CONFIG_IP_MULTICAST=y
Interfaces
Introspection:
# Check if an interface is enabled or not
$ ifconfig enp0s31f6 | grep MULTICAST
enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
# Check what multicast groups it is subscribed to
$ ip maddr show enp0s31f6
2: enp0s31f6
....
inet 239.0.0.1
inet 224.0.0.251 users 5
inet 224.0.0.1
# Check all interfaces/group associations
$ netstat -g
IPv6/IPv4 Group Memberships
Interface RefCnt Group
--------------- ------ ---------------------
lo 1 224.0.0.251
lo 1 all-systems.mcast.net
enp0s31f6 5 224.0.0.251
enp0s31f6 1 all-systems.mcast.net
# Get IP's instead of names
$ netstat -ng
IPv6/IPv4 Group Memberships
Interface RefCnt Group
--------------- ------ ---------------------
lo 1 224.0.0.251
lo 1 224.0.0.1
enp0s31f6 5 224.0.0.251
enp0s31f6 1 224.0.0.1
Enable/disable:
$ ifconfig eth0 multicast
$ ifconfig eth0 -multicast
Testing
IPerf:
Ping 224.0.0.1:
Create MCast Groups
Zeroconf
When zeroconf, or more officially named DNS-SD (DNS Service Discovery) uses multicast (it doesn’t have to), it will use IPv4 address 224.0.0.251 or IPv6 address ff02::fb and UDP port 5353.