[Interface] PrivateKey = {{ wireguard_server_privkey }} {# We want the Address field here to be an IP address with the whole network in CIDR notation, like 10.0.0.1/24. If wireguard_vpn_network is a CIDR network like 10.0.0.0/24, and wireguard_server_offset is an integer like 1, this will produce an offset of the start of the network + CIDR prefix, which in this case will be the desired 10.0.0.1/24. #} Address = {{ wireguard_vpn_network | ipaddr(wireguard_server_offset) }} ListenPort = {{ wireguard_server_listen_port }} {% for client in wireguard_clients %} [Peer] # {{ client.name }} PublicKey = {{ client.pubkey }} {# We want the Address field here to be an IP address withOUT the whole network in CIDR notation, like 10.0.0.15/32. If wireguard_vpn_network is a CIDR network like 10.0.0.0/24, and client.offset is an integer like 15, this will produce an offset of the start of the network with a /32 CIDR prefix which in this case will be the desired 10.0.0.15/32. #} AllowedIPs = {{ wireguard_vpn_network | ipsubnet(32, client.offset) }} {% endfor %}