How to get the systemd resolver to resolve local (i.e. unqalified) names?

Xen list at xenhideout.nl
Sun Jun 4 07:46:54 UTC 2017


Chris Green schreef op 04-06-2017 8:36:

> I do have working DNS, it's just that unqualified names don't get
> looked up, everything else works fine.
> 
> If I edited the above file it would simply get overwritten (as it
> says) and nothing would change.  I'm not quite sure how fast it would
> get overwritten, just at reboot time or more often.  I'm not aiming to
> try as it seems pretty pointless.

That's the point. What overwrites it? Because apparently this file is 
getting used and forwards queries (via systemd). Normally your 
resolv.conf, even when overrwritten, would include a search domain in 
itself.

You could create a systemd path in case you wanted to use that to know 
when it was overwritten :p.

[Path]
PathModified=/etc/resolv.conf

[Install]
WantedBy=default.target


and another file of the same name with suffix .service:

[Unit]
Description=Send an email

[Service]
Type=oneshot
ExecStart=/bin/su root -c '/usr/bin/mail -s changed root < 
/etc/resolv.conf'


that took me way too long to get that working. Mail just doesn't do a 
thing when directly using sh for it.

by using su it works.

So that actually took me 15 minutes to get that working, because systemd 
is so awesome.

In any case, now you get an email on your root account with subject 
"changed" whenever resolv.conf changes :p.

Lol.

You'd put them in /etc/systemd/system and then enable it using systemctl 
enable <name>.path and start it using systemctl start <name>.path




More information about the ubuntu-users mailing list