Skip to content

Commit 53ec912

Browse files
pavel-shirshovyxieca
authored andcommitted
[ntp]: Use loopback address when we don't have MGMT interface (#3566)
Added configuration to use Loopback ip if a switch doesn't have MGMT_PORT.
1 parent 4ab5c2f commit 53ec912

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

files/image_config/ntp/ntp.conf.j2

+8-1
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,19 @@ filegen clockstats file clockstats type day enable
2727
server {{ ntp_server }} iburst
2828
{% endfor %}
2929

30-
#only listen on localhost and eth0 ips (default is to listen on all ip addresses)
30+
#only listen on MGMT_INTERFACE, LOOPBACK_INTERFACE ip when MGMT_INTERFACE is not defined, or eth0
31+
# if we don't have both of them (default is to listen on all ip addresses)
3132
interface ignore wildcard
3233
{% if MGMT_INTERFACE %}
3334
{% for (mgmt_intf, mgmt_prefix) in MGMT_INTERFACE %}
3435
interface listen {{ mgmt_prefix | ip }}
3536
{% endfor %}
37+
{% elif LOOPBACK_INTERFACE %}
38+
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
39+
{% if prefix | ipv4 and name == 'Loopback0' %}
40+
interface listen {{ prefix | ip }}
41+
{% endif %}
42+
{% endfor %}
3643
{% else %}
3744
interface listen eth0
3845
{% endif %}

0 commit comments

Comments
 (0)