I'm trying to configure a zone for a 10.0.1.0/24 network.
I have rfc1918 zones defined, but then I commented out 10.in-addr.arpa network, since I'm neading it.
I then configured a db.1.0.10 file (reverse for 10.0.1.0/24 network)...
But then had to create a db.10 file for all the other 10. networks not being 10.0.1.1/24 - That's a 4Mb file with this content:
zone "0.0.10.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
//zone "1.0.10.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "2.0.10.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "3.0.10.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
... (65531 more lines)
zone "255.255.10.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
This seems unreasonable to me and it takes forever for bind to start. Plus, it now consumes 79.7% of my scarce 512Mb of memory.
After you stop laughing, could you please tell me how I could tell bind something like:
Hey, man, 10.something is empty, except for 10.0.1.something which you can look up in 1.0.10.db file.
Answer
You want:
zone "10.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
and then just define the PTR record(s) that you need in db.empty (isn't actually empty).
If you feel the need to define multiple records and just need to increment a number, use the $GENERATE directive, though why you'd want to do it for the entire 10.0.0.0/8 space, I can't guess. Search Google for "BIND $GENERATE directive" (without the quotes). Using $GENERATE, you can set up a template and avoid having to type out all of those A records and PTR records. Example:
$GENERATE 10-20 wks$ IN A 192.168.2.$
will generate records (in memory)
wks10 IN A 192.168.2.10
wks11 IN A 192.168.2.11
wks12 IN A 192.168.2.12
and so on
Similar examples:
$GENERATE 10-20 wks$.something. IN A 192.168.2.$
$GENERATE 10-20 10.0.0.$ IN PTR wks$.somewhere
$GENERATE 10-20 10.0.0.$ IN PTR empty.somewhere
Note: this last is considered "bad form" in that it has multiple IPs pointing to a single hostname. That's not to say that it won't work though.
This directive can be used in a number of record types (A, PTR, etc.). I can't for the life of me remember the syntax for an entire 10.x.x.x IP space. Recommend reading up on the $GENERATE directive (via Google) and/or acquiring the O'Reilly book "DNS and BIND".
Note: This technique will save you disk space and a lot of typing but, IIRC, it can still eat up memory.
No comments:
Post a Comment