3

I am running a Linux server (openSUSE) behind a router and would like to run a script when the ipv6 address of the server changes (for example because the router gets a new prefix from my provider).

The server is using the wicked network daemon.

I tried adding the script to /etc/dhcp/dhclient.d/, but that did not work.

uli
  • 53
  • 2
  • 6
  • 3
    First, yell very loudly at your ISP. No business Internet connection should be changing its IPv6 prefix without notice. This is an extremely disruptive event that needs to be coordinated with the customer (that's you). – Michael Hampton Jun 07 '19 at 18:37

1 Answers1

4

You can use the ip -6 monitor address command to feed an event loop.

This could look like this in shell. Probably an other language than shell might be easier:

ip -6 monitor | while read word1 otherparms; do
    case "$word1" in
        Deleted)
            ....
            ;;
        somethingelse)
            ....
            ;;
done
A.B
  • 9,037
  • 2
  • 19
  • 37