ansible-ffibk/roles/service-tinc/templates/tinc-up.j2
Tobias Hachmer 53d30c8ded Restructure fastd configuration to define multiple instances easily
- introduce mesh subdictionary `fastd`
 - change fastd instance naming
 - change fastd network interface naming (identical with fastd instance
names)
 - change mac address prefixes
2017-10-07 00:57:35 +02:00

14 lines
920 B
Django/Jinja

{% set ip4hex = icvpn_ipv4_transfer_net | ipaddr('net') | ipsubnet(24, 37) | ipaddr(magic) | ipaddr('address') | ip4_hex() -%}
{% set mac = '02f0' + ip4hex -%}
#!/bin/sh
#
# {{ ansible_managed }}
#
/sbin/ifconfig ${INTERFACE} hw ether {{ mac | hwaddr('linux') }}
/sbin/ip link set dev ${INTERFACE} up
/sbin/ip -4 route add {{ icvpn_ipv4_transfer_net }} proto static dev ${INTERFACE} table {{ routing_tables.icvpn }}
/sbin/ip -6 route add {{ icvpn_ipv6_transfer_net }} proto static dev ${INTERFACE} table {{ routing_tables.icvpn }}
/sbin/ip addr add dev ${INTERFACE} {{ icvpn_ipv4_transfer_net | ipaddr('net') | ipsubnet(24, 37) | ipaddr(magic) | ipaddr('address') }}/16 broadcast {{ icvpn_ipv4_transfer_net | ipaddr('net') | ipaddr('broadcast') }} scope link
/sbin/ip -6 addr add dev ${INTERFACE} {{ icvpn_ipv6_transfer_net | ipaddr('net') | ipsubnet(112, 37) | ipaddr(magic) | ipaddr('address') }}/96 preferred_lft 0