How do I tell dietpi to use the local name server on my RPi 4B?

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version | cat /boot/dietpi/.version:
  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN: bookworm 0
  • Kernel version | uname --all: Linux dullahan 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
  • Architecture | dpkg --print-architecture: arm64
  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3): RPi 4 Model B (aarch64)
  • Power supply used | (EG: 5V 1A RAVpower): 5V 3A mobile charger
  • SD card used | (EG: SanDisk ultra): Samsung Evo Plus 32GB
G_DIETPI_VERSION_CORE=9
G_DIETPI_VERSION_SUB=6
G_DIETPI_VERSION_RC=1
G_GITBRANCH='master'
G_GITOWNER='MichaIng'

Additional Information (if applicable)

  • Software title | (EG: Nextcloud)
  • Was the software title installed freshly or updated/migrated?
  • Can this issue be replicated on a fresh installation of DietPi?
    ā† If you sent a ā€œdietpi-bugreportā€, please paste the ID here ā†’
  • Bug report ID | echo $G_HW_UUID

Steps to reproduce

N/A

Expected behaviour

N/A

Actual behaviour

N/A

My issue

On my RPi, I run PiHole inside a container with several other containers. My router broadcasts 192.168.0.3 as the DNS server, which is also my Piā€™s IP address. I get internet with this, and all the LAN devices as well. However, the containers are not connected to the 192.168.0.x/24 subnet, so the name resolution fails.

I want to keep things dynamic, so static IP is not a solution. I want to achieve the following:

  • Obtain IP address from router.
  • Override name-server as 127.0.0.1 since PiHole is there.

With this, the name resolution works for the containers too. I would love to hear other solutions for this as well.

Extra details

Here are some related posts:

1 Like

I personally recommend using a static IP address on the device hosting a local DNS server and not using the device itself as its own DNS server. Rather, you should use a global public DNS on the devices hosting your local DNS. Because what happens if your Docker container goes down? Your DNS resolution fails, even on the system where you would need DNS to repair your local DNS service.

My DNS is static indeed. It happens on my router and I donā€™t want to hardcode the RPi IP on the router on my RPi. The point about failure is valid. In that case, I could set a fallback DNS to one of the upstream ones.

If I am not mistaken, you mean to distribute a second DNS server entry via DHCP or to use it on the router. Normally, however, this is not a real fallback, as both DNS servers can be used by the client in parallel. Usually, the fastest one wins or is favored by the clients. But I may also be wrong.

This topic was automatically closed 178 days after the last reply. New replies are no longer allowed.