UPWORK/ODESK guru: Tips and Tricks for clients

skype: odesk.by / upwork.link , email: info@odesk.by/upwork.link

Linux – configuring multicast – via C application.

without comments

Configuring the Kernel for multicast

ref: http://www.linuxjournal.com/article/3041

To use multicast, the kernel configuration requires the CONFIG_IP_MULTICAST option to be set.
Use ifconfig to enable and disable all-multicast mode. Disable promisc by running:

ifconfig eth0 -promisc

Enable allmulti mode with the command:

ifconfig eth0 allmulti

As a test, ping any multicast IP address from a remote machine:

ping -I eth0

On the target enabled with allmulti mode, check the RX packets count. Disable allmulti on the target by running:

ifconfig eth0 -allmulti

If allmulti is enabled, the ‘ifconfig eth0’ output displays the keyword ‘ALLMULTI’ in the second line.

Testing multicast

First, make sure that the kernel does not ignore all ICMP ECHO and TIMESTAMP requests sent to it using either broadcast or multicast. On the target, execute the following:

# echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts

( net.ipv4.icmp_echo_ignore_broadcasts

Эта переменная очень близка по смыслу к icmp_echo_ignore_all, только в
данном случае будут игнорироваться ICMP сообщения, отправленные на
широковещательный или групповой адрес. Вполне очевидно, почему полезно
включить этот параметр защита от smurf атак. Переменная может принимать
два значения 0 (выключено) и 1 (включено). Значение по-умолчанию 0
(выключено). )

This sets all class D (that is, multicast) IP routes to use “eth0”:

# route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0

To join a multicast group, execute the following:

# ./mjoin eth0 224.1.0.37

mjoin – small application on C in archive of author (by request).

Ping multicast IP address:

# ping -r -I eth0 224.1.0.37

To display the multicast group membership information on the target:

# netstat -n -g

Written by spectre

May 21st, 2016 at 2:26 pm

Posted in Tips and Tricks