nameserver into dhcpcd.conf vs resolv.conf

when I configure my networking information with static DNS,
the dhcpcd.conf still use static domain_name_servers= instead of the nameserver I wrote.

I used the dietpi-config / 7 / Ethernet method.

/etc/resolv.conf was updated … but I feel it take 2 tries to really update that file.


If you are using static addresses, why are you invoking dhcpcd? This would be used in case of dhcp.

dhcpcd.conf is used to configure static IP address, router address, and name server.

It’s a feature, though I don’t know why someone would use dhcpcd to configure static IP.
What dietpi does when you select static IP in dietpi-config - Network Option Adapters is to write in the default /etc/network/interfaces and /etc/resolv.conf

This method is used by Raspberry Pi OS and Debian
to have a mix of dhcp and static clients on multiple nic at the same time.

I understand now that dietpi use dhcpcd.conf for dhcp client only
and the classic /etc/network/interfaces and /etc/resolv.conf for static ip.

all good.

dhcpcd.conf is not touched/used/created by DietPi. If you create it yourself, it will overwrite other settings. For setting up STATIC IP, simply use dietpi-config

I did not manually changed this file.
And I can confirm that dhcpcd.conf file was changed base on dietpi-config execution.

There is a “static routers” info in dhcpcd.conf and this is exactly what I input to dietpi-config while I configured my static networking information.

I did a test on a RPI3B 32bit and the file was not there even on STATIC IP. Did you have installed stuf like PiHole??

re-installing in progress …

Fresh install base on DietPi_RPi-ARMv8-Buster.7z 2021-04-22.
First boot and continu DietPi as a pure minimal image.
no /etc/dhcpcd.conf

config static + hostname … still all good.

waiting for my dietpi-software install 66 162 93 21
and yes pi-hole is involve into this process

bingo …

/etc/dhcpcd.conf was created right after pi-hole is installed.
The Upstream Quad9 (filtered, DNSSEC) nameserver was writtend down into the option
static domain_name_servers=

probably PiHole installer is writing it down based on what was selected during install process.

base on pi-hole git … the setDHCPCD fonction inside pi-hole/automated install/ create this file.

yep that’s the script DietPi is using to install PiHole. Basically that’s what is used


which will result in

I re-installed and set a static ip on dietpi.
will see if pi-hole create again this dhcpcd.conf.

in the past PiHole even changed DNS resolution to localhost but this changed in meantime