Joined: 18 Mar 2014 Posts: 4866 Location: Netherlands
Posted: Sat Jul 27, 2019 17:02 Post subject:
I do not have IPv6 so can not write a script for you but there is the ping6 command so a script would look something like this, but I do not even know if dhcp6c is a service so just guessing, but this would give you a start.
(I use this kind of script to check my VPN tunnel and restart VPN when the tunnel is down)
logger "Start $(basename $0)"
SLEEP=300 # time (in secs) between each pass
while sleep $SLEEP; do
logger "sleep $SLEEP $(basename $0)"
while ! ping6 -c1 -w3 google.com > /dev/null 2>&1; do
logger "$(basename $0) IPv6 is down, DHCPc6 will be restarted"
)2>&1 | logger -t $(basename $0)[$$]
Posted: Sat Jul 27, 2019 22:20 Post subject: I think that will work
Thanks! I did not know about stopservice / startservice which must be a special dd-wrt thing, running the C code that applies nvram configuration to the various services. Those commands do work to stop and start dhcp6c.
For my script, instead of a ping I will try running
ip -6 route | grep default via
to make sure the router still knows where to forward ipv6 packets, or just use `ps` to make sure dhcp6c is still running.