You are not logged in.

#1 2019-03-30 13:57:20

chrisdb
Member
From: Belgium
Registered: 2018-05-16
Posts: 155

[SOLVED] Systemd-resolved mode

Hi,

I'm planning on using systemd-networkd in combination with systemd-resolved, but I'm not sure which mode of the following (I'm only listing 2) to use for resolved:

/ETC/RESOLV.CONF
Four modes of handling /etc/resolv.conf (see resolv.conf(5)) are supported:
•systemd-resolved maintains the /run/systemd/resolve/stub-resolv.conf file for compatibility with traditional Linux programs. This file may be symlinked from /etc/resolv.conf. This file lists the 127.0.0.53 DNS stub (see above) as the only DNS server. It also contains a list of search domains that are in use by systemd-resolved. The list of search domains is always kept up-to-date. Note that /run/systemd/resolve/stub-resolv.conf should not be used directly by applications, but only through a symlink from /etc/resolv.conf. This file may be symlinked from /etc/resolv.conf in order to connect all local clients that bypass local DNS APIs to systemd-resolved with correct search domains settings. This mode of operation is recommended.

•systemd-resolved maintains the /run/systemd/resolve/resolv.conf file for compatibility with traditional Linux programs. This file may be symlinked from /etc/resolv.conf and is always kept up-to-date, containing information about all known DNS servers. Note the file format's limitations: it does not know a concept of per-interface DNS servers and hence only contains system-wide DNS server definitions. Note that /run/systemd/resolve/resolv.conf should not be used directly by applications, but only through a symlink from /etc/resolv.conf. If this mode of operation is used local clients that bypass any local DNS API will also bypass systemd-resolved and will talk directly to the known DNS servers.

What's the difference if I use the Stub or not?
Is it just caching?

I only want to use the DNS provided bij my ISP.

Thx

Last edited by chrisdb (2019-04-01 07:43:46)


Failure is success in progress.
A.E.

Offline

#2 2019-03-30 14:07:22

seth
Member
Registered: 2012-09-03
Posts: 61,191

Offline

#3 2019-03-30 14:19:27

chrisdb
Member
From: Belgium
Registered: 2018-05-16
Posts: 155

Re: [SOLVED] Systemd-resolved mode

Yes I did smile

The second mode I was referring to is not listed on the wiki.

I can't seem tot find out what the stub listener on 127.0.0.1:53 actuallly provides extra instead of just using

/run/systemd/resolve/resolv.conf

Failure is success in progress.
A.E.

Offline

#4 2019-03-30 14:31:11

seth
Member
Registered: 2012-09-03
Posts: 61,191

Re: [SOLVED] Systemd-resolved mode

Outrageous! What a crap wiki ;-)

The difference is that clients that directly use resolve.conf won't use systemd-resolved (no caching, but a sane DNS cascade) in the second setup.
If you don't know, why you would want that, then you don't want that.

Offline

#5 2019-03-30 15:35:33

chrisdb
Member
From: Belgium
Registered: 2018-05-16
Posts: 155

Re: [SOLVED] Systemd-resolved mode

seth wrote:

Outrageous! What a crap wiki ;-)

The difference is that clients that directly use resolve.conf won't use systemd-resolved (no caching, but a sane DNS cascade) in the second setup.
If you don't know, why you would want that, then you don't want that.

Which second setup are you referring to smile
Mine or the wiki...

Is it correct that system.networkd provides DNS from my ISP through DHCP and that systemd-resolved uses this to create '/run/systemd/resolve/resolv.conf' entries?


Failure is success in progress.
A.E.

Offline

#6 2019-03-30 15:47:11

seth
Member
Registered: 2012-09-03
Posts: 61,191

Re: [SOLVED] Systemd-resolved mode

Yours.
Whether and which DNS server is obtained through DHCP depends on your DHCP server - but that would be the typical behavior of an ISP issued router, yes.

It's however irrelevant to your question. systemd-resolved is a local DNS proxy that feeds itself from some actual DNS server (your ISPs)
Clients will then ask this localhost server for DNS resolution and it will either answer out of its cache or ask your ISPs DNS server.
If you want to use your ISPs server w/o any caching, dono't use system-resolved at all.

Notice that some consumer router-combos also provide DNS, typically using dnsmasq (a more capable dns proxy w/ a non-retarded DNS cascade…)
In this case your DHCP issued DNS server is some LAN address (eg. 192.168.1.1) and benefits of local dns proxys like resolved are neglectable.

Offline

#7 2019-03-30 16:00:34

chrisdb
Member
From: Belgium
Registered: 2018-05-16
Posts: 155

Re: [SOLVED] Systemd-resolved mode

seth wrote:

Yours.
Whether and which DNS server is obtained through DHCP depends on your DHCP server - but that would be the typical behavior of an ISP issued router, yes.

It's however irrelevant to your question. systemd-resolved is a local DNS proxy that feeds itself from some actual DNS server (your ISPs)
Clients will then ask this localhost server for DNS resolution and it will either answer out of its cache or ask your ISPs DNS server.
If you want to use your ISPs server w/o any caching, dono't use system-resolved at all.

Notice that some consumer router-combos also provide DNS, typically using dnsmasq (a more capable dns proxy w/ a non-retarded DNS cascade…)
In this case your DHCP issued DNS server is some LAN address (eg. 192.168.1.1) and benefits of local dns proxys like resolved are neglectable.

Ok thank you it's more clear now smile

So if I don't use systemd-resolved, which process will get my ISP DNS addresses then and fill it in /etc/resolv.conf?

Last edited by chrisdb (2019-03-30 16:01:10)


Failure is success in progress.
A.E.

Offline

#8 2019-03-30 16:05:28

seth
Member
Registered: 2012-09-03
Posts: 61,191

Re: [SOLVED] Systemd-resolved mode

If you obtain it via dhcp, whatever you use to configure your network (and even networkmanager and netctl can/will operate on dhcpcd or dhclient)
Ultimately the file will typically be written by resolvconf from the openresolv package.

Offline

#9 2019-03-30 16:27:15

chrisdb
Member
From: Belgium
Registered: 2018-05-16
Posts: 155

Re: [SOLVED] Systemd-resolved mode

seth wrote:

If you obtain it via dhcp, whatever you use to configure your network (and even networkmanager and netctl can/will operate on dhcpcd or dhclient)
Ultimately the file will typically be written by resolvconf from the openresolv package.

I would use systemd.networkd smile


Failure is success in progress.
A.E.

Offline

#10 2019-03-31 06:24:11

chrisdb
Member
From: Belgium
Registered: 2018-05-16
Posts: 155

Re: [SOLVED] Systemd-resolved mode

Sorry for the double post...

Just tried system.networkd without systemd.resolved yesterday and DNS resolving did not work...

There was nothing maintaining '/etc/resolve.conf'

I had to explicitly install resolved.


Failure is success in progress.
A.E.

Offline

#11 2019-03-31 07:42:52

seth
Member
Registered: 2012-09-03
Posts: 61,191

Re: [SOLVED] Systemd-resolved mode

Yeah, sorry - I took that for implied: systemd-networkd in particular relies on systemd-resolved to obtain the DNS servers.
The wiki btw. states *that* ;-)

Once you bite into lennarts world, you got to chew all of it.

Offline

#12 2019-04-01 07:31:32

chrisdb
Member
From: Belgium
Registered: 2018-05-16
Posts: 155

Re: [SOLVED] Systemd-resolved mode

Ok I'm getting into it smile

One last question, if I don't want the extra's of resolved, I can just disable systemd-resolved and use systemd-networkd in combination with openresolv instead right?


Failure is success in progress.
A.E.

Offline

#13 2019-04-01 07:39:05

seth
Member
Registered: 2012-09-03
Posts: 61,191

Re: [SOLVED] Systemd-resolved mode

You can just use dhcpcd or netctl (if you want a more dynamic setup w/ flexible wifi) - I don't think that system-network integrates very well w/ other tools.
Of course, if you just write a static resolve.conf, you don't need anything to configure your DNS - it's just not configured via dhcpcd but by you.

What is best for you, entirely depends on your network layout and use cases - there's no "right" way to configure your network.

Offline

#14 2019-04-01 07:43:21

chrisdb
Member
From: Belgium
Registered: 2018-05-16
Posts: 155

Re: [SOLVED] Systemd-resolved mode

Great, thanks for the answers seth!


Failure is success in progress.
A.E.

Offline

Board footer

Powered by FluxBB