I'm using linux CentOS 6.64 with BIND 10.1.2
I have an additional zone (list.example.com) within the main DNS (example.com)
Bind (named) config file /etc/named.conf is include the zone:
zone "list.example.com" IN {
type master;
file "list-example-com.zone";
allow-query { localhost; };
allow-transfer { 127.0.0.1; };
};
Zone file list-example-com.zone as follows:
$TTL 86400 ; 1 day
@ IN SOA ns1.example.com. hostmaster.example.com. (
2004032201 ; serial
7200 ; refresh (2 hours)
5400 ; retry (1.5 hours)
1814400 ; expire (3 weeks)
86400 ; minimum (1 day)
)
IN NS ns1.example.com.
;
IN A 192.168.177.22
;
; -----------------------------------------------------------------
49.30.22.66 IN A 127.0.0.3
44.63.20.10 IN A 127.0.0.2
64.42.10.5 IN A 127.0.0.2
14.3.6.8 IN A 127.0.0.3
// AND OTHER 1000S OF RECORDS LIKE THAT!
Let's pick one of recoded IPs as an example
The "A DNS lookup" for the IP 44.63.20.10 will be:
44.63.20.10.list.example.com and will return 127.0.0.2 from the DNS
Ok, now what i want to do is, instead of listing 1000s of IP records, i just want to run PHP file in named.conf, zone file or any other to execute some codes and return 127.0.0.2 for "A DNS" of IP 44.63.20.10
myfile.php:
<?php
// Just need to get the required IP (44.63.20.10) and the DNS_TYPE of the request (A, TXT,...ect) then:
// Execute some PHP codes to do some stuff (including connect to mysql database..ect)
// If the IP is TRUE, then return: (44.63.20.10 IN DNS_TYPE X)
?>
I hope it clear for you.
I have my own PHP file, just need to know if it possible to do that? and if yes, then how? Any idea please?
Thanks.