"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 

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 
(network Then I have a web server on another Debian 
virtual server, 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 when the request comes from the internet, but resolves to when the request comes from the local network?

More information about the bind-users mailing list