pfSense, HAProxy and DNS Resolver

Hi all,

Checking my understanding of the DNS Resolver behaviour when using HAProxy. Followed @LTS_Tom videos on YouTube on setting this up and trouble shooting (awesome videos, many thanks) but despite this could not getting it working for an internal homelab setup only.

Finally (I think) I found and fixed the problem - If I have checked ‘register DHCP static mappings in DNS Resolver’ in Services>DNS Resolver>General Settings then I always get the static IP of my server (a Synology NAS in this case). If I unselect this, and then clear the browser data HAProxy does its thing.

Does this mean that the static DHCP mapping takes precedence over the host override in the DNS Resolver?

Appreciate anyone’s views on this (as I’m still learning and want to understand a little more about this issue). I had assumed a host override would take priority as if I have understood it correctly, this will have implications for all my other static mappings in the DNS resolver(?)

Thanks all
Andy

Not a 100% sure, but seems like it. But that shouldn’t really matter, because in a HA Proxy scenario, you either don’t use the DNS Registration for DHCP mappings, or you are going to use different FQDNs for the HA Proxy frontend and the server in the backend. Otherwise, DNS would announce two different IPs for the same FQDN, which cannot work, for obvious reasons.

Example:

Your got a physical server, IP: 10.0.0.10, hostname; nas01 → Static mapping registration creates a DNS record for nas01.yourdomain.com in Unbound → DNS record points to 10.0.0.10, the IP of the physical server.

After that, you create a frontend in HAProxy, on e.g. 10.0.0.2, and a DNS host override for the same FQDN (nas01.yourdomain.com) that is already pointing to 10.0.0.10, but this time you point it to 10.0.0.2, because you want HAProxy to handle the requests.

Now Unbound has a problem, because it doesn’t know what to answer when a client requests the IP for nas01.yourdomain.com… So I guess, it has to prioritize one over the other, somehow… :wink:

1 Like

Thanks @bb77 - appreciate the response and example. That all makes sense to me and in that example, when I nslookup nas01.yourdomain.com, Unbound returns me both entries in DNS, but it returns the static mapping before the host override (which explains why I got stuck in my HAProxy setup).

Cheers
Andy

1 Like