Issue resolving locale hostnames
Since some days one of my laptop has the problem to resolve certain hostnames. All hostnames that are without any type TLD like git
or gw
.
The thing is, that the FQDN resolution remained working for the same hosts. Lucky, I have two laptop that did not had the same behaviour but with similar configuration. Running ping
on the first device fails, while the second once succeeds:
One the first laptop is does not work:
ping git -c1
ping: git: Name or service not know
On my other device the same command is running flawless:
ping git -c1
PING git (172.X.Y.Z) 56(84) bytes of data.
64 bytes from 172.X.Y.Z (172.X.Y.Z): icmp_seq=1 ttl=64 time=1.06 ms
--- git ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.055/1.055/1.055/0.000 ms
So what might cause the divergent? After some ideas developed I found a interesting differents: Laptop one has systemd-resolved enabled, the other not:
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-07-02 19:32:51 CEST; 15h ago
Docs: man:systemd-resolved.service(8)
https://www.freedesktop.org/wiki/Software/systemd/resolved
https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
Main PID: 1204 (systemd-resolve)
Status: "Processing requests..."
Tasks: 1 (limit: 18905)
Memory: 13.6M
CGroup: /system.slice/systemd-resolved.service
└─1204 /usr/lib/systemd/systemd-resolved
While the other devices does not have it active:
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:systemd-resolved.service(8)
https://www.freedesktop.org/wiki/Software/systemd/resolved
https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
Disabling the service solve it! The issue was in fact the systemd-resolverd
.
sudo systemctl stop systemd-resolved.service
ping git -c1
PING git (172.X.Y.Z) 56(84) bytes of data.
64 bytes from 172.X.Y.Z (172.X.Y.Z): icmp_seq=1 ttl=64 time=1.06 ms
--- git ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.055/1.055/1.055/0.000 ms
The core question is now: What’s the issue that systemd-resolved
does not resolve the locale host and why was is active on the first device but no other? But this is a question I might answer another time.
best regards
Sources:
- systemd-resolved - ArchWiki
- resolved.conf(5) — Arch manual pages
- Domain name resolution - ArchWiki
- resolved