diff options
author | Christian Pointner <equinox@spreadspace.org> | 2020-06-24 03:01:50 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2020-06-24 03:01:50 +0200 |
commit | 31e88617f11109078b44327b2abae8f9768e10f7 (patch) | |
tree | 7138ae1d6376a216e2eaa6658140d2a13e287841 /roles/vm/network/templates/interfaces.j2 | |
parent | sk-tomnext-hp: final install (diff) |
update ch-router and add ch-nic
Diffstat (limited to 'roles/vm/network/templates/interfaces.j2')
-rw-r--r-- | roles/vm/network/templates/interfaces.j2 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/roles/vm/network/templates/interfaces.j2 b/roles/vm/network/templates/interfaces.j2 index d257a98a..8c288669 100644 --- a/roles/vm/network/templates/interfaces.j2 +++ b/roles/vm/network/templates/interfaces.j2 @@ -17,15 +17,27 @@ iface {{ interface.name }} inet static netmask {{ interface.address | ipaddr('netmask') }} {% if 'overlay' in interface %} up /bin/ip addr add dev $IFACE {{ interface.overlay }}/32 +{% for route in interface.static_routes | default([]) %} + up /bin/ip route add {{ route.destination }} via {{ route.gateway }} src {{ interface.overlay }} +{% endfor %} {% if 'gateway' in interface %} up /bin/ip route add default via {{ interface.gateway }} src {{ interface.overlay }} down /bin/ip route del default via {{ interface.gateway }} src {{ interface.overlay }} +{% for route in interface.static_routes | default([]) | reverse %} + down /bin/ip route del {{ route.destination }} via {{ route.gateway }} src {{ interface.overlay }} +{% endfor %} {% endif %} down /bin/ip addr del dev $IFACE {{ interface.overlay }}/32 {% else %} {% if 'gateway' in interface %} gateway {{ interface.gateway }} {% endif %} +{% for route in interface.static_routes | default([]) %} + up /bin/ip route add {{ route.destination }} via {{ route.gateway }} +{% endfor %} +{% for route in interface.static_routes | default([]) | reverse %} + down /bin/ip route del {{ route.destination }} via {{ route.gateway }} +{% endfor %} {% endif %} {% if 'address6' in interface %} @@ -34,5 +46,11 @@ iface {{ interface.name }} inet6 static {% if 'gateway6' in interface %} gateway {{ interface.gateway6 }} {% endif %} +{% for route in interface.static_routes6 | default([]) %} + up /bin/ip -6 route add {{ route.destination }} via {{ route.gateway }} +{% endfor %} +{% for route in interface.static_routes6 | default([]) | reverse %} + down /bin/ip -6 route del {{ route.destination }} via {{ route.gateway }} +{% endfor %} {% endif %} {% endfor %} |