Name resolution on vanilla installation. nss-mdns/avahai? Further info requested onoperation.

Hi,

I’m trying to determine how name resolution is configured on a default fresh install of Leap 15. (Workstation only,not server so I am not using yast2-dns or configuring as a DNS server)

lsof -i -n does not show anything activity on port 53 but does show avahi-daemon active on 5353
“nss-mdns” is installed and systemd-resolved is not active?

I’m confused. Does systemd have any involvement in name resolution? What programs are involved resolving host names for local applications?

Thanks (and thanks again for a great system - so far Leap 15 is working splendidly)
PhilV

The DNS servers that are used are configured in /etc/resolv.conf. Thus they will be shown with:

grep -v '^#' /etc/resolv.conf

The sequence to be used when resolving (e.g. first /etc/hosts and then DNS or other) is configured in /etc/nsswitch.conf, but not many do any change there. You see the relevant line with:

grep '^hosts' /etc/nsswitch.conf

And /etc/resolv.conf is generated automatically by netconfig that is run when the network service is started.

systemd is not involved here other that it starts the network service. (unless you manually enable systemd’s networkd, which is disabled by default and not really supported yet either, systemd-resolvd is not even included in Leap 15 I think)

How/where from the DNS servers come, depends on your network configuration. By default, DHCP is used for that.
There are two different network services in openSUSE though (3 if you count systemd’s networkd as well), the configuration differs depending on which one you use.
Wicked can be configured in YaST, while your desktop should provide an applet or tool to configure NetworkManager.

Avahi is a mean to discover services (like printers e.g.) in the network automatically, but it doesn’t really have to do anything with the standard name resolution.

Very little needs to be configured. You do need nameserver entries in “/etc/resolv.conf”. That information typically comes from your network DHCP server.

lsof -i -n does not show anything activity on port 53 but does show avahi-daemon active on 5353
“nss-mdns” is installed and systemd-resolved is not active?

A typical program calls a library function such as gethostbyname() to resolve a hostname to an IP address.

From there, I’m not quite sure what happens. I think gethostbyname() will ask nscd if that daemon is running, and will otherwise make a DNS lookup. If nscd is used, then nscd probably does the DNS lookup. A DNS lookup opens a udp socket to the nameserver (as configured in “/etc/resolv.conf”), and likely closes that udp socket when the lookup is done. That udp socket would contact port 53 at the nameserver (the remote site). Nothing needs to be using local port 53 unless you run your own DNS server.

You can watch the DNS communication on the fly with something like

tcpdump -i eth0 udp port 53