[systemd-devel] Systemd-networkd: Prepend static nameserver to DHCP-discovered nameservers

Runiq runiq at archlinux.us
Wed Jun 18 08:51:40 PDT 2014


On 17.06.2014 14:43:25, Mantas Mikulėnas wrote:
>On Jun 17, 2014 2:14 PM, "Runiq" <runiq at archlinux.us> wrote:
>
>> Hello all,
>>
>> I'm using systemd 213 on Arch Linux, and systemd-networkd/resolved with
>> DHCP to connect to the internet. I'm also running a caching DNS server on
>> 127.0.0.1.
>>
>> I'd like to make this caching server the first DNS server in the list, but
>> I'd also like to use the nameservers discovered by systemd-resolved. Using
>> a static resolv.conf isn't really possible, because I connect to networks
>> with different DNS settings.
>
>Actually, one thing I just remembered.
>
>resolved never actually writes to /etc/resolv.conf, if I remember 
>correctly. It only writes to a .conf in /run, and /etc/resolv.conf is 
>just a symlink to the latter.

I know, I set that symlink up manually because I wasn't sure whether the 
file in /run would be created at all if the symlink wasn't in place. The 
manpage for systemd-resolved also states that the resolv.conf file in 
/run shouldn't be used directly but only by symlinking it to 
/etc/resolv.conf -- so I thought I'd ask on the mailing list before 
doing what you describe:

>So you could just have a static /etc/resolv.conf with 127.0.0.1 in it, 
>and tell your cache to look in /run/systemd/resolv.conf for the 
>upstream servers' addresses. I'm sure at least dnsmasq has that 
>ability.

Yep, that's basically what I'm doing now after looking over the dnsmasq 
config file (I symlinked /run/systemd/network/resolv.conf to 
/etc/resolv-networkd.conf and use that). Thanks for pointing me into 
this direction, everything works as intended now!

Cheers,
Patrice
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140618/0b74d48e/attachment-0001.sig>


More information about the systemd-devel mailing list