network: Add support to force DNS servers for interface

Previously DNS servers could be set for interface but they were used only
when interface address was set to static. This change allow to set (or
remove) DNS servers for interfaces regardles of IP address method.
This commit is contained in:
Timo Makinen 2021-03-25 15:38:00 +00:00
parent 25c4b3182a
commit b776431baf

View file

@ -21,15 +21,15 @@ NETMASK="{{ item.netmask }}"
{% if item.gateway is defined %}
GATEWAY="{{ item.gateway }}"
{% endif %}
{% elif proto == 'none' %}
BOOTPROTO=none
{% endif %}
{% if item.nameservers is defined %}
PEERDNS=no
{% for i in range(item.nameservers|length) %}
DNS{{ i+1 }}={{ item.nameservers[i] }}
{% endfor %}
{% endif %}
{% elif proto == 'none' %}
BOOTPROTO=none
{% endif %}
{% if item.ip6addr is defined and item.ip6addr != 'none' %}
IPV6INIT=yes
{% if item.ip6addr != 'auto' %}