You are not logged in.

#1 2015-10-04 18:28:24

jfjallid
Member
Registered: 2015-10-04
Posts: 7

[Solved] No dns lookup with resolve in nsswitch.conf

Hi!

I'm trying to set up my computer to get ip, domain name and dns server from DHCP server. I'm using systemd-networkd with basic dhcp settings:

/etc/systemd/network/MyDhcp.network
------------------
[Match]
Name=en*

[Network]
DHCP=ipv4

The service is enabled and I get my ip address fine but the problem is with systemd-resolved.
When I enable systemd-resolved and set up a symlink from /run/systemd/resolve/resolv.conf to /etc/resolv.conf I can lookup dns names both from the Internet and locally but only if I type in the FQDN.
I read that I should update /etc/nsswitch.conf with the following:

hosts: files dns myhostname <-- old
hosts : files resolve mymachines myhostname <--- New

Problem is that with that config I get no dns at all. Whatever I try to ping I get "System error".

I want to be able to ping e.g. "server" instead of "server.mydomain" but I can't get it to work. Any help would be much appreciated!

Last edited by jfjallid (2015-10-10 16:55:40)

Offline

#2 2015-10-04 22:45:05

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: [Solved] No dns lookup with resolve in nsswitch.conf


1000

Offline

#3 2015-10-05 07:54:35

jfjallid
Member
Registered: 2015-10-04
Posts: 7

Re: [Solved] No dns lookup with resolve in nsswitch.conf

I got it to work by adding:

[DHCP]
UseDomains=true

to /etc/systemd/network/MyDhcp.network
and reverting back to "hosts: files dns myhostname" in /etc/nsswitch.conf.

I'm still a bit confused as to when the resolve module should be used instead of dns in nsswitch.conf. When would that be used?

Offline

#4 2015-10-06 00:04:38

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: [Solved] No dns lookup with resolve in nsswitch.conf

systemd-resolved implements caching.


1000

Offline

Board footer

Powered by FluxBB