[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.
This commit is contained in:
pavel-shirshov 2019-10-07 07:49:25 -07:00 committed by lguohan
parent 50cfa77243
commit 9b8f5c9c9a

View File

@ -27,12 +27,19 @@ filegen clockstats file clockstats type day enable
server {{ ntp_server }} iburst server {{ ntp_server }} iburst
{% endfor %} {% endfor %}
#only listen on localhost and eth0 ips (default is to listen on all ip addresses) #only listen on MGMT_INTERFACE, LOOPBACK_INTERFACE ip when MGMT_INTERFACE is not defined, or eth0
# if we don't have both of them (default is to listen on all ip addresses)
interface ignore wildcard interface ignore wildcard
{% if MGMT_INTERFACE %} {% if MGMT_INTERFACE %}
{% for (mgmt_intf, mgmt_prefix) in MGMT_INTERFACE|pfx_filter %} {% for (mgmt_intf, mgmt_prefix) in MGMT_INTERFACE|pfx_filter %}
interface listen {{ mgmt_prefix | ip }} interface listen {{ mgmt_prefix | ip }}
{% endfor %} {% endfor %}
{% elif LOOPBACK_INTERFACE %}
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
{% if prefix | ipv4 and name == 'Loopback0' %}
interface listen {{ prefix | ip }}
{% endif %}
{% endfor %}
{% else %} {% else %}
interface listen eth0 interface listen eth0
{% endif %} {% endif %}