Skip to content
Advertisement

Detect IP-Address change on an interface

I would like to trigger a service when a change of an ip address on a specific interface occurs. Is there a target for this or some other method I am not aware of to achieve this using systemd on Linux (Kernel 3.19)?

The service would be used to send a SIGNAL to a defined process. The Linux is running on an embedded system.

Thanks!

Advertisement

Answer

Because you use Systemd you might already use systemd-networkd for managing your devices instead of relying on 3rd party code.

You could use the structured journal output to get the last 2 ADDRESS field of the current BOOD_ID.(sadly, there is no notification mechanism for address changes in systemd-networkd):

→ sudo journalctl -F ADDRESS -u systemd-networkd -n 2
192.168.178.29

So, if there is only one line output, there was no address change.

Advertisement