"rule based" A records

Lucio Crusca lucio at sulweb.org
Sun Jan 14 11:27:03 UTC 2018


I'm not sure this feature exists, and, even then, I don't know how it's 
called.

I need my Bind to resolve names to different IP addresses based on the 
subnet the request comes from.

E.g. I have a Bind instance on a Debian virtual server 10.7.33.111 
(network 10.7.33.0/24). Then I have a web server on another Debian 
virtual server 10.7.33.103, same local network.
The host system has only one public IP address and forwards connections 
to the correct virtual server based on the TCP/UDP port.

PHP code of the websites often needs to contact the same hosted websites 
by name: however all the websites names resolve to the public IP address 
of the host, and the host does not route connections coming from the 
virtual hosts back to the same virtual hosts.

By now, I'm adding each domain name to the /etc/hosts file of the 
webserver, so that it takes precedence over the DNS name resolution. It 
works, but it's not a clean solution.

Is it possible to configure Bind so that www.example.com resolves to 
1.2.3.4 when the request comes from the internet, but resolves to 
10.7.33.103 when the request comes from the local network?


More information about the bind-users mailing list