How to enable multicast to IP address?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux
  • IP Multicast

Issue

  • How to enable multicast to IP address?
  • How do I assign a multicast address to a given interface?
  • I need help on adding multicast IP on my NIC
  • I have run command ip maddr add 239.0.0.1 dev eth0 but IP is not showing on interface

Resolution

A multicast IP address cannot be added to a network interface by a system administrator.

The add and remove of the multicast address is controlled by the application which will listen for the multicast traffic.

Methods of testing multicast are provided at:

You may confirm an interface is able to perform multicast by looking for the presence of the MULTICAST flag on the interface, which is enabled by default, eg:

# ip addr
2: net0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
                    ^^^^^^^^^

You may view current multicast subscription state with the ip maddr command, eg:

# ip maddr
2:      net0
        link  33:33:00:00:00:01
        inet  224.0.0.1

There will almost always be some multicast subscriptions by default, due to how various network protocols work. This is expected and normal.

Root Cause

For application developers, multicast programming on Linux is described at:

However it is common for higher-level langages (eg: Java) to use their own networking library to interact with the kernel and provide a simplified object to the application developer, eg:

Reserved and allowed addresses and ranges are documented by the IANA at:

It is recommended to always obey the IANA ranges and not to misuse the incorrect range.

If using multicast internally within your own network (not over the internet) the appropriate address range is most likely to be 239.0.0.0-239.255.255.255 - Organization-Local Scope.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

2 Comments

Quick question: Is the following command persisted across reboots?
ifconfig lo multicast

If not, what is the best way to persist this setting?

Hummm... It may be: ifconfig ethX | grep -i multi