Advice on combined internal DNS resolution across two sites?
-
I have two pfSense boxes at two separate sites, linked together with a site-to-site Wireguard tunnel. I have multiple services at each site that I access through HAProxy via subdomains of a domain I own.
Some of these services are at Site A, and some are at Site B. I would like to be able to access any service from either site using its domain name, as shown below:
service1.mydomain.tld
->service1 @ Site A
service2.mydomain.tld
->service2 @ Site A
service1.siteb.mydomain.tld
->service1 @ Site B
- Etc.
The issue is that these services are all internal, and
mydomain.tld
resolves to a public IP address.At Site A, I currently have things working with a redirect in the DNS resolver settings from *.mydomain.tld to my HAProxy frontend.
server: local-zone: "mydomain.tld" redirect local-data: "mydomain.tld 86400 IN A 172.20.0.99"
I am thinking I could have HAProxy redirect to Site B if 'siteb' is in the host name. At Site B, I could have a similar setup, where it redirects to Site A unless 'siteb' is in the host name. I would just need to add a similar DNS redirect at Site B.
This seems a little convoluted, but I can't think of a better way of doing things. Does anyone have any suggestions/advice?
I suppose I could send all requests to one site's HAProxy, then to each site as appropriate, but the ping is significant and I'd like everything to work even if WAN is down.
-
@rprichard Perhaps I’m misunderstanding but I would use domain overrides to have unbound forward requests to the desired DNS server(s).
-
@steveits Completely agree. And If you do not care to maintain overrides on both boxes, you could just do a domain.tld override on one box so any request for that intire domain is served by the box in the other end.
-
@SteveITS that's perfect, thank you! No misunderstanding - I'm just new to networking so I sometimes miss the obvious.