Trigger conditional reconnect on WAN (PPPoE)
-
Hello everyone,
I would like to explore the possibility to add a custom script that triggers a reconnection of a PPPoE WAN if the IP received is not of my liking (i.e. if IP is 100.x.x.x then reconnect). I don't think this is possible via the GUI .. but please, feel free to correct me.
Could someone please point me in the right direction?
I was thinking of registering a cron to run each minute for a script like:
#!/bin/bash FIRST_IP_OCT=$(ifconfig | grep -A1 "pppoe0:" | tail -1 | awk '{print $2}' | sed 's/\..*//') if [[ $FIRST_IP_OCT = "100" ]] then /usr/local/sbin/ppp-linkdown /usr/local/sbin/ppp-linkup fi
This is not tested, but you get the idea.
Thanks a lot!