Post técnico de la semana.
Me he encontrado con una duda sobre cómo averiguar qué VRRPs IDs están anunciándose en una red. Esto es relativamente importante controlarlo porque si en un momento dado añades un nuevo equipo que anuncie un VRRP ya usado, se puede liar gorda.
Si tienes acceso root a una máquina que esté pinchada en esa red, puedes utilizar tcpdump para descubrir los anuncios de VRRP.
Existen 3 formas que nos devuelven el mismo resultado:
tcpdump -i <interface> host 224.0.0.18 tcpdump -i <interface> proto 112 tcpdump -i <interface> ether dst 01:00:5e:00:00:12
Donde “<>” es la interfaz de red en la que quieres chequear, “host 224.0.0.18” es el host destino del tráfico VRRP, “proto 112” es el protocolo VRRP y la MAC “01:00:5e:00:00:12” en la dirección MAC de broadcast de VRRP.
Ejemplo:
[root@host53n01:~]# tcpdump -i eth4 -i eth5 proto 112 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth5, link-type EN10MB (Ethernet), capture size 96 bytes 10:42:21.099775 IP 10.203.12.132 > 224.0.0.18: VRRPv2, Advertisement, vrid 70, prio 150, authtype none, intvl 1s, length 20 10:42:21.114600 IP 10.203.12.130 > 224.0.0.18: VRRPv2, Advertisement, vrid 202, prio 150, authtype none, intvl 1s, length 20 10:42:21.514168 IP 10.203.12.137 > 224.0.0.18: VRRPv3, Advertisement 10:42:21.514169 IP 10.203.12.137 > 224.0.0.18: VRRPv2, Advertisement, vrid 50, prio 255, authtype none, intvl 1s, length 20 10:42:21.891698 IP 10.203.12.132 > 224.0.0.18: VRRPv2, Advertisement, vrid 70, prio 150, authtype none, intvl 1s, length 20 10:42:22.114708 IP 10.203.12.130 > 224.0.0.18: VRRPv2, Advertisement, vrid 202, prio 150, authtype none, intvl 1s, length 20 10:42:22.526551 IP 10.203.12.137 > 224.0.0.18: VRRPv3, Advertisement 10:42:22.526769 IP 10.203.12.137 > 224.0.0.18: VRRPv2, Advertisement, vrid 50, prio 255, authtype none, intvl 1s, length 20 10:42:22.820480 IP 10.203.12.132 > 224.0.0.18: VRRPv2, Advertisement, vrid 70, prio 150, authtype none, intvl 1s, length 20 10:42:23.114625 IP 10.203.12.130 > 224.0.0.18: VRRPv2, Advertisement, vrid 202, prio 150, authtype none, intvl 1s, length 20 10:42:23.513211 IP 10.203.12.137 > 224.0.0.18: VRRPv3, Advertisement 10:42:23.513213 IP 10.203.12.137 > 224.0.0.18: VRRPv2, Advertisement, vrid 50, prio 255, authtype none, intvl 1s, length 20 10:42:23.577365 IP 10.203.12.132 > 224.0.0.18: VRRPv2, Advertisement, vrid 70, prio 150, authtype none, intvl 1s, length 20 10:42:24.114488 IP 10.203.12.130 > 224.0.0.18: VRRPv2, Advertisement, vrid 202, prio 150, authtype none, intvl 1s, length 20 10:42:24.387004 IP 10.203.12.132 > 224.0.0.18: VRRPv2, Advertisement, vrid 70, prio 150, authtype none, intvl 1s, length 20
Filtrar por VRRP ID específico
Cada grupo de máquinas que participan en un VRRP tienen un VRRP ID asignado. Éste debe ser único por grupo de máquinas y por interfaz. Si quieres escuchar los heartbeats específicos de un VRRP ID, tienes que ejecutar:
tcpdump -i <interface> ether src 00:00:5e:00:01:
Donde “<VRID>” es el VRRP ID en hexadecimal.