Create bind records which match any query
Filed Under (DNS, Linux) by admin on 19-03-2009
Tagged Under : bind, centos, DNS, name server, named
Today I was configuring a DNS server and noticed that not much reference on how to create records that match any host exists.
What I needed was to setup up a proxy server using a domain that was has its website and email externally hosted, while giving the LAN users the option to enter proxy.example.com as the proxy name server. Basically, I needed the DNS server to return a local IP address for the proxy and the real Internet addresses for the other hosts. I came with two possible solutions:
- Create the proxy entry on the master (public) domain zone.
For just one particular host this would have been probably the quickest approach as only creating a proxy.example.com record with the local IP address would be needed. On the DNS server this would simple be something like:
proxy IN A 192.168.40.1 - Setup a local DNS server with the needed public records on this local server.
Under this approach, basically the opposite would be done: setup the zone on the local DNS server and create the proxy record along with all the public records that would be needed. In this cases though, I wanted to avoid creating all the public records on the local zone so I used the following entries on the zone configuration:
proxy IN A 192.168.40.1
* IN A 172.16.54.24As you can see, the second line uses a simple trick: the * character will match any other query and return the IP address 172.16.54.24 (for example purposes also a private address). If any other private or public record (that shouldn’t record the base generic address) is needed, it can be easily entered into the configuration.
And while we’re on this: don’t forget about the @ character that will allow you to reference the zone’s name without a host name (like example.com).
This was tested under CentOS Linux 5.2 running bind 9.3.4.