How to configure a 10. network in bind? (PTR)

1

1

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.

Ninguém

Posted 2013-06-30T11:31:42.060

Reputation: 23

Why don't you just leave "10.in-addr.arpa" active, create no other zones, and put everything in there? – Celada – 2013-06-30T13:37:19.653

I'm not sure what you mean, but I tryed to have both: the line containing "10.in-addr.arpa" and another for "1.0.10.in-addr.arpa" and bind would not start complaining about having already defined something for "10.in-addr.arpa" and not being able to accept "1.0.10.in-addr.arpa". – Ninguém – 2013-06-30T19:08:58.757

That makes no sense. There is absolutely nothing wrong with having a zone "10.in-addr.arpa" and another zone "1.0.10.in-addr.arpa" (in most cases you should have a proper delegation in "10.in-addr.arpa"). But in any case what I was asking was why you want to create a new zone at all. Why don't you just put PTR records directly in "10.in-addr.arpa"? That's really much simpler! – Celada – 2013-06-30T19:26:27.963

Hum... regarding bind complaining about having both (10.0.0.0/8 and 10.0.1.0/24) defined, I'll have to double-check that, I don't have access to the server ATM, but I was pretty shure it aborted with a message in syslog stating that error. About putting PTR records directly in the 10.0.0.0/8 reverse zone, you should be right, but then... I would be configuring a 10.0.0.0/8 reverse zone when in fact I only wanted to configure a 10.0.1.0/24. I might be confused, here. maybe if you know of a good doc... – Ninguém – 2013-06-30T21:00:25.063

But you already have the 10.0.0.0/8 zone configured (which is fine), so if you just add reverse DNS entries to that zone you wouldn't be changing that. – Celada – 2013-07-01T01:47:43.427

Thank you for your help. I still didn't have the opportunity to test with 10.in-addr.arpa and 1.0.10.in-addr.arpa at the same time. Meanwhile I came across the notion of stub zones, also... so I'll keep looking, but really define everything in 10.in-addr.arpa seems to be, by far, the most simple approach. – Ninguém – 2013-07-03T22:16:55.303

By the way, stub zones are totally unrelated in this context. And yes, just putting everything in the 10.in-addr.arpa zone is the easiest way. – Celada – 2013-07-03T22:18:33.233

Answers

1

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.

joat

Posted 2013-06-30T11:31:42.060

Reputation: 466

Or maybe just point 10.in-addr.arpa to some other custumized file and add those records in there. That's what I've been thinking of lately. And also maybe what Celada was suggesting in the first place. Anyway, thanks for the $GENERATE tip. – Ninguém – 2013-07-04T22:01:48.027