Change DNS in Wireguard settings

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
cc13
Posts: 27
Joined: Wed Mar 13, 2019 1:31 pm

Change DNS in Wireguard settings

Post by cc13 »

Hello,

A Pi-Hole is running on my DietPi and on the same hardware I installed a PiVPN Wireguard with the default settings. In this setup I selected a public DNS server outside from my lan. All is fine and running, I have access to this VPN from outside with my phone/laptop.

Now I try to change this DNS settings in Wireguard to use my own Pi-Hole for the VPN clients. I added the DNS server in wg0.conf:

Code: Select all

[Interface]
PrivateKey = 
Address = 10.6.0.1/24
DNS = 192.168.1.4
ListenPort = 51820
But now WireGuard will not start:

Code: Select all

root@DietPi4:/etc/wireguard# wg-quick up wg0
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.6.0.1/24 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] resolvconf -a wg0 -m 0 -x
/usr/bin/wg-quick: line 32: resolvconf: command not found
[#] ip link delete dev wg0
How can I change the DNS-Server settings?

Thanks,
Carsten
cc13
Posts: 27
Joined: Wed Mar 13, 2019 1:31 pm

Re: Change DNS in Wireguard settings

Post by cc13 »

I try to answer myself: Is it correct to change this DNS settings not in the wg0.conf? I have to change it in the tunnel settings on the client?
User avatar
Joulinar
Posts: 2597
Joined: Sat Nov 16, 2019 12:49 am

Re: Change DNS in Wireguard settings

Post by Joulinar »

Hi,

many thanks for your request. Yes correct, you would need to do this within client configuration and not within the server file wg0.conf. As well you could do this on the client App on your mobile device.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply