Parcourir la source

ipv4 default gateway configuration

netifs
Parent
révision
aef5e034e8
1 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. +4
    -2
      templates/network-interfaces.j2

+ 4
- 2
templates/network-interfaces.j2 Voir le fichier

@@ -139,7 +139,6 @@ iface {{ dev }} inet6 static
iface {{ dev }} inet6 static
address {{ ip.ip | ipv6('address') }}
netmask {{ ip.ip | ipv6('prefix') }}
#gateway
{% if netifs[netif].dns_resolvers is defined and netifs[netif].dns_resolvers | ipv6 %}
dns-nameservers {{ netifs[netif].dns_resolvers | ipv6 | join(" ") }}
{% endif %}
@@ -154,7 +153,10 @@ iface {{ dev }} inet static
network {{ ip.ip | ipv4('network') }}
netmask {{ ip.ip | ipv4('prefix') }}
broadcast {{ ip.ip | ipv4('broadcast') }}
#gateway
{% if loop.index == 1 and netifs[netif].routes is defined %}
{% set default_route = netifs[netif].routes | json_query("[?to=='default']") | first %}
gateway {{default_route.via}}
{% endif %}
{% if netifs[netif].dns_resolvers is defined and netifs[netif].dns_resolvers | ipv4 %}
dns-nameservers {{ netifs[netif].dns_resolvers | ipv4 | join(" ") }}
{% endif %}


Chargement…
Annuler
Enregistrer