diff options
author | Christian Pointner <equinox@spreadspace.org> | 2020-07-22 23:01:37 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2020-07-22 23:01:37 +0200 |
commit | 076074fa02f4ba33f798c2053771e4827fd1c35f (patch) | |
tree | db6a31c412d1db575efcd902e0eea8a1f1e63720 /roles/vm/guest/network/templates/interfaces/multihomed-base.j2 | |
parent | switch from gpg --verify to gpgv (diff) |
add some more interface configs
Diffstat (limited to 'roles/vm/guest/network/templates/interfaces/multihomed-base.j2')
-rw-r--r-- | roles/vm/guest/network/templates/interfaces/multihomed-base.j2 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/roles/vm/guest/network/templates/interfaces/multihomed-base.j2 b/roles/vm/guest/network/templates/interfaces/multihomed-base.j2 new file mode 100644 index 00000000..db16d15f --- /dev/null +++ b/roles/vm/guest/network/templates/interfaces/multihomed-base.j2 @@ -0,0 +1,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 %} |