address {{ interface.address | ipaddr('address') }} netmask {{ interface.address | ipaddr('netmask') }} {% for overlay in interface.overlays %} {% if 'name' in overlay %} ## {{ overlay.name }} {% endif %} up /bin/ip addr add dev $IFACE {{ overlay.address }} up /bin/ip route add default via {{ overlay.gateway }} src {{ overlay.address | ipaddr('address') }} table {{ 200 + loop.index0 }} up /bin/ip rule add pref {{ 40000 + loop.index0 }} from {{ overlay.address | ipaddr('address') }} lookup {{ 200 + loop.index0 }} {% endfor %} ########## {% for overlay in interface.overlays | reverse %} {% if 'name' in overlay %} ## {{ overlay.name }} {% endif %} down /bin/ip rule del pref {{ 40000 + loop.revindex0 }} down /bin/ip route del default via {{ overlay.gateway }} src {{ overlay.address | ipaddr('address') }} table {{ 200 + loop.revindex0 }} down /bin/ip addr del dev $IFACE {{ overlay.address }} {% endfor %}