[systemd-devel] nss-mymachines: slow name resolution

Kai Krakow hurikhan77 at gmail.com
Sun Feb 14 14:55:28 UTC 2016


Am Sun, 14 Feb 2016 13:49:01 +0100
schrieb Kai Krakow <hurikhan77 at gmail.com>:

> Hello!
> 
> I've followed the man page guide to setup mymachines name resolution
> in nsswitch.conf. It works. But it takes around 4-5 seconds to
> resolve a name. This is unexpected and cannot be used in production.
> 
> I'm using systemd-networkd and systemd-resolved.

Some further investigation shows it is exactly 5 seconds because that
is the timeout e.g. "ping" and "ssh" use for the poll() call when I
strace the programs.

I then tried "ltrace" and it shows hanging in gethostbyname().

This behaviour is independent of resolver order in nsswitch.conf.

In contrast:

dig immediately returns, with expected result NXDOMAIN has my nspawns
machines are not registered in a DNS zone.

"getent hosts" returns immediately, yielding the correct IP.

gethostip shows the same behavior as ping and ssh.

What is special in this case? Why the timeout of 5 seconds?

> This is my config:
> 
> # /etc/nsswitch.conf:
> #
> $Header: /var/cvsroot/gentoo/src/patchsets/glibc/extra/etc/nsswitch.conf,v
> 1.1 2006/09/29 23:52:23 vapier Exp $
> 
> passwd:      compat mymachines
> shadow:      compat
> group:       compat mymachines
> 
> # passwd:    db files nis
> # shadow:    db files nis
> # group:     db files nis
> 
> hosts:       files resolve mymachines myhostname
> networks:    files
> 
> services:    db files
> protocols:   db files
> rpc:         db files
> ethers:      db files
> netmasks:    files
> netgroup:    files
> bootparams:  files
> 
> automount:   files
> aliases:     files
> 
> 
> Not sure if the errors below are related:
> 
> $ systemctl status systemd-{network,resolve}d
> ● systemd-networkd.service - Network Service
>    Loaded: loaded
> (/usr/lib64/systemd/system/systemd-networkd.service; enabled; vendor
> preset: enabled) Active: active (running) since Sa 2016-02-13
> 13:40:51 CET; 24h ago Docs: man:systemd-networkd.service(8) Main PID:
> 763 (systemd-network) Status: "Processing requests..."
>     Tasks: 1 (limit: 512)
>    Memory: 1.1M
>       CPU: 400ms
>    CGroup: /system.slice/systemd-networkd.service
>            └─763 /usr/lib/systemd/systemd-networkd
> 
> Feb 14 13:11:27 jupiter.sol.local systemd-networkd[763]: Could not
> send rtnetlink message: Invalid argument Feb 14 13:11:27
> jupiter.sol.local systemd-networkd[763]: Could not remove route:
> Invalid argument Feb 14 13:18:22 jupiter.sol.local
> systemd-networkd[763]: Could not send rtnetlink message: Invalid
> argument Feb 14 13:18:22 jupiter.sol.local systemd-networkd[763]:
> Could not remove route: Invalid argument Feb 14 13:25:43
> jupiter.sol.local systemd-networkd[763]: Could not send rtnetlink
> message: Invalid argument Feb 14 13:25:43 jupiter.sol.local
> systemd-networkd[763]: Could not remove route: Invalid argument Feb
> 14 13:30:23 jupiter.sol.local systemd-networkd[763]: Could not send
> rtnetlink message: Invalid argument Feb 14 13:30:23 jupiter.sol.local
> systemd-networkd[763]: Could not remove route: Invalid argument Feb
> 14 13:39:57 jupiter.sol.local systemd-networkd[763]: Could not send
> rtnetlink message: Invalid argument Feb 14 13:39:57 jupiter.sol.local
> systemd-networkd[763]: Could not remove route: Invalid argument
> 
> ● systemd-resolved.service - Network Name Resolution
>    Loaded: loaded
> (/usr/lib64/systemd/system/systemd-resolved.service; enabled; vendor
> preset: enabled) Active: active (running) since Sa 2016-02-13
> 13:40:51 CET; 24h ago Docs: man:systemd-resolved.service(8) Main PID:
> 824 (systemd-resolve) Status: "Processing requests..."
>     Tasks: 1 (limit: 512)
>    Memory: 1.0M
>       CPU: 2.122s
>    CGroup: /system.slice/systemd-resolved.service
>            └─824 /usr/lib/systemd/systemd-resolved
> 
> Feb 13 13:40:51 jupiter.sol.local systemd[1]: Starting Network Name
> Resolution... Feb 13 13:40:51 jupiter.sol.local
> systemd-resolved[824]: Using system hostname 'jupiter'. Feb 13
> 13:40:51 jupiter.sol.local systemd[1]: Started Network Name
> Resolution. Feb 13 13:40:56 jupiter.sol.local systemd-resolved[824]:
> Switching to DNS server 192.168.4.254 for interface enp5s0.

-- 
Regards,
Kai

Replies to list-only preferred.




More information about the systemd-devel mailing list