On 2023-04-29 14:11, Per Jessen wrote:
Per Jessen wrote:
I don't know how easy those inotify tools are to use, but it ought to be fairly easy to monitor for a file called 'dhclient6.*ethX.lease' being written to '/var/lib/NetworkManager/'.
Something like this maybe - explicitly not intended as a ready-to-go solution, only as inspiration:
inotifywait -m /var/lib/NetworkManager/ |\ egrep 'dhclient6[^.]+\.lease$' |\ while read nmdir events nmfile do echo $events $nmfile do-your-stuff-here done
Thanks. But that machine is on wicked, and I need learn the IPs of the machines different than the current one, that originate the packets banging on the firewall. Ie, Isengard is being hit from Telcontar and Beta, on who knows which of their many IPv6 addresses.
Alternatively, there are some dhcp hooks too, I wonder if they might also be called by NetworkManager. /etc/dhcp/dhclient.d
Yes, my laptop does that. /Other/etc/NetworkManager/dispatcher.d/90mine #!/bin/bash $LOGGER -t $TAG -p $FACILIDAD "Inside nm-mine (dispatcher.d/mine), got '$1', '$2', '$3', '$4', '$5'" There are a bunch of inherited vars.
case "$ACCION" in up) $LOGGER -t $TAG -p $FACILIDAD "Connection $CONEXION is going up, uuid: '$CONNECTION_UUID', IPv4.0: '$IP4_ADDRESS_0', IPv4.1: '$IP4_ADDRESS_1', IPv4.2: '$IP4_ADDRESS_2', IPv4.3: '$IP4_ADDRESS_3', IPv4 .4: '$IP4_ADDRESS_4', Domain.4: '$IP4_DOMAINS', DNS: '$IP4_NAMESERVERS', num routes: '$IP4_NUM_ROUTES', route.0: '$IP4_ROUTE_0', route.1: '$IP4_ROUTE_1'" $LOGGER -t $TAG -p $FACILIDAD "Connection $CONEXION, uuid: '$CONNECTION_UUID', DHCP4_HOST_NAME: '$DHCP4_HOST_NAME'"
I don't remember where I got them from, probably "man NetworkManager". -- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)