adding mgmt dhcp6 - so we get ntp and dns over ipv6 - and timesyncd dhcp6 exit script

This commit is contained in:
toby 2019-02-23 04:09:55 +00:00
parent fc197c9fce
commit a497c70abe
3 changed files with 47 additions and 3 deletions

View File

@ -12,9 +12,10 @@ files/qemu-ifup etc/libvirt/hooks
files/firewall etc/init.d files/firewall etc/init.d
files/ips.issue etc/issue.d files/ips.issue etc/issue.d
files/wit-logging.conf etc/strongswan.d files/wit-logging.conf etc/strongswan.d
files/lldpd.wit /etc/default files/lldpd.wit etc/default
files/timesyncd6 etc/dhcp/dhclient-exit-hooks.d
templates/wit-swanctl.conf etc/swanctl/conf.d templates/wit-swanctl.conf etc/swanctl/conf.d
templates/frr.conf.wit etc/frr templates/frr.conf.wit etc/frr
templates/70-persistent-net.rules etc/udev/rules.d templates/70-persistent-net.rules etc/udev/rules.d
templates/interfaces /etc/network templates/interfaces etc/network
templates/ipsec.conf.wit etc templates/ipsec.conf.wit etc

View File

@ -213,11 +213,12 @@ case "$1" in
cat <<-EOF >>$IFCONFIG cat <<-EOF >>$IFCONFIG
auto $ifname auto $ifname
iface $ifname inet6 auto iface $ifname inet6 auto
iface $ifname inet dhcp
pre-up /bin/ip link add mgmt type vrf table mgmt pre-up /bin/ip link add mgmt type vrf table mgmt
pre-up /bin/ip link set up dev mgmt pre-up /bin/ip link set up dev mgmt
pre-up /bin/ip link set master mgmt dev $ifname pre-up /bin/ip link set master mgmt dev $ifname
post-down /bin/ip link del dev mgmt post-down /bin/ip link del dev mgmt
iface $ifname inet6 dhcp
iface $ifname inet dhcp
EOF EOF

42
files/timesyncd6 Normal file
View File

@ -0,0 +1,42 @@
TIMESYNCD_CONF=/run/systemd/timesyncd.conf.d/01-dhclient6.conf
timesyncd_servers_setup_remove() {
if [ -e $TIMESYNCD_CONF ]; then
rm -f $TIMESYNCD_CONF
systemctl try-restart systemd-timesyncd.service || true
fi
}
timesyncd_servers_setup_add() {
if [ ! -d /run/systemd/system ]; then
return
fi
if [ -e $TIMESYNCD_CONF ] && [ "$new_dhcp6_sntp_servers" = "$old_dhcp6_sntp_servers" ]; then
return
fi
if [ -z "$new_dhcp6_sntp_servers" ]; then
timesyncd_servers_setup_remove
return
fi
mkdir -p $(dirname $TIMESYNCD_CONF)
cat <<EOF > ${TIMESYNCD_CONF}.new
# NTP server entries received from DHCP server
[Time]
NTP=$new_dhcp6_sntp_servers
EOF
mv ${TIMESYNCD_CONF}.new ${TIMESYNCD_CONF}
systemctl try-restart systemd-timesyncd.service || true
}
case $reason in
BOUND|BOUND6|RENEW|RENEW6|REBIND|REBIND6|REBOOT|REBOOT6)
timesyncd_servers_setup_add
;;
EXPIRE|EXPIRE6|FAIL|FAIL6|RELEASE|RELEASE6|STOP|STOP6)
timesyncd_servers_setup_remove
;;
esac