Hi!
I'm trying to add a NetBSD device to my wireguard network.
Since the wireguard 'server' peer is in a homenetwork, I've configured
it to be reachable through duckdns.
On Debian Linux I would have a /etc/wireguard/wg0.conf like this for one
of the peers connecting to the server:
[Interface]
PrivateKey = [this peer's private key]
Address = [this peer's ip adress]
[Peer]
PublicKey = [server's public key]
PresharedKey = [a preshared key]
AllowedIPs = [the ip range]
Endpoint = [the duckdns url]:[listening port]
And then you can activate it by running wg-quick wg0 up (or via the init
system: systemctl start wg-quick@wg0).
I noticed that wg-quick isn't available after installing wireguard-tools
from pkgsrc (I guess because NetBSD's networking works differently from
most Linux distros?).
But after some googling I've found some examples of setting it up via an
ifconfig.if file with a bunch of calls to wgconfig.
Since the command-line arguments for wgconfig map pretty well on to the
lines in the wg0.conf I would normally write, I wrote this in
/etc/ifconfig.wg0:
[the selected ip/range within the wg-network]
!wgconfig ${int} set private-key /etc/wireguard/private.key
!wgconfig ${int} add peer wgserver $(cat /etc/wireguard/public.key)
--preshared-key=/etc/wireguard/preshared.key --allowed-ips=[the
wg-network's ip-range] --endpoint=[the duckdns url]:[listening port]
up
(also for context, yes they keys are stored as separate files in
/etc/wireguard. They're owned by root:wheel with chmod 600 permission bits).
When I restart the network (by calling doas sh /etc/rc.d/network
restart) I get the following error message:
wg0wgconfig: getaddrinfo: hostname or servname not provided or not known.
getaddrinfo [duckdns url] does work though, but maybe there's a problem
with the fact that --endpoint is provided with a url:port instead of a
ip:port (the man page does specify ip:port)?
getaddrinfo with [duckdns url]:[listening port] fails.
I've also tried quoting various part in the url and port in case it's a
shell parsing problem, but that didn't help either.
Anyhow, does anyone know how to configure NetBSD as a wireguard peer
when the other peer is behind a ddns url?
Also: I am relatively experienced with Linux but new to NetBSD, so am I
completely off base in how I should configure wireguard here in the
first place?
Also also, I'm new to mailing lists, so please say if I'm breaking some
kind of etiquette or formatting rule.
Kind regards,
Martijn.