summaryrefslogtreecommitdiff
path: root/roles/vm/network/templates/interfaces.j2
blob: db0e322f7a3891e3b92acb311e84d6b482eaef47 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto {{ network.primary.interface }}
iface {{ network.primary.interface }} inet static
  pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra
  pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf
  address {{ network.primary.ip }}
  netmask {{ network.primary.mask }}
{% if 'overlay' in network.primary %}
  up /bin/ip addr add dev $IFACE {{ network.primary.overlay }}/32
  up /bin/ip route add default via {{ network.primary.gateway }} src {{ network.primary.overlay }}
  down /bin/ip route del default via {{ network.primary.gateway }} src {{ network.primary.overlay }}
  down /bin/ip addr del dev $IFACE {{ network.primary.overlay }}/32
{% else %}
  gateway {{ network.primary.gateway }}
{% endif %}
{% if 'prefix6' in network.primary %}

iface {{ network.primary.interface }} inet6 static
  address {{ network.primary.prefix6 }}
  gateway {{ network.primary.gateway6 }}
{% endif %}