blob: 7ac942467eafb1051bb46ba93f14703ca4d9ecc9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
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 %}
|