Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Software | WireGuard: Use "DNS = 10.9.0.1", if local DNS is loopback IP/localhost #2482

Closed
swrobel opened this issue Jan 31, 2019 · 7 comments
Labels
Bug 🐞 Solution available 🥂 Definite solution has been done
Milestone

Comments

@swrobel
Copy link
Contributor

swrobel commented Jan 31, 2019

Required Information

Additional Information (if applicable)

  • Software title | Wireguard

Steps to reproduce

  1. Install Wireguard on a system running Pi-Hole (ex: /etc/resolv.conf contains nameserver 127.0.0.1)

Expected behaviour

/etc/wireguard/wg0-client.conf contains DNS = 10.8.0.1

Actual behaviour

/etc/wireguard/wg0-client.conf contains DNS = 127.0.0.1

Extra details

See this line: https://github.com/Fourdee/DietPi/blob/dev/dietpi/dietpi-software#L10055

I would submit a PR but I'm not very good at shellscripting and believe this conditional should be a quick fix for someone knowledgeable.

@MichaIng
Copy link
Owner

MichaIng commented Feb 7, 2019

@swrobel
Thanks for the hint.

Indeed we get the DNS address from the nameserver entry of the server machine.

If it resolves DNS requests itself, e.g. Pi-hole installed or dnsmasq, the entry is the loop back address which of course is wrong for clients.

Solution code side is to check, if the DNS entry is loopback and in case replace it with the VPN sever IP as you did. I guess with the iptables rules in place, the local server IP (from local network, not WireGuard interface) should work as well?

@MichaIng MichaIng added this to the v6.21 milestone Feb 7, 2019
@Fourdee Fourdee modified the milestones: v6.21, v6.22 Feb 7, 2019
@swrobel
Copy link
Contributor Author

swrobel commented Feb 8, 2019

You are indeed correct, it works with the local server ip

@swrobel swrobel changed the title Wireguard config should set DNS to 10.8.0.1 instead of 127.0.0.1 if running local DNS Wireguard config should set DNS to local ip instead of 127.0.0.1 if running local DNS Feb 8, 2019
@MichaIng
Copy link
Owner

MichaIng commented Feb 8, 2019

@swrobel
Okay not sure which one is best. I guess using 10.8.0.1 is a more direct connection, since at least forwarding to local network interface should be skipped. As well it works even without the iptables forward rules in place, which allow local network and in case www access through the VPN.

NB: localhost as well works in /etc/resolv.conf, so we need to replace this as well in case.

@MichaIng MichaIng changed the title Wireguard config should set DNS to local ip instead of 127.0.0.1 if running local DNS DietPi-Software | WireGuard: Use "DNS = 10.8.0.1", if local DNS is loopback IP Feb 8, 2019
@MichaIng MichaIng changed the title DietPi-Software | WireGuard: Use "DNS = 10.8.0.1", if local DNS is loopback IP DietPi-Software | WireGuard: Use "DNS = 10.8.0.1", if local DNS is loopback IP/localhost Feb 8, 2019
@MichaIng
Copy link
Owner

MichaIng commented Feb 9, 2019

@MichaIng MichaIng changed the title DietPi-Software | WireGuard: Use "DNS = 10.8.0.1", if local DNS is loopback IP/localhost DietPi-Software | WireGuard: Use "DNS = 10.9.0.1", if local DNS is loopback IP/localhost Feb 17, 2019
@MichaIng MichaIng mentioned this issue Mar 3, 2019
@MichaIng MichaIng mentioned this issue Mar 23, 2019
@niwre2019
Copy link

Hello,
since the latest upgrade to DietPi 6.22, my local DNS 192.168.xxx.xxx specified in wg0-client.conf has stopped working. After recovering the last version 6.21 everything works fine again. Does this have to do with these changes and how can I get WireGuard up and running again?
Thank you for your help

@MichaIng
Copy link
Owner

@niwre2019
I believe this is due to a kernel upgrade but missing WireGuard package (kernel module) upgrade. Please see for solution: #2671

@niwre2019
Copy link

niwre2019 commented Apr 15, 2019

I've done the steps, but the problem persists. A correct connection to WireGuard is established, but the DNS resolution no longer exists. I'm back to version 6.21.1 and everything works fine again.

In addition, the following note, the call from external sites through the browser works fine, but access to local IP addresses in my network 192.168.xxx.xxx does not work on the direct IP address and DNS resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐞 Solution available 🥂 Definite solution has been done
Projects
None yet
Development

No branches or pull requests

4 participants