aboutsummaryrefslogtreecommitdiff
path: root/roles/wireguard_client/templates/wg0.conf.j2
blob: d667d8a850d48b6e15ff8c2250fcb608a3907c5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# {{ ansible_managed }}

[Interface]
Address = {{ wireguard_client_peer_ip }}
PostUp = wg set %i private-key /etc/wireguard/privatekey
PostUp = ping -c1 192.168.10.1
{% for port in wireguard_client_port_forwards %}
PostUp = iptables -t nat -A PREROUTING -p tcp --dport {{ port }} -j DNAT --to-destination 192.168.10.1:{{ port }}
{% endfor %}
PostUp = iptables -t nat -A POSTROUTING -j MASQUERADE

[Peer]
PublicKey = {{ wireguard_client_server_pub_key }}
AllowedIPs = {{ wireguard_client_server_allowed_ips }}
Endpoint = {{ wireguard_client_server_endpoint }}:{{ wireguard_client_server_listen_port }}
PersistentKeepalive = 20