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

Override local DNS option for Pihole and Adguardhome? #280

Closed
Akruidenberg opened this issue Jan 17, 2022 · 10 comments
Closed

Override local DNS option for Pihole and Adguardhome? #280

Akruidenberg opened this issue Jan 17, 2022 · 10 comments
Labels
enhancement New feature or request

Comments

@Akruidenberg
Copy link

I would like to add my Adguard server to Headscale/Tailscale. However, i need an option for my clients to only use my own DNS server.
I can't find such option in Headscale, Tailscale does have this option.
Is it possible to add this option to Headscale?

Thanks in advance!

@Akruidenberg Akruidenberg added the enhancement New feature or request label Jan 17, 2022
@asabla
Copy link

asabla commented Jan 18, 2022

Not sure if this is actually what you're looking for, but in the example configuration on line ~120. There are DNS-configuration settings

https://github.com/juanfont/headscale/blob/main/config-example.yaml#L120

@Akruidenberg
Copy link
Author

My clients are connected to my adguard home dns. However, they are not forced to use the adguard dns only. That's why I need an override option for this.

@gmmoreira
Copy link

Tailscale admin panel has an option to override local DNS. The option forces the client to always use the configure DNS in tailscale admin and ignore local DNS.

I also used this option in tailscale so I could use my unbound+hblock DNS in any of my clients, even outside of my home.

@Akruidenberg
Copy link
Author

@gmmoreira this is exactly what I want. I would such option in headscale.

@Goeks1
Copy link

Goeks1 commented Jan 19, 2022

I think @asabla's comment is exactly what you are looking for. Its expose and overwrite the DNS addresses. As I can see you are able a list of DNS servers

@Akruidenberg
Copy link
Author

Akruidenberg commented Jan 19, 2022

@Goeks1 that's not true. It will add my adguard server to my existing DNS servers from My router, but they aren't override.

@Akruidenberg
Copy link
Author

@kradalby is it possible to add this feature?

@gmmoreira
Copy link

To clarify the matter: https://github.com/tailscale/tailscale-android/blob/main/android/src/main/java/com/tailscale/ipn/DnsConfig.java

Tailscale's DNS support can either override the local DNS servers with a set of servers
configured in the admin panel, or supplement the local DNS servers with additional
servers for specific domains like example.com.beta.tailscale.net. In the non-override mode,
we need to retrieve the current set of DNS servers from the platform. These will typically
be the DNS servers received from DHCP.

Anyway, I think I have solved my problem. I could not use any of my hosted services when using mobile data. My only external client is my android smartphone and I already the app customized. In my headscale config.yml I have the nameservers key with the tailscale ip address of my dns server.

dns_config:
  # List of DNS servers to expose to clients.
  nameservers:
    - 100.64.x.y

I took a look in the app source code and noticed it will log the dns configuration when the vpn starts. I them used adb logcat and noticed it was indeed receiving the ip address of my dns, but in url format (http://100.64.x.y:58436/dns-query). I confirmed my server was indeed listening to that port. After some research I discovered that url path is for DNS over HTTP(s). I confirmed it was receiving queries running tcpdump on that port.

My unbound has some local entries, pointing to the ip address of my router DHCP range. The missing piece was running tailscale in my server advertising that ip range route.

sudo tailscale up --accept-dns=false --advertise-exit-node --advertise-routes=192.168.x.y/24

By allowing that route in headscale I could finally resolve and connect to my web services. I'm still not sure if it's overriding all DNS to use only my configured one.

@Akruidenberg
Copy link
Author

Here is another article:
https://tailscale.com/kb/1114/pi-hole/

All the features are available in headscale except the override option. It would be really nice to have.

@mlincett
Copy link

As a workaround, it should be possible to set it manually with resolvectl -a wg0 -x (similar syntax for resolvconf).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants