Static IP and DNS name?


I was wondering if anyone could help clarify the following for me. So I set my pi with static ip and use my routers DNS ip address as per the below.

sudo nano /etc/dhcpcd.conf

#static IP configuration

interface eth0

static ip_address=

static routers=

static domain_name_servers= Question 1>> should i change this to (local ip of pi) if pihole as normal.
Question 2>>> should i change the last line above to if running unbound server with FTLDNS?

Please let me know.


You should have
static domain_name_servers=
which is the localhost address of RaspberyPi

What would be the reason for this? pihole is running independent of pi, and surely pi itself has to resolve to the router dns or atleast pihole’s local ip address rather than resolver? I am just curious to know why you think it should be is there a documentation for this? is used locally on the pi so it goes to loopback rather than potentially a rogue IP on your network. it is considered best practice when running a local resolver such as Pi-hole. running unbound (i do the same) does not affect this as that is a Pi-hole setting

thank you for clarifying. but if i wasn’t running resolver/unbound then should i use the local ip address of pi or still

Yes the point i was trying to make is that internally on you pi you should be using the loopback interface. On all other devices you should be using your Pi’s IP address

Setting your pi to use its own IP address would work however if that ip changes for some reason that breaks all of those instances rather than which will never change

no worries it happens will remove the two ignore this posts

My Raspberry Pi runs Pihole as DHCP & DNS server, it has a static IP address My Router also has a static IP address where DHCP and DNS is disabled, and below is my /etc/dhcpcd.conf file:

interface eth0
static ip_address=
static routers=
static domain_name_servers=

Hi - Setting as DNS means name resolution will not work if pihole is not installed and running correct? (or some other resolver)? Should you then in that .conf file add a backup 2nd entry for DNS, ie or something? I wonder if this is why updating pihole failed when i tried it a while back (since started from scratch with a fresh install).


Strange, because i just added as a 2nd entry, rebooted and still get:

static domain_name_servers=

ping: Temporary failure in name resolution