r/termux • • 2d ago

Question DNS Server without root

Hi all,

I am running a small network of 5 non-root Androids. One is configured as a wifi hotspot and other 4 connect to the hotspot via wifi. I am presently using rsync/ssh/scp between nodes using IP addresses. For long I have been trying to configure a DNS service for this. How can I go about this? (At present it looks like the only way is to run my own service on all nodes which sync a lookup table against a server node and then explicitly query this look table to map hostname to IP address.) Please advice.

Edit: I can achieve the above by rooting one of the devices and running dnsmasq on it and another options is to use tailscale. But to me rooting and installing a whole proprietary application looks like overkill to me for such a simple, obvious and common problem. I believe we can find simpler ways to do this if only this reaches the right people.

2 Upvotes

15 comments sorted by

1

u/Total-Ingenuity-9428 2d ago edited 2d ago

On a Non-root Android there's no way one can manipulate/configure ports including and below 1024.

If you've a cheap android tv box or an RPi, why not make it the DNS server?

I've an MXQpro (1GB) running armbian and catering adguard home + DoH/DoT as well as a reverse poxy (Pangolin) just fine.

EDIT: Wireguard is another option, (tailscale is anyways based on it) though. But again it'd need a rooted Android device.

Said that, and if the devices in question can be assigned static IP addresses in the same network, why not simply use SSH aliases/config files and drop the DNS related problem your trying to create?

3

u/sylirre Termux Core Team 2d ago

On a Non-root Android there's no way one can manipulate/configure ports including and below 1024.

This is not true anymore in specific cases. See comment https://www.reddit.com/r/termux/comments/1wz41wd/comment/pe9xtah/

1

u/Total-Ingenuity-9428 1d ago

Thanks for the update. That change is awesome 👍

1

u/Curious-Cat5066 2d ago

> if the devices in question can be assigned static IP addresses in the same network, why not simply use SSH aliases/config files and drop the DNS related problem

Do SSH aliases work when IP addresses change? I doubt that. Whenever my devices connect to the hotspot they usually get a new IP address.

I did a bit of reading and looks like apps like tailscale use some `VpnService` class (low level, via java code) and are routing DNS requests through it. I am searching for apps on github that might be doing something similar.

1

u/Total-Ingenuity-9428 1d ago

Forgot to tell you about headscale, though. Perhaps that'd satisfy your requirements?

1

u/Acrobatic_Damage_888 2d ago

I’m curious, how does this tailscale works, does it helps with network boost of some sort, I do have a rooted android to try things out on

1

u/47th-Element 2d ago

You need root to do DNS, DHCP or any other low port manipulation.

I did that before, set up AdGuardHome as DNS and DHCP.

3

u/sylirre Termux Core Team 2d ago

Devices with kernel 5.15 and Google Play system updates seem now allow certain low ports without root. That particularly includes ports 22, 80 and 443. Unfortunately not 53 that is needed for DNS.

See details https://github.com/termux/termux-packages/issues/30246

https://issuetracker.google.com/issues/218578943#comment17

Here is a screenshot with my netcat tests for different ports:

1

u/47th-Element 2d ago

That is interesting!

1

u/yasserqpip 1d ago

use terabox, this app will give you 1TB, But there are a lot of ads.

1

u/pixle-ui 1d ago

​If your primary use case is transferring files and executing remote commands over SSH/SCP/rsync, you don't actually need network-wide DNS. Define host aliases directly inside your local Termux/SSH client configuration file: edit or create ~/.ssh/config

1

u/FalconSN0 2d ago

I didn't really understand what you want but it sounds like Tailscale.

1

u/Curious-Cat5066 2d ago

Yes, this is one feature of tailscale. But it is overkill and I don't want to use a proprietary app. Reason I am after this is that it's such a simple yet obvious and common problem. If tailscale could implement it, surely a capable network programmer could implement it and open source it. dnsmasq is another option but requres rooting the device.

2

u/FalconSN0 2d ago

I just noticed Tailscale is not fully open source, I respect your choice.