How can I know if IP Multicast is enabled

212,876

Solution 1

It seems the most kernels(post v1) do support multicast by default or have CONFIG_IP_MULTICAST enabled while compiling. To check whether the compiled and running kernel subscribes to any multicast group, I would use netstat -g.

It seems the most kernels(post v1) do support multicast by default.

[root@centos module]# grep CONFIG_IP_MULTICAST /usr/src/kernels/2.6.18-274.7.1.el5-i686/.config 
CONFIG_IP_MULTICAST=y
[root@centos module]# netstat -g
IPv6/IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      all-systems.mcast.net
eth0            1      224.0.0.251
eth0            1      all-systems.mcast.net

I see that eth0 interface on my host thinks its subscribed 224.0.0.251 basic mcast group . Also alternatively, if I ping the group or the network and then all the known multicast enabled host networks are returned to me, I would say multicast is working on the host. Can you try netstat -g or cat /proc/net/igmp and see if it returns any groups on your host?

Solution 2

On your linux box: ip maddr show gives:

@4Gtest ~]$ ip maddr show
1:      lo
        inet  224.0.0.1
        inet6 ff02::1
2:      p3p1
        link  01:00:5e:00:00:01
        link  33:33:00:00:00:01
        link  33:33:ff:bd:7e:0f
        link  01:00:5e:00:00:fb
        link  01:00:5e:7f:ff:05
        inet  224.127.255.5
        inet  224.0.0.251
        inet  224.0.0.1
        inet6 ff02::1:ffbd:7e0f
        inet6 ff02::1

Solution 3

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:F1:FF:EA  
inet addr:78.46.74.27  Bcast:78.46.74.31  Mask:255.255.255.224
inet6 addr: fe80::20c:29ff:fef1:ffea/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500  Metric:1
RX packets:5339836 errors:0 dropped:0 overruns:0 frame:0
TX packets:5486444 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:820300389 (782.2 MiB)  TX bytes:1929979381 (1.7 GiB)
Base address:0x1400 Memory:e8820000-e8840000

Disable Multicast:

ifconfig eth0 -multicast

result:

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:F1:FF:EA  
inet addr:78.46.74.27  Bcast:78.46.74.31  Mask:255.255.255.224
inet6 addr: fe80::20c:29ff:fef1:ffea/64 Scope:Link
UP BROADCAST MTU:1500  Metric:1
RX packets:5339836 errors:0 dropped:0 overruns:0 frame:0
TX packets:5486444 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:820300389 (782.2 MiB)  TX bytes:1929979381 (1.7 GiB)
Base address:0x1400 Memory:e8820000-e8840000

No Multicast present in the interface

Enable Multicast :

ifconfig eth0 multicast

Solution 4

Using the ip command one can check if an interface is multicast capable by:

ip link show eth0 | grep MULTICAST

To enable or disable multicast you can use:

sudo ip link set dev eth0 multicast [on|off] 
Share:
212,876

Related videos on Youtube

Mike Pennington
Author by

Mike Pennington

Updated on September 18, 2022

Comments

  • Mike Pennington
    Mike Pennington over 1 year

    I have scripts that run IP multicast tests; however, my scripts are failing on a particular linux machine.

    I know that I can look at CONFIG_IP_MULTICAST in the kernel configuration file to determine whether the kernel was compiled with this. However, it would be easier to flag missing requirements in my script if I could look at /proc or sysctl and get the answer.

    Is there a way to find if IP Multicast was compiled into the kernel without looking at CONFIG_IP_MULTICAST?

  • Nils
    Nils over 12 years
    But how do you determine, if the router that box is connected to supports multicast?
  • Nikhil Mulley
    Nikhil Mulley over 12 years
    Multicasting -- the sender sends a single datagram from its unicast address to the multicast group address and intermediary routers take care of making copies and sending them to all receivers that have joined the corresponding multicast group.
  • Nikhil Mulley
    Nikhil Mulley over 12 years
    If Yes, router needs to support the multicasting then. However, for senders/receivers it works on IGMP and for routers, its Protocol Independent Multicast (PIM). Router that supports PIM, usually enabled, and multicast group -- 224.0.0.0/4. Try putting up another pc listening in group at other end & send data to multicast group & check if receiver at the otherend receives data.Ify,router network does support multicasting.Few tools online: imj.ucsb.edu/mcast_detective (windows)
  • Mike Pennington
    Mike Pennington over 11 years
    It should be mentioned that ifconfig is now deprecated in linux... we should be using the iproute2 utilities.
  • Askar
    Askar over 9 years
    It has been 2 years and we're still using ifconfig
  • pevik
    pevik over 7 years
    @oscar but that doesn't mean that it's good to do so as ip and other utilities from iproute2 are reflecting recent changes in Linux kernel networking code (unlike ifconfig).
  • A R
    A R over 6 years
    How to add a muticast group to an interface?
  • Daniel Griscom
    Daniel Griscom about 4 years
    Another five years... ifconfig still in my toolkit, but not sayin' it should be...