If I point my phone to YunoHost server with DNSmasq, will it act as a DNS?

[FR]
Traduit avec Google Translate. Je m’excuse si j’ai accidentellement dit quelque chose de méchant à propos de votre mère … o.O En tout cas …

J’essaie de résoudre un problème où mon routeur n’a pas de bouclage en épingle à cheveux / NAT et je ne peux pas éditer le fichier / etc / hosts sur mon téléphone sans racine. Pour cette raison, mon téléphone ne peut pas accéder à mes domaines lorsque je suis chez moi avec le wifi à la maison.

Je pense cependant avoir trouvé une solution. Cela semble-t-il fonctionner?

  1. Configurez DNSmasq pour faire pointer mes domaines Yunohost vers l’adresse IP interne du serveur YunoHost au lieu de l’adresse IP publique.
  2. [Nebulo] (https://git.frostnerd.com/PublicAndroidApps/smokescreen) est une application FOSS Android, qui vous permet d’indiquer à votre téléphone d’utiliser un DNS spécifique pour des noms de domaine spécifiques. Pointez-le sur mon serveur YunoHost pour mes domaines YunoHost.
  3. Bénéfice?

[EN]
Translated with Google Translate. I appologize if I have accidentally said anything nasty about your mother… o.O Anyway…

I’m trying to get around a problem where my router doesn’t have hairpinning / NAT loopback, and I can’t edit the /etc/hosts on my unrooted phone. Because of this, my phone can’t access my domains when I’m at home on my home wifi.

I think I may have found a solution though. Does this sound like it would work?

  1. Configure DNSmasq to point my Yunohost domains to the YunoHost server internal IP address instead of the public IP address.
  2. Nebulo is a FOSS android app, which lets you tell your phone to use a specific DNS for specific domain names. Point it to my YunoHost server for my YunoHost domains.
  3. Profit?

Hmmm I’m not 100% familiar with all that stuff but maybe what you’re looking for is something like Pi-hole https://github.com/YunoHost-Apps/pihole_ynh - though maybe it does too much stuff compared to what you’re looking for.

Otherwise yup, you could tweak DNSmasq’s conf so that it acts as a resolver, idk if that’d work out of the box or require a lot of tweaking.

I have recently implemented this at home. But I only needed to configure DNSmasq. My phone (with Samsung default ROM) remembers the DNS settings per WiFi network. I only had to set the YNH server’s IP address in the DNS field of the WiFi configuration once. (No need for additional app)

Maniack_Crudelis’ tutorial was enough for me to set everything up. It is in French though, don’t hesitate to let us know if you need a translation.

Thanks @tituspijean! This looks very useful!

I have a Samsung phone with Android 9. Where are you changing the DNS settings? The closest thing I can see is under Connections>WiFi>{My SSID}>Advanced>Proxy>Manual but I don’t see any mention of where to put a DNS server IP, just a proxy.

Is this it?

Ah, my bad, you need to set a static IP address to be able to change the DNS servers in the Advanced menu.

192.168.1.65 is my server’s IP address. I put 1.1.1.1 as backup.

Ah! Perfect! Thank you! Now I need to run to work, but looking forward to configuring DNSmasq and trying this out when I get home. :smiley:

1 Like

That page seems to say to edit /etc/resolv.conf but the contents of that file say:

#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

So… did you edit /etc/resolv.conf as well, or just the modifications they suggest to /etc/dnsmasq.conf…

Mine does not have this warning, weird. /etc/resolv.conf:

domain your.domain.tld
search your.domain.tld

# French association FDN open DNS
nameserver 80.67.169.12
nameserver 80.67.169.40

/etc/dnsmasq.conf :

domain-needed
bogus-priv
strict-order
expand-hosts

listen-address=127.0.0.1
listen-address=192.168.1.1
interface=eth0
domain=your.domain.tld
cache-size=500
resolv-file=/etc/resolv.dnsmasq.conf

In /etc/hosts, add: your.server.ip your.domain.tld

@tituspijean What version of YunoHost / DNSmasq do you have?

Yunohost v3.6.4.6
DNSmasq v2.76

That’s weird. Same versions here. Mine is a brand new install of everything, so the only thing I can think of is that maybe you had an older version you upgraded and it kept the old config file?

I guess I can just try copying yours and see what happens…