Timotej Lazar
6c817624bc
So we have predictable addresses if we ever want to firewall individual hosts.
19 lines
585 B
Django/Jinja
19 lines
585 B
Django/Jinja
auto lo
|
|
iface lo inet loopback
|
|
|
|
{% for iface in interfaces | selectattr('enabled') %}
|
|
auto {{ iface.name }}
|
|
iface {{ iface.name }} inet static
|
|
{% for ip in iface.ip_addresses %}
|
|
address {{ ip.address }}
|
|
{% set subnet = ip.address | ipaddr('subnet') %}
|
|
{% set prefix = prefixes | selectattr('prefix', '==', subnet) | first %}
|
|
{% set gateway = prefix.custom_fields.gateway.address %}
|
|
{% if gateway is defined and gateway != ip.address %}
|
|
gateway {{ gateway | ipaddr('address') }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf
|
|
|
|
{% endfor %}
|