I have a multiple interfaces that are network connected. I want to be able to configure routes for this so that no matter what is plugged in or connected it doesn't have to be restarted or any commands run on the command line. the problem I am running into is that whenever the Ethernet cable is unplugged the interface stays up. I either need that interface to go down or to be able to run a script that runs when it is unplugged so I can remove the route to that device.
This is my /etc/network//interfaces file
#WAN auto enp5s0f1 iface enp5s0f1 inet dhcp up route add default gw 10.20.30.1 down route del default gw 10.20.30.1 #LAN auto enp5s0f2 iface enp5s0f2 inet static address 192.168.123.254 network 192.168.123.0 netmask 255.255.255.0 broadcast 192.168.123.255 iface tap0 inet static up route add -net 10.20.0.0/24 netmask 255.255.255.0 gw 10.20.2.248 iface ppp0 inet dhcp metric 10
Any help would be greatly appreciated.