# WireGuard DNS after latest upgrade

**URL:** https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104
**Category:** Troubleshooting
**Created:** [9 April 2019 11:36 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104 "2019-04-09T11:36:16Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Niwre](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/ec9cab/32.png) [@Niwre](https://dietpi.com/forum/u/Niwre)
#### Post date: [9 April 2019 11:36 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/1 "2019-04-09T11:36:16Z")

</div>

Hello,

since the latest upgrade, my local DNS server specified in WireGuard has stopped working. After recovering the last version everything works fine again. What could that be?

Thank you

---

<div class="post-metadata">

### Author: ![Niwre](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/ec9cab/32.png) [@Niwre](https://dietpi.com/forum/u/Niwre)
#### Post date: [13 April 2019 07:25 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/2 "2019-04-13T07:25:53Z")

</div>

Can nobody help here?

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [3 May 2019 22:23 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/3 "2019-05-03T22:23:09Z")

</div>

Niwre  
If the issue still occurs:  
When connecting a client to the VPN, is it possible to connect via bare IP to some external address, so really only DNS resolving fails?

---

<div class="post-metadata">

### Author: ![Niwre](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/ec9cab/32.png) [@Niwre](https://dietpi.com/forum/u/Niwre)
#### Post date: [6 May 2019 06:35 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/4 "2019-05-06T06:35:26Z")

</div>

yes IP addresses work perfectly, only the DNS resolving does not work anymore.

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [26 May 2019 20:09 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/5 "2019-05-26T20:09:15Z")

</div>

Niwre  
It is the client that cannot resolve hostnames, not the server, right?

Could you please try it with the new kernel and WireGuard versions:  
(you are on RPi, right?)

```nohighlight
apt upgrade
dpkg-reconfigure wireguard-dkms

```

---

<div class="post-metadata">

### Author: ![Niwre](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/ec9cab/32.png) [@Niwre](https://dietpi.com/forum/u/Niwre)
#### Post date: [4 June 2019 13:14 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/6 "2019-06-04T13:14:43Z")

</div>

@MichaIng  
I already tried it with the new kernel and WireGuard, it did not work either.

I tested it now with the update from 6.21.1 to 6.24.1, unfortunately it does not work here either. Now I can only call external pages, local addresses work neither via DNS nor via the direct IP address.

I am not on an RPI, I am on a virtual machine on an ESXi 6.0.

I am now back to version 6.21.1 with the WireGuard version 0.0.20190406 (currently the version would be 0.0.20190601), everything works fine here.

What can I do to update to the latest version of DietPi?

---

<div class="post-metadata">

### Author: ![Niwre](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/ec9cab/32.png) [@Niwre](https://dietpi.com/forum/u/Niwre)
#### Post date: [10 June 2019 14:42 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/7 "2019-06-10T14:42:11Z")

</div>

I tried again with the update to version 6.24.1 and it did not work again. However, I noticed that the service for WireGuard has not started after the update and can not be started anymore. So it does not work anymore, but why can not the service be started and how can I fix it?

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [14 June 2019 14:22 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/8 "2019-06-14T14:22:12Z")

</div>

Niwre  
Note that it is essential that you recompile the WireGuard module after every kernel upgrade:

```nohighlight
apt full-upgrade
dpkg-reconfigure wireguard-dkms

```

You could do a dietpi-backup and run the above two commands to upgrade both and see if your issue related to the WireGuard/kernel upgrade or because of the DietPi-Update.

In case the service fails, please paste:

```nohighlight
journalctl -u wg-quick@wg0
ip a

```

And check if the module has been loaded successfully:

```nohighlight
lsmod | grep wireguard

```

---

<div class="post-metadata">

### Author: ![Niwre](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/ec9cab/32.png) [@Niwre](https://dietpi.com/forum/u/Niwre)
#### Post date: [15 June 2019 19:44 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/9 "2019-06-15T19:44:39Z")

</div>

@MichaIng

The kernel upgrade is not the problem, I’ve done the update in 6.21.1 and WireGuard still works fine. The command systemctl status [wg-quick@wg0.service](mailto:wg-quick@wg0.service) probably shows the cause of the problem.

root@WireGuardPi:~# systemctl status [wg-quick@wg0.service](mailto:wg-quick@wg0.service)  
● [wg-quick@wg0.service](mailto:wg-quick@wg0.service) - WireGuard via wg-quick(8) for wg0  
Loaded: loaded (/lib/systemd/system/wg-quick@.service; enabled; vendor preset: enabled)  
Active: failed (Result: exit-code) since Mon 2019-06-10 15:52:51 BST; 2min 46s ago  
Docs: man:wg-quick(8)  
man:wg(8)  
[https://www.wireguard.com/](https://www.wireguard.com/)  
[https://www.wireguard.com/quickstart/](https://www.wireguard.com/quickstart/)  
[https://git.zx2c4.com/WireGuard/about/src/tools/man/wg-quick.8](https://git.zx2c4.com/WireGuard/about/src/tools/man/wg-quick.8)  
[https://git.zx2c4.com/WireGuard/about/src/tools/man/wg.8](https://git.zx2c4.com/WireGuard/about/src/tools/man/wg.8)  
Process: 1434 ExecStart=/usr/bin/wg-quick up wg0 (code=exited, status=255)  
Main PID: 1434 (code=exited, status=255)

Jun 10 15:52:51 WireGuardPi wg-quick[1434]: [#] ip link set mtu 1420 up dev wg0  
Jun 10 15:52:51 WireGuardPi wg-quick[1434]: [#] ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o $(sed -n 3p /DietPi/dietpi/.network) -j MASQUERADE  
Jun 10 15:52:51 WireGuardPi wg-quick[1434]: [#] sysctl net.ipv6.conf.wg0.forwarding=1 net.ipv6.conf.$(sed -n 3p /DietPi/dietpi/.network).forwarding=1  
Jun 10 15:52:51 WireGuardPi wg-quick[1434]: net.ipv6.conf.wg0.forwarding = 1  
Jun 10 15:52:51 WireGuardPi wg-quick[1434]: sysctl: cannot stat /proc/sys/net/ipv6/conf/NONE/forwarding: No such file or directory  
Jun 10 15:52:51 WireGuardPi wg-quick[1434]: [#] ip link delete dev wg0  
Jun 10 15:52:51 WireGuardPi systemd[1]: [wg-quick@wg0.service](mailto:wg-quick@wg0.service): Main process exited, code=exited, status=255/n/a  
Jun 10 15:52:51 WireGuardPi systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.  
Jun 10 15:52:51 WireGuardPi systemd[1]: [wg-quick@wg0.service](mailto:wg-quick@wg0.service): Unit entered failed state.  
Jun 10 15:52:51 WireGuardPi systemd[1]: [wg-quick@wg0.service](mailto:wg-quick@wg0.service): Failed with result ‘exit-code’.

Does this information help?

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [20 June 2019 18:59 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/10 "2019-06-20T18:59:05Z")

</div>

Niwre  
Ah indeed, it seems that the active network device could not be identified on boot.

Please check: sed -n 3p /DietPi/dietpi/.network  
It seems to contain “NONE”.  
Try: /DietPi/dietpi/func/obtain\_network\_details  
Then retry sed -n 3p /DietPi/dietpi/.network, if it shows the correct interface.  
If so, then systemctl restart wg-quick@wg0 should fix the state.

I think we should run this script to update network info as ExecStartPre to the WireGuard systemd service, in case on boot waiting for network exceeds the default 10 seconds timeout.

---

<div class="post-metadata">

### Author: ![Niwre](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/ec9cab/32.png) [@Niwre](https://dietpi.com/forum/u/Niwre)
#### Post date: [23 June 2019 08:33 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/11 "2019-06-23T08:33:20Z")

</div>

@MichaIng  
I have executed the commands as described, unfortunately always “NONE” is returned. I have set in Dietpi-config, the setting when booting to wait for network, synonymous unfortunately brings the same feedback. 🤔

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [23 June 2019 19:58 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/12 "2019-06-23T19:58:13Z")

</div>

Niwre  
That is strange, can you paste: ls -Al /sys/class/net/

---

<div class="post-metadata">

### Author: ![Niwre](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/ec9cab/32.png) [@Niwre](https://dietpi.com/forum/u/Niwre)
#### Post date: [24 June 2019 06:14 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/13 "2019-06-24T06:14:57Z")

</div>

@MichaIng  
It looks like this under 6.24.1  
ls -Al /sys/class/net/  
insgesamt 0  
lrwxrwxrwx 1 root root 0 Jun 24 07:04 eth0 → …/…/devices/pci0000:00/0000:00:11.0/0000:02:02.0/net/eth0  
lrwxrwxrwx 1 root root 0 Jun 24 07:04 lo → …/…/devices/virtual/net/lo

It looks like this under 6.21.1  
ls -Al /sys/class/net/  
insgesamt 0  
lrwxrwxrwx 1 root root 0 Jun 24 07:08 eth0 → …/…/devices/pci0000:00/0000:00:11.0/0000:02:02.0/net/eth0  
lrwxrwxrwx 1 root root 0 Jun 24 07:08 lo → …/…/devices/virtual/net/lo  
lrwxrwxrwx 1 root root 0 Jun 24 07:08 wg0 → …/…/devices/virtual/net/wg0

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [30 June 2019 12:34 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/14 "2019-06-30T12:34:02Z")

</div>

Niwre  
Sorry for late reply.

Okay the network device is there. It is expected that wg0 is not there as the WireGuard service failed.

Lets go through it what /DietPi/dietpi/func/obtain\_network\_details does to debug why it does not print the existint eth0 interface to /DietPi/dietpi/.network.

1. It exits when it finds itself running and in case exits. So if one instance is hanging (e.g. from boot), that would explain it:  
pgrep ‘obtain\_network\_details’
2. It scrapes the IP address and checks is the connection is “UP” from: ip a s eth0

---

<div class="post-metadata">

### Author: ![Niwre](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/ec9cab/32.png) [@Niwre](https://dietpi.com/forum/u/Niwre)
#### Post date: [30 June 2019 15:29 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/15 "2019-06-30T15:29:14Z")

</div>

@MichaIng  
attached the result.

 ![PNG-Bild 2.png](https://dietpi.com/forum/uploads/default/original/1X/8b04d804a9211464f2f81599b12aa489defa712e.png)

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [30 June 2019 16:39 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/16 "2019-06-30T16:39:01Z")

</div>

Niwre  
state UNKNOWN is the issue. Hmm network/internet works well with this? What does ethtool eth0 say about link connection?

And could you print ip r to check if default route is set, which might be then the safer check for active adapter.

As a quick workaround you can do:

```nohighlight
sed -i 's/UP/\(UP\|UNKNOWN\)/g' /DietPi/dietpi/func/obtain_network_details
/DietPi/dietpi/func/obtain_network_details
systemctl restart wg-quick@wg0

```

---

<div class="post-metadata">

### Author: ![Niwre](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/ec9cab/32.png) [@Niwre](https://dietpi.com/forum/u/Niwre)
#### Post date: [30 June 2019 17:09 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/17 "2019-06-30T17:09:26Z")

</div>

@MichaIng

attached the result.  
 ![14C52449-4DFF-4C91-92A5-8C6AFC5BE52B.jpeg](https://dietpi.com/forum/uploads/default/original/1X/1c13f35aef2e195939743706dae4f04e8889615b.jpeg)  
Quick workaround solved the problem, no it works.

Thank you for your help.

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [30 June 2019 18:00 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/18 "2019-06-30T18:00:42Z")

</div>

Niwre  
Okay thanks for testing, great it works.

Hmm now I am thinking how to find a solution code wise. Actually we implemented the “UP” check just a short time ago due to issues/wrong entries if this was skipped. And now we have a case where it is exactly the other way round.

Strange that ip does not recognise it as “UP” as the default route is there and ethtool also shows it as connected 🤔.

ethtool cannot be used regularly since it yeah only works for Ethernet of course and also the connection state does not imply that it is connected to the gateway or even has in IP assigned.  
Default route is already safer, but this changes (reasonably) when you’re installing a VPN client, so is not 100% failsafe as well.  
But ip r should always list the gateway link, so if we check for the word " via ", it should be safe.

Ah no, default route stays:

```nohighlight
root@VM-Stretch:~# ip r
0.0.0.0/1 via 10.8.0.1 dev tun0
default via 192.168.178.1 dev eth0 onlink
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.9
128.0.0.0/1 via 10.8.0.1 dev tun0
185.220.70.210 via 192.168.178.1 dev eth0
192.168.178.0/24 dev eth0 proto kernel scope link src 192.168.178.29
root@VM-Stretch:~# ip r s 0.0.0.0/0
default via 192.168.178.1 dev eth0 onlink

```

---

<div class="post-metadata">

### Author: ![Niwre](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/ec9cab/32.png) [@Niwre](https://dietpi.com/forum/u/Niwre)
#### Post date: [30 June 2019 18:21 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/19 "2019-06-30T18:21:35Z")

</div>

@MichaIng  
Many thanks for your answer. I do not know if this information is still important, but the line with “via” shows the default route.

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [30 June 2019 18:28 UTC](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104/20 "2019-06-30T18:28:40Z")

</div>

Niwre  
Yeah perhaps we should use this is more reliable method to determine the main active network device. But I want to assure that the default route also stays the same when using WireGuard as VPN client (you use it as server).

But that is something I will not touch for v6.25 any more. So when you run dietpi-update, remember to reapply the workaround. I will then have a closer look for v6.26 where I anyway plan some deeper rework of our network setup.

[Next page](https://dietpi.com/forum/t/wireguard-dns-after-latest-upgrade/3104.md?page=2)
