Open telnetdoogie opened 2 years ago
Here is my hack-y workaround. Relying on pinging the tunnel remote end on the minutely cron job and recreating the tunnel if that fails. It isn't great, but works ok for my use case.
root@UDM-SE:~# cat /data/cronjobs/update_ipv6_chains
MAILTO=""
* * * * * root /data/ipv6/configure-he-ipv6-chains.sh | /usr/bin/logger
* * * * * root /data/ipv6/reset_tunnel.sh | /usr/bin/logger
root@UDM-SE:~# cat /data/ipv6/reset_tunnel.sh
#!/bin/bash
if $(ping -c3 -q $(grep '^LOCAL_IPV6=' /data/ipv6/enable-he-ipv6.sh | grep -Eo '([0-9a-f:]{4,})' | sed 's/::2/::1/') > /dev/null); then
echo 'Tunnel he-ipv6 ok';
else
ip tunnel del he-ipv6
bash /data/ipv6/enable-he-ipv6.sh
fi
@MrMarvin this is awesome! Mind if I add this to the repo (I'll add your @ to the comments and contributors) Alternatively, if you want to push a PR to the repo I'll add it
Might be nice to add this to configure-he-ipv6-chains.sh
so two conditions are checked at the same time... The iptables changes, and also the connectivity, and then resolving those in the appropriate order if one or both appears to need attention. This is really good!
Then only one cron entry is needed, maybe I could rename configure-he-ipv6-chains.sh
to a more appropriate maintain-he-ipv6-tunnel.sh
at that point.
ip monitor address
could be a possible trigger.
https://unix.stackexchange.com/questions/552258/ip-monitor-responding-to-events
If your WAN ip changes, the tunnel will stop working and getting it set up again requires deleting the tunnel interface and re-creating it. (annoying)
There's probably an elegant way (perhaps à la inadyn and it's use of
/.inadyn/all.dnsomatic.com.cache
or similar) to check for and detect a change to the WAN IP periodically and if it's changed, remove and re-create thehe-ipv6
interface.