diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-07-04 20:23:27 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2022-07-04 20:36:35 +0200 |
commit | 2aab1a726a2083e943df1f6c4200e1ba30b50f33 (patch) | |
tree | 4074cfb6bcd8fe1ba99fc4bdf9982b16c9a68516 /data/templates/ntp | |
parent | f315714d0c680ad80a79dcdac21576407794dcd1 (diff) | |
download | vyos-1x-2aab1a726a2083e943df1f6c4200e1ba30b50f33.tar.gz vyos-1x-2aab1a726a2083e943df1f6c4200e1ba30b50f33.zip |
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 <name>
(cherry picked from commit 6732df1edd632b56d3d02970939f51d05d4262e9)
Diffstat (limited to 'data/templates/ntp')
-rw-r--r-- | data/templates/ntp/ntpd.conf.tmpl | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/data/templates/ntp/ntpd.conf.tmpl b/data/templates/ntp/ntpd.conf.tmpl index e7afcc16b..30bfd575d 100644 --- a/data/templates/ntp/ntpd.conf.tmpl +++ b/data/templates/ntp/ntpd.conf.tmpl @@ -33,10 +33,17 @@ restrict {{ address|address_from_cidr }} mask {{ address|netmask_from_cidr }} no {% endfor %} {% endif %} -{% if listen_address %} +{% if listen_address is defined or interface is defined %} # NTP should listen on configured addresses only interface ignore wildcard -{% for address in listen_address %} +{% if listen_address is defined %} +{% for address in listen_address %} interface listen {{ address }} -{% endfor %} +{% endfor %} +{% endif %} +{% if interface is defined %} +{% for ifname in interface %} +interface listen {{ ifname }} +{% endfor %} +{% endif %} {% endif %} |