summaryrefslogtreecommitdiff
path: root/roles/vm/guest/network/templates/interfaces/overlay.j2
blob: 0524c5df5d9cafff811603323b4bc08a4a437896 (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