From d52e9e6fe75cd9bdc7b180f4250d0c1239c45ea2 Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 18 May 2017 23:50:43 +0200 Subject: [PATCH] ipv6-tunnel: migrate to systemd-networkd --- salt-pillar/upstream/upstream2.sls | 2 +- salt/upstream/ipv6-tunnel.conf | 7 ----- salt/upstream/ipv6-tunnel.sls | 46 +++++++++++++++++++++--------- 3 files changed, 33 insertions(+), 22 deletions(-) delete mode 100644 salt/upstream/ipv6-tunnel.conf diff --git a/salt-pillar/upstream/upstream2.sls b/salt-pillar/upstream/upstream2.sls index 761130c..320219e 100644 --- a/salt-pillar/upstream/upstream2.sls +++ b/salt-pillar/upstream/upstream2.sls @@ -12,5 +12,5 @@ port-forwarding: ipv6-tunnel: endpoint: 216.66.80.30 - address: 2001:470:1f0a:12b2::2 + address: 2001:470:1f0a:12b2::2/64 gateway: 2001:470:1f0a:12b2::1 diff --git a/salt/upstream/ipv6-tunnel.conf b/salt/upstream/ipv6-tunnel.conf deleted file mode 100644 index 552d264..000000000 --- a/salt/upstream/ipv6-tunnel.conf +++ /dev/null @@ -1,7 +0,0 @@ -auto ipv6 -iface ipv6 inet6 v4tunnel - address {{ address }} - netmask 64 - endpoint {{ endpoint }} - ttl 255 - gateway {{ gateway }} diff --git a/salt/upstream/ipv6-tunnel.sls b/salt/upstream/ipv6-tunnel.sls index 7ba7ac8..539aecb 100644 --- a/salt/upstream/ipv6-tunnel.sls +++ b/salt/upstream/ipv6-tunnel.sls @@ -1,18 +1,36 @@ ifupdown: pkg.installed: [] -/etc/network/interfaces.d/ipv6-tunnel.conf: - file.managed: - - source: salt://upstream/ipv6-tunnel.conf - - template: 'jinja' - - context: - endpoint: {{ pillar['ipv6-tunnel'].get('endpoint') }} - address: {{ pillar['ipv6-tunnel'].get('address') }} - gateway: {{ pillar['ipv6-tunnel'].get('gateway') }} - - require: - - pkg: ifupdown +/etc/systemd/network/ipv6.netdev: + file.append: + - text: | + [NetDev] + Name=ipv6 + Kind=sit + [Tunnel] + Remote={{ pillar['ipv6-tunnel']['endpoint'] }} -'ifdown ipv6; ifup ipv6': - cmd.run: - - onchanges: - - file: /etc/network/interfaces.d/ipv6-tunnel.conf +/etc/systemd/network/ipv6.network: + file.append: + - text: | + [Match] + Name=ipv6 + [Network] + Address={{ pillar['ipv6-tunnel']['address'] }} + Gateway={{ pillar['ipv6-tunnel']['gateway'] }} + +/etc/systemd/network/ipv6-up.network: + file.append: + - text: | + [Match] + Name={{ pillar['upstream']['interface'] }} + [Network] + Tunnel=ipv6 + +systemd-networkd: + service: + - running + - watch: + - file: /etc/systemd/network/ipv6.netdev + - file: /etc/systemd/network/ipv6.network + - file: /etc/systemd/network/ipv6-up.network