From be3d627bdb21b78bbe853e6d6928ccb86f6c70e4 Mon Sep 17 00:00:00 2001 From: Jannik Beyerstedt Date: Sun, 21 Mar 2021 12:24:22 +0100 Subject: [PATCH] Use utun device on macOS (no tuntap kext needed) --- templates/tinc-up.j2 | 2 +- templates/tinc.conf.j2 | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/tinc-up.j2 b/templates/tinc-up.j2 index f60f10e..0881c25 100644 --- a/templates/tinc-up.j2 +++ b/templates/tinc-up.j2 @@ -16,7 +16,7 @@ iptables -t nat -A POSTROUTING -o eth0 -s {{ tinc_vpn_net }} -j MASQUERADE {% elif ansible_os_family == 'Darwin' %} # only a single endpoint works, because tun interface is p2p -/sbin/ifconfig tun0 inet {{ tinc_client_ip | ipaddr('address') }} {{ tinc_remote_nets[0].gateway }} up netmask 255.255.255.0 +/sbin/ifconfig $INTERFACE inet {{ tinc_client_ip | ipaddr('address') }} {{ tinc_remote_nets[0].gateway }} up netmask 255.255.255.0 /sbin/route -n add -net {{ tinc_remote_nets[0].net_cidr }} {{ tinc_remote_nets[0].gateway }} diff --git a/templates/tinc.conf.j2 b/templates/tinc.conf.j2 index dce748a..0e37528 100644 --- a/templates/tinc.conf.j2 +++ b/templates/tinc.conf.j2 @@ -1,6 +1,8 @@ Name = {{ ansible_hostname | replace('-', '_') }} {% if (override_os_family is defined) | ternary(override_os_family,ansible_os_family) != 'Darwin' %} Device = /dev/net/tun +{% elif ternary(override_os_family,ansible_os_family) == 'Darwin' %} +DeviceType = utun {% endif %} {% if ansible_hostname | replace('-', '_') != tinc_central_host %} ConnectTo = {{ tinc_central_host }}