1

I am trying to add an entire subnet to BIND, rather than individual IP addresses. For example instead of doing this:

example1.test.com IN A 192.168.5.43
example2.test.com IN A 192.168.6.74

I want to just have:

*.test.com IN A 192.168.0.0/19

Is there some way to do this rather than add all IPs individually? There are way too many for me to add but I need to only add the IPs in this subnet.

  • 2
    I don't understand what your end-goal is. The point of DNS is to associate a hostname with an IP address. Assuming this plan were possible, how do you expect users to access the correct machine when any provided name would, in theory, refer to every machine in your network? – hymie May 31 at 14:39
0

If you care about a particular name being associated to a particular IP address, then there are two options: either do it manually, or if you're using DHCP to assign IP addresses, configure dynamic DNS updates, and let either the clients themselves, or perhaps more securely, the DHCP server, update the DNS information automatically as the clients renew their DHCP leases.

But if you only need to make sure that every IP address is associated with a name, you could use the $GENERATE syntax in the DNS zone file to auto-generate a set of systematic names. Like this:

$GENERATE 0-255 example000dot${0,3}.test.com. A 192.168.0.$
$GENERATE 0-255 example001dot${0,3}.test.com. A 192.168.1.$
$GENERATE 0-255 example002dot${0,3}.test.com. A 192.168.2.$
...

... and so on for a total of 31 lines. You should get a series of names with the form exampleXdotY.test.com for every IP address 192.168.X.Y.

To generate the corresponding reverse records, you could use:

$GENERATE 0-255 $.0 PTR example000dot${0,3}.test.com.
$GENERATE 0-255 $.1 PTR example001dot${0,3}.test.com.
$GENERATE 0-255 $.2 PTR example002dot${0,3}.test.com.

... and so on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.