fix-ip6-default-route.sh: Added script to monitor IPv6 default route master
authorMegaBrutal <code+git@megabrutal.com>
Fri, 5 Jan 2018 08:30:00 +0000 (09:30 +0100)
committerMegaBrutal <code+git@megabrutal.com>
Fri, 5 Jan 2018 08:30:00 +0000 (09:30 +0100)
commite4171acc6f48a4fffb60f7d877f00f92af5019d7
treedfbc3cb5c1cb1766458f81d23aaa44556d277cac
parent7447893196d364b8a567225c00353c200284f7a7
fix-ip6-default-route.sh: Added script to monitor IPv6 default route

Added a Debian/Ubuntu specific script to check the IPv6 default route
of the host, whether it is absent or configured from RA while it is
supposed to be static.

This is necessary because LXC containers are often affected by a
race condition, when the interface has a static config, but it gets
a default route through Router Advertisement before RAs get disabled.

For reference:
https://www.mail-archive.com/lxc-users@lists.linuxcontainers.org/msg07776.html
https://github.com/lxc/lxd/issues/3582

Although a bit messy, this script is intended to be fool-proof, so
it does not do any harm if it is run on a host where it has no use
to run. So you can deploy it to all LXC containers in your uniform
environment where RA, DHCPv6 and statically configured containers
may co-exist. It is advised to schedule this script (e.g. with cron)
to have it periodically check the IPv6 default route. Unless the -v
(verbose) option is supplied, the script should only have output
when it does some action, otherwise it's silent.

The script checks whether there are only static IPv6 interface
configurations listed in /etc/network/interfaces. If any interface
is automatically configured on purpose, the script stops (as it is
assumed the host is supposed to get its default route through
automatic configuration). If only static inet6 interface configs
exist and a default route is clearly defined, it checks the IPv6
default route. If there is no default route, or it is received
from RA, the script resets the interface and reconfigures it with
ifup.

        new file:   host/fix-ip6-default-route.sh
host/fix-ip6-default-route.sh [new file with mode: 0755]