I have eth0 device and tun0 device (VPN) and I would like to automatically detect if any of these devices changes status, i.e. they are up or down.
In each case, I would like to automatically call a predefined script. So:
- if eth0 goes down, I would like to call script 1
- if tun0 goes down, script 2
- if tun0 goes up, script 3
How to do that with NetworkManager?
For tun0, I can use /etc/network/interfaces
:
auto tun0
iface tun0 inet manual
up /bin/sh /home/matej/tun-up.sh
down /bin/sh /home/matej/tun-down.sh
What about eth0, since network is managed by Network Manager?