blob: 3420dcf0b8390281d1f8bf514cc23fdd0e95eedb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
address {{ interface.address | ipaddr('address') }}
netmask {{ interface.address | ipaddr('netmask') }}
{% for route in interface.static_routes | default([]) %}
up /bin/ip route add {{ route.destination }} via {{ route.gateway }}{% if 'source' in route %} src {{ route.source }}{% endif %}{% if 'table' in route %} table {{ route.table }}{% endif %}{{ '' }}
{% endfor %}
{% if 'gateway' in interface %}
up /bin/ip route add default via {{ interface.gateway }} table default
{% endif %}
up /bin/ip rule add pref 42000 lookup default
up /bin/ip rule del pref 32767
down /bin/ip rule add pref 32767 lookup default
down /bin/ip rule del pref 42000
{% if 'gateway' in interface %}
down /bin/ip route del default via {{ interface.gateway }} table default
{% endif %}
{% for route in interface.static_routes | default([]) | reverse %}
down /bin/ip route del {{ route.destination }} via {{ route.gateway }}{% if 'source' in route %} src {{ route.source }}{% endif %}{% if 'table' in route %} table {{ route.table }}{% endif %}{{ '' }}
{% endfor %}
|