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

Chris Green cl at isbd.net
Sun Jun 4 09:06:00 UTC 2017


On Sun, Jun 04, 2017 at 09:46:54AM +0200, Xen wrote:
> 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.
> 
Very useful!  :-)

However what I actually want is for the 'as delivered' system (or at
least one with as little modification as possible) to resolve
unqualified names, like the old system used to.

-- 
Chris Green




More information about the ubuntu-users mailing list