From 6732df1edd632b56d3d02970939f51d05d4262e9 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 4 Jul 2022 20:23:27 +0200 Subject: ntp: T4456: support listening on specified interface When clients only use DHCP for interface addressing we can not bind NTPd to an address - as it will fail if the address changes. This commit adds support to bind ntpd to a given interface in addition to a given address. set system ntp interface --- data/templates/ntp/ntpd.conf.j2 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'data/templates/ntp/ntpd.conf.j2') diff --git a/data/templates/ntp/ntpd.conf.j2 b/data/templates/ntp/ntpd.conf.j2 index da610051e..8921826fa 100644 --- a/data/templates/ntp/ntpd.conf.j2 +++ b/data/templates/ntp/ntpd.conf.j2 @@ -33,10 +33,17 @@ restrict {{ address | address_from_cidr }} mask {{ address | netmask_from_cidr } {% endfor %} {% endif %} -{% if listen_address %} +{% if listen_address is vyos_defined or interface is vyos_defined %} # NTP should listen on configured addresses only interface ignore wildcard -{% for address in listen_address %} +{% if listen_address is vyos_defined %} +{% for address in listen_address %} interface listen {{ address }} -{% endfor %} +{% endfor %} +{% endif %} +{% if interface is vyos_defined %} +{% for ifname in interface %} +interface listen {{ ifname }} +{% endfor %} +{% endif %} {% endif %} -- cgit v1.2.3