RHEL : What is Multicast and how to configure Network interface with Multicast Address?

Multicasting in Red Hat Enterprise Linux Multicast is method of sending IP packetes  to a group of interested receivers.  Compared with broadcast, the packets are only sent to the members  of a multicast group with the help of multicast router.

What IP Addresses can be used for Multicast purpose?

Class D addresses (224.0.0.0 – 239.255.255.255) are assigned to multicast. So the first 4 bits of a multicast address should be 1110 and the remaining 28 bits represent different goups.  Some addresses are reserved and have been assigned to specified groups. In Simple:
 
   Bit –>  0                           31            Address Range:
           +-+—————————-+
           |0|       Class A Address      |       0.0.0.0 – 127.255.255.255
           +-+—————————-+
           +-+-+————————–+
           |1 0|     Class B Address      |     128.0.0.0 – 191.255.255.255
           +-+-+————————–+
           +-+-+-+————————+
           |1 1 0|   Class C Address      |     192.0.0.0 – 223.255.255.255
           +-+-+-+————————+
           +-+-+-+-+———————-+
           |1 1 1 0|  MULTICAST Address   |     224.0.0.0 – 239.255.255.255
           +-+-+-+-+———————-+
           +-+-+-+-+-+——————–+
           |1 1 1 1 0|     Reserved       |     240.0.0.0 – 247.255.255.255
           +-+-+-+-+-+——————–+
Additionally,
  • -> 224.0.0.1 — all hosts group,  all hosts configured IP multicast will join this group when an interface starts up.
  • -> 224.0.0.2 — all multicast routers group
  • -> 224.0.0.22 — IGMP Multicast router.  An IGMP member report will be sent this addresses when a host joins a multicast group, then the multicast router can receive that report and maitain the membership of a group.  We can capture the following packet when a program join the multicast group 225.0.0.37.

How to enable or disable multicst for a NIC

Enable Multicast for eth0:
# ifconfig eth0 multicast
 
# 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 for eth0: 
# ifconfig eth0 -multicast  
# ifconfig eth0
 eth0      Link encap:Ethernet  HWaddr 00:0C:34:FE:AB:6A   
 inet addr:10.0.0.100  Bcast:10.0.0.255  Mask:255.255.255.0
 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
 
Other useful command to test Multicast Configuration:
    Command                                 Description
  • cat /proc/net/igmp                 List multicast group to which the host is subscribed. Use “Internet Group Management Protocol”.
  • cat /proc/net/dev_mcast    List multicast interfaces.
  • ping -L  239.192.104.2           To check connectivity with another multicast address
  • ping -L 224.0.0.1                      All hosts configured for multicast will respond with their IP addresses
  • ping 224.0.0.2                           All routers configured for multicast will respond
  • ping 224.0.0.3                           All PIM routers configured for multicast will respond
  • ping 224.0.0.4                           All DVMRP routers configured for multicast will respond
  • ping 224.0.0.5                           All OSPF routers configured for multicast will respond
Check If Multicast enabled in the kernel or not:
 #grep -i multi /boot/config-<Kernel version>
         * CONFIG_IP_MULTICAST=y    <–
         * CONFIG_IP_ROUTER=y
         * CONFIG_IP_MROUTE=y
         * CONFIG_NET_IPIP=y

Configuring Map Network Interface to Send Multicast Traffic

To Configure a NIC to send multicast network, we need to add a default route for muticast traffic , to the specific NIC.  For example, Below command will allow eth0 to send multicast traffic:
# route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
And check the route settings with
#  route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.1     0.0.0.0         255.255.255.0   U     0      0        0 eth0
224.0.0.0       0.0.0.0         240.0.0.0       U     0      0        0 eth0
0.0.0.0         192.168.0.254   0.0.0.0         UG    0      0        0 eth0

How to Verify the Mutlicast groups in our current system

# netstat -g
IPv6/IPv4 Group Memberships
Interface       RefCnt Group
————— —— ———————
lo              1      all-systems.mcast.net
bond0           1      239.192.153.137
bond0           2      all-systems.mcast.net
$ cat proc/net/igmp  
Idx     Device    : Count Querier       Group    Users Timer    Reporter  
1       lo        :     0      V2  
                                010000E0     1 0:00000000               0  
2       eth0      :     2      V2  
                                9B9B9BEA     1 0:00000000               1  
                                010000E0     1 0:00000000               0  
4       eth2      :     1      V2  
                                010000E0     1 0:00000000               0  
5       eth3      :     1      V2  
                                010000E0     1 0:00000000               0
Above output shows that eth0 interface configures with Multicast address 9B9B9BEA = 234.155.155.155  ( that means – EA = 234; 9B = 155; 9B = 155; 9B = 155 ). Same information will be reflected from the file /proc/net/igmp
Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us