Algunas verificaciones rápidas sobre multicast en Linux:
Ver si un interfaz está habilitado para tratar multicast
Lo podemos hacer con ifconfig o con el comando ip:
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:23:54:25:6A:53
inet addr:192.168.10.20 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::223:54ff:fe25:6a53/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:665230 errors:0 dropped:0 overruns:0 frame:0
TX packets:200792 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:61768595 (58.9 MiB) TX bytes:40705382 (38.8 MiB)
Interrupt:58
# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:23:54:25:6a:53 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.20/24 brd 192.168.10.255 scope global eth0
inet6 fe80::223:54ff:fe25:6a53/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:23:54:25:69:4d brd ff:ff:ff:ff:ff:ff
inet 192.168.11.100/24 brd 192.168.11.255 scope global eth1
inet6 fe80::223:54ff:fe25:694d/64 scope link
valid_lft forever preferred_lft forever
4: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
Capturar tráfico multicast con tcpdump
# tcpdump -e multicast <<< captura tráfico multicast muestra información ethernet
# tcpdump ip multicast <<< captura tráfico muestra informacion IP
# tcpdump -v multicast <<< modo vervose perimte verificar el valor de TTL
Varificar suscripción a grupos multicast
Hay varias maneras de verificar si una máquina linux se está suscribiendose o no a un grupo multicast.
# ip maddr show
1: lo
inet 224.0.0.1
inet6 ff02::1
2: eth0
link 01:00:5e:40:66:ea
link 01:00:5e:00:00:fb
link 33:33:00:00:00:fb
link 01:00:5e:00:00:01
link 33:33:ff:25:6a:53
link 33:33:00:00:00:01
inet 239.192.102.234 <<<<<<<<<<<
inet 224.0.0.251
inet 224.0.0.1
inet6 ff02::fb
inet6 ff02::1:ff25:6a53
inet6 ff02::1
3: eth1
link 01:00:5e:00:00:fb
link 33:33:00:00:00:fb
link 01:00:5e:00:00:01
link 33:33:ff:25:69:4d
link 33:33:00:00:00:01
inet 224.0.0.251
inet 224.0.0.1
inet6 ff02::fb
inet6 ff02::1:ff25:694d
inet6 ff02::1
[root@localhost ~]#
# netstat -g IPv6/IPv4 Group Memberships Interface RefCnt Group --------------- ------ --------------------- lo 1 224.0.0.1 eth0 1 239.192.102.234 <<<<<<<<<<<<<<<< eth0 1 224.0.0.251 eth0 1 224.0.0.1 eth1 1 224.0.0.251 eth1 1 224.0.0.1 getnameinfo failed lo 1 [UNKNOWN] getnameinfo failed eth0 1 [UNKNOWN] getnameinfo failed eth0 1 [UNKNOWN] getnameinfo failed eth0 1 [UNKNOWN] getnameinfo failed eth1 1 [UNKNOWN] getnameinfo failed eth1 1 [UNKNOWN] getnameinfo failed eth1 1 [UNKNOWN] [root@localhost ~]#
ssmping
ssmping es una utilidad linux que permite verificar la transmisión multicast entre hosts.
En realidad se compone de dos elementos: ssmping y asmping.
ssmping es similar a asmping pero no podemos indicar el grupo y se usa uno por defecto, por lo que asmping es más flexible y útil que ssmping, aunque el nombre de ssmping sea más conocido.
El ssmping o asmping realizan un ping unicast y multicast a destino especificado
1. Emisor multicast –> ./ssmpingd
# ./ssmpingd received request from 192.168.10.20 received request from 192.168.10.20 received request from 192.168.10.20
El equipo que ejecuta ssmping y se queda esperando hasta que recibe una indicación desde el receptor (ssmping o asmping) y entonces empieza a emitir un flujo multicast
2. Receptor multicast (suscriptor a un grupo) ssmping o asmping
Formato: asmping [grupo multicast] [ip equipo servidor]
# ./asmping 239.192.102.234 192.168.120.11 asmping joined (S,G) = (*,239.192.102.234) pinging 192.168.120.11 from 192.168.10.20 unicast from 192.168.120.11, seq=1 dist=1 time=0.250 ms multicast from 192.168.120.11, seq=1 dist=1 time=8.936 ms multicast from 192.168.120.11, seq=1 dist=1 time=19.980 ms (DUP!) unicast from 192.168.120.11, seq=2 dist=1 time=0.204 ms multicast from 192.168.120.11, seq=2 dist=1 time=0.220 ms unicast from 192.168.120.11, seq=3 dist=1 time=0.269 ms