pihole-kubernetes icon indicating copy to clipboard operation
pihole-kubernetes copied to clipboard

dnsmasq not adding additionalHostsEntries

Open MujiSayed opened this issue 2 years ago • 9 comments

Hello, Not sure what i'm doing wrong, but pihole deploys successfully, but the following section doesn't seem to work. When i visit pihole, and click on local DNS -> DNS Records, this section is empty

dnsmasq:
  # -- Add upstream dns servers. All lines will be added to the pihole dnsmasq configuration
  upstreamServers: []
  # - server=/foo.bar/192.168.178.10
  # - server=/bar.foo/192.168.178.11

  # -- Add custom dns entries to override the dns resolution. All lines will be added to the pihole dnsmasq configuration.
  customDnsEntries: [
  # - address=/foo.bar/192.168.178.10
  # - address=/bar.foo/192.168.178.11

  ]
  # -- Dnsmasq reads the /etc/hosts file to resolve ips. You can add additional entries if you like
  additionalHostsEntries: [
    10.15.15.200    host1.iad
    10.15.15.201    host2.iad
    10.15.15.202    host3.iad
    10.15.15.210    host4.iad
    10.15.15.211    host5.iad
    10.15.15.15      host6.iad
    10.15.15.15      host7.iad
    10.15.15.15      host8.iad
]

Would appreciate any assistance please. Thanks,

MujiSayed avatar Oct 08 '21 14:10 MujiSayed

Im not able to confirm it right now but i think you want to use the customDnsEntries and not additionalHostEntries for adding hosts to local DNS records.

simonosterberg avatar Oct 09 '21 17:10 simonosterberg

tried giving this a shot as well, but am still not seeing anything in the custom list

  customDnsEntries: [
  # - address=/foo.bar/192.168.178.10
  # - address=/bar.foo/192.168.178.11
  address=/host1.iad/10.15.15.200
  ]

also tried this but this resulted in the following error: Error: failed to parse pihole.values.yml: error converting YAML to JSON: yaml: line 264: did not find expected node content

  customDnsEntries: [
  # - address=/foo.bar/192.168.178.10
  # - address=/bar.foo/192.168.178.11
     - address=/host1.iad/10.15.15.200
  ]

MujiSayed avatar Oct 09 '21 22:10 MujiSayed

My custom dns look like this:

dnsmasq:
  customDnsEntries:
    - address=/share.xxx.de/192.168.178.10
    - address=/grafana.xxx.de/192.168.178.60
    - address=/pihole.xxx.de/192.168.178.252
    - address=/openhab.xxx.de/192.168.178.25
    - address=/odroid.xxx.de/192.168.178.26
    - address=/trac.xxx.de/192.168.178.64
  additionalHostsEntries:
    - 192.168.178.10    nas.foo.bar       nas
    - 192.168.178.60    unifi.foo.bar     unifi
    - 192.168.178.61    home.foo.bar      home

Thing is, it works, even when the entries are not shown in the GUI. I do not have a solution for this, but for me it is okay this way.

MoJo2600 avatar Nov 23 '21 12:11 MoJo2600

This is related to #131.

The local DNS records are stored in /etc/pihole/custom.list and the local CNAME records in /etc/dnsmasq.d/05-pihole-custom-cname.conf. The first can be saved by the persistent volume. The second ~~unfortunately not~~ fails to write the changes to the config and does not show a proper error message but shows a green success message.

The values of the section dnsmasq are appended to the dnsmasq configuration. This explains why the custom entries (of @MoJo2600) are working but not showing up in the GUI.

AlexanderLieret avatar Dec 22 '21 12:12 AlexanderLieret

I will test the PR and merge it asap.

MoJo2600 avatar Dec 23 '21 13:12 MoJo2600

Hello,

According my tries the issue continues to exist, but I'm happy to know that the entries should work even if they are not displayed on the GUI :)

What's up on this issue? The PR is opened? Thanks!

Tchoupinax avatar May 21 '22 11:05 Tchoupinax

This is related to #131.

The local DNS records are stored in /etc/pihole/custom.list and the local CNAME records in /etc/dnsmasq.d/05-pihole-custom-cname.conf. The first can be saved by the persistent volume. The second ~unfortunately not~ fails to write the changes to the config and does not show a proper error message but shows a green success message.

The values of the section dnsmasq are appended to the dnsmasq configuration. This explains why the custom entries (of @MoJo2600) are working but not showing up in the GUI.

Hey @AlexanderLieret did you ever resolve this? I have same problem as you

arana198 avatar Jul 03 '23 13:07 arana198

This is related to #269.

perfectra1n avatar Dec 17 '23 00:12 perfectra1n

Since these 2 files have a different format, it would be a nice improvement if the yaml could be improved too. Instead of writing lines like - address=/my.host/192.168.1.1 perhaps this could be changed to:

- host: my.host
  address: 192.168.1.1

Then the formatting can be handled within the template. This would make the values.yaml a bit more readable too.

Similar story for the custom CNAME entries.

xorinzor avatar Feb 17 '24 10:02 xorinzor