Problem with pdnsd

Soldato
Joined
2 Dec 2005
Posts
5,514
Location
Herts
I'm not sure if anyone with the relevant expertise will see these but having a go.

I've set up pdnsd on a machine in my LAN (a machine called tiny-tim running Debian Jessie) to act as a DNS cache. It works pretty well, but there's one aspect of the config I can't get right.

In /etc/pdnsd.conf I've set global -> server_ip = eth0 so that the machine responds to DNS requests that arrive at its port 53. The default file also has a section like this:
Code:
source {
        owner=localhost;
        file="/etc/hosts";
}
The problem is that /etc/hosts says
Code:
127.0.0.1       localhost
127.0.1.1       tiny-tim.home   tiny-tim
For an "internal" cache this makes sense, as it resolves the hostname (tiny-tim.home) to the loopback.

The problem for me is if I ask it to resolve tiny-tim.home from another machine it gives me 127.0.1.1, which is obviously wrong as it should give me 192.168.1.122 in my particular case.

This must be a common problem but I can't work out the best fix. If I comment out that source block then the machine can no longer resolve its own hostname other than to 192.168.1.122, which works for my other machines but will that confuse anything "internally"? I really want it to resolve 127.x.x.x for request originating from itself and 192.168.1.122 otherwise.
 
I've got an idea. According to Debian, on /etc/hosts

The IP address 127.0.1.1 in the second line of this example may not be found on some other Unix-like systems. The Debian Installer creates this entry for a system without a permanent IP address as a workaround for some software (e.g., GNOME) as documented in the bug #719621.

For a system with a permanent IP address, that permanent IP address should be used here instead of 127.0.1.1.

https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution

So I've replaced that 127.0.1.1 with the IP address of the machine and everything works.

It's a bit flaky in theory though as its IP isn't actually static. The BT HH5 doesn't want to do it (you can say "always use this IP" but it tells you to restart the device??) and I can't work out how to do it correctly in Debian without it ruining its auto-generated conf files (resolv.conf in particular). For now it's static enough so I'll leave it.
 
Back
Top Bottom