Repository navigation
how to set dns resolver for nebula tun interface #1941
the conditionif we want to set domain names and developers be able to resolve them instead of dealing with IPs, a dns server is needed to resolve dumy domain names
since we do not own these domains, we have our own private DNS servers mapping dummy names to private IPS. the problemTesting Nebula app on Linux, Windows, Android, iOS showed that only Linux is reliability handling DNS quires if the user sets the private DNS server (e.g # /etc/resolve.conf
nameserver 192.168.168.254capture 8.8.8.8 and 1.1.1.1To not force users changing/setting their default dns servers, the users certificates are issued with unsafe-networks "unsafeNetworks": [
"1.1.1.0/24",
"8.8.8.0/24"
]and yaml setting , so if users using 8.8.8.8 or 1.1.1.1, their dns queries come to the nebula network and private domain names are resolved Linuxit works fine with no issue Windowsit does not work since each tun on windows has its own dns server setting. Even if the host or modem advertises 8.8.8.8, 1.1.1.1 sill does not work but can be mitigated using :: ipconfig /all
:: shows the nebula0 tun DNS servers field is empty
:: setting it
netsh interface ipv4 set dns name="nebula0" ...
:: now the neubla0 has DNS serversand then works fine on Windows Androidthe same issue as Windows, except there is no way to set tun interface dns servers here is a test on android adb shell dumpsys connectivity | grep 192.168
NetworkAgentInfo{ ni{[type: VPN[], state: CONNECTED/CONNECTED, reason: agentConnect, extra: (none),
failover: false, available: true, roaming: false]} network{744} nethandle{3198861365261}
lp{{InterfaceName: tun0 LinkAddresses: [ 192.168.168.4/24 ] DnsAddresses: [ ] Domains: MTU: 1300
Routes: [ 192.168.168.0/24 -> 0.0.0.0 tun0 mtu 0,8.8.8.0/24 -> 0.0.0.0 tun0 mtu 0,1.1.1.0/24 -> 0.0.0.0 tun0 mtu 0 ]}}
...
...we can see the iOSit does not work, unless manually DNS server be set to 8.8.8.8, 1.1.1.1 I want to know is there any method to make this working across all devices? Regards |
Replies: 1 comment 2 replies
|
You don't need the 8.8.8.8/1.1.1.1 trick on mobile: the Mobile Nebula app can set the tun interface's DNS servers itself. In the site's settings, go to Advanced → DNS resolvers and add
The nebula daemon itself (Linux/Windows/macOS) has no option to configure system DNS, so that part is up to the OS. Rather than capturing 8.8.8.8, you can do split DNS there too: # Windows: persistent, survives restarts of nebula
Add-DnsClientNrptRule -Namespace ".demo.app" -NameServers "192.168.168.254"# Linux with systemd-resolved
resolvectl dns nebula1 192.168.168.254
resolvectl domain nebula1 '~demo.app'Then you can drop |
You don't need the 8.8.8.8/1.1.1.1 trick on mobile: the Mobile Nebula app can set the tun interface's DNS servers itself. In the site's settings, go to Advanced → DNS resolvers and add
192.168.168.254. Since it's inside your Nebula network, queries go through the tunnel.VpnService.Builder.addDnsServer(), soDnsAddresses: []in yourdumpsysoutput gets filled. Android can't split DNS by domain, so all lookups go to that resolver while the VPN is up, and your DNS server has to forward public names too.demo.appin it and only those names go to your resolver, the rest stays on the normal DNS. Left em…