Jump to content

NetworkManager/DNS

From postmarketOS Wiki
Revision as of 12:18, 31 July 2022 by Earboxer (talk | contribs) (dnsmasq)

NetworkManager implements several dns clients.

default

The default method adds the DNS servers from the network connections. It gives a warning that "the libc resolver may not support more than 3 nameservers".

This can have issues with some applications (such as aerc or senpai) as the top 3 DNS servers may be inaccessible over your WiFi network.

(for example T-Mobile adds 4 DNS Servers which are only accessible on their network: https://rudism.com/solving-openvpn-dns-issues-on-android-clients/)

dnsmasq

Setting

dns=dnsmasq

in NetworkManager.conf by default will have issues, as NetworkManager will overwrite the /etc/resolv.conf which dnsmasq needs by default.

edit /etc/dnsmasq.conf

resolv-file=/var/run/NetworkManager/no-stub-resolv.conf

and add it to the default runlevel so openrc will autostart it.

issue: if dnsmasq crashes, network related things will totally fail to work.

With the above configuration, it's always crashing on boot... almost-certainly because /var/run/NetworkManager/no-stub-resolv.conf doesn't exist yet. To work around this, edit /etc/init.d/dnsmasq and add

supervisor=supervise-daemon
respawn_delay=2
# respawn_max defaults to 10, so this effectively gives NetworkManager 20 seconds to create the file


There might also be a problem with receiving MMS when connected to wifi (e.g. if your carrier's MMS server name will only resolve on their DNS server). There's a config option that tells it to check all DNS servers (instead of the presumed fastest one) which we should probably also set to handle this case.