9bcd07e107
Change Source into Destination to have defined static route applying on the right CIDR and not 0.0.0.0 Change-Id: Id51ece1c72474de07dbf6cf740ecf4f93b2d1adf Closes-Bug: #1777251
38 lines
959 B
Django/Jinja
38 lines
959 B
Django/Jinja
[Match]
|
|
Name={{ item.value.interface }}
|
|
|
|
{% if item.value.address is defined %}
|
|
[Address]
|
|
{% set addr_cidr = (item.value.address | string + '/' + item.value.netmask | string) | ipaddr('prefix') %}
|
|
Address={{ item.value.address }}/{{ addr_cidr }}
|
|
{% else %}
|
|
[DHCP]
|
|
UseDNS={{ (lxc_container_enable_resolved | bool) | ternary('yes', 'no') }}
|
|
UseNTP=yes
|
|
RouteMetric=20
|
|
{% endif %}
|
|
|
|
{% for route in item.value.static_routes | default([]) %}
|
|
[Route]
|
|
Destination={{ route['cidr'] }}
|
|
Gateway={{ route['gateway'] }}
|
|
Metric={{ 20 + loop.index }}
|
|
|
|
{% endfor %}
|
|
|
|
[Network]
|
|
{% if item.value.address is defined %}
|
|
{% set addr_cidr = (item.value.address | string + '/' + item.value.netmask | string) | ipaddr('prefix') %}
|
|
Address={{ item.value.address }}/{{ addr_cidr }}
|
|
{% else %}
|
|
DHCP=yes
|
|
{% endif %}
|
|
{% if item.value.gateway is defined %}
|
|
Gateway={{ item.value.gateway }}
|
|
{% endif %}
|
|
|
|
[Link]
|
|
{% if item.value.mtu is defined %}
|
|
MTUBytes={{ item.value.mtu }}
|
|
{% endif %}
|