# find out ip addr change with dhcpcd-run-hooks

## emc

Hello,

I need some kind automatically notification when dhcpd assign new IP adders to wireless interface.

Asking google it turn out, that dhcpcd-run-hooks can be usefull in this matter, but not sure how to started.

http://roy.marples.name/man/html8/dhcpcd-run-hooks.html

----------

## UberLord

Just to give an idea

```

cat /etc/dhcpcd.exit-hook

showip()

{

        # Report new IP address

        # RA and DHCP6 can assign >1 address but we only report the first one.

        if [ -n "$new_ip_address" ]; then

                echo "$new_ip_address"

        elif [ -n "$new_ra1_addr" ]; then

                echo "$new_ra1_addr"

        elif [ -n "$new_ra1_prefix" ]; then

                echo "$new_ra1_prefix"

        elif [ -n "$new_dhcp6_ia_na1_ia_addr1" ]; then

                echo "$new_dhcp6_ia_na1_ia_addr1"

        elif [ -n "$new_delegated_dhcp6_prefix" ]; then

                echo "$new_delegated_dhcp6_prefix"

        else

                return 1

        fi

}

newip=$(showip)

if [ -n "$newip" ]; then

        echo "$interface: assigned new IP $newip" >>/tmp/newip

fi

```

So the new ip addresses added will be logged into /tmp/newip.

----------

