summaryrefslogtreecommitdiff
path: root/roles/vm/guest/network/templates/interfaces/overlay.j2
blob: b2ef11a901f62c589aa06145b1bd7f664a808475 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  address {{ interface.address | ipaddr('address') }}
  netmask {{ interface.address | ipaddr('netmask') }}
  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 }}{% if 'source' in route %} src {{ route.source }}{% endif %}{{ '' }}
{% 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 }}
{% 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 %}{{ '' }}
{% endfor %}
  down /bin/ip addr del dev $IFACE {{ interface.overlay }}/32