# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback ## pyhiscal interfaces {# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990428 {% for interface in network.bonds | default([]) | map(attribute='slaves') | flatten | union(network.vlans | default({}) | list) | difference(network.bonds | default([]) | map(attribute='name') | list) | sort | unique %} #} {% for interface in network.vlans | default({}) | list | difference(network.bonds | default([]) | map(attribute='name') | list) | sort | unique %} auto {{ interface }} iface {{ interface }} inet manual pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf {% endfor %} {% for bond in network.bonds | default([]) %} ## Bond: {{ bond.name }} {% set matched = network.interfaces | selectattr('name', 'eq', bond.name) | list %} auto {{ bond.name }} iface {{ bond.name }} inet {{ ((matched | length) == 0) | ternary('manual', 'static') }} up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf bond-mode {{ bond.mode }} bond-slaves {{ bond.slaves | sort | join(' ') }} {% for option in (bond.options | default({}) | list | sort) %} bond-{{ option }} {{ bond.options[option] }} {% endfor %} {% if (matched | length) > 0 %} {% set interface = matched | first %} {% if 'content' in interface %} {{ interface.content | indent(2) }} {% else %} {% include 'interfaces/' + (interface.template | default('simple')) + '.j2' %} {% endif %} {% if 'content6' in interface or 'address6' in interface %} iface {{ interface.name }} inet6 static {% if 'content6' in interface %} {{ interface.content6 | indent(2) }} {% else %} {% include 'interfaces/' + (interface.template6 | default('simple6')) + '.j2' %} {% endif %} {% endif %} {% endif %} {% endfor %} {% for parent in (network.vlans | default({}) | list | sort) %} ## vlan interfaces @ {{ parent }} {% for vlan in network.vlans[parent] %} {% set interface_name = parent+'.'+(vlan | string) %} {% set matched = network.interfaces | selectattr('name', 'eq', interface_name) | list %} auto {{ interface_name }} iface {{ interface_name }} inet {{ ((matched | length) == 0) | ternary('manual', 'static') }} up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf {% if (matched | length) > 0 %} {% set interface = matched | first %} {% if 'content' in interface %} {{ interface.content | indent(2) }} {% else %} {% include 'interfaces/' + (interface.template | default('simple')) + '.j2' %} {% endif %} {% if 'content6' in interface or 'address6' in interface %} iface {{ interface.name }} inet6 static {% if 'content6' in interface %} {{ interface.content6 | indent(2) }} {% else %} {% include 'interfaces/' + (interface.template6 | default('simple6')) + '.j2' %} {% endif %} {% endif %} {% endif %} {% endfor %} {% endfor %} ## source bridge configs source /etc/network/interfaces.d/*