LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-14-2010, 09:20 AM   #1
qwerty.yp
LQ Newbie
 
Registered: Dec 2010
Posts: 7

Rep: Reputation: 0
Bind Config - Forwarded Zones not working as expected


Hi,

I am a bind noob & am attempting to setup a DNS server that will only respond to requests for certain domains.

for example, should be allowed to get to: foo.org but NOT microsoft.com, pepsi.com etc.

I assume the easiest way to get this done is to setup foo.org to be forwarded to its actual DNS server and then remove root hints and disable forwarders.

From everything I've read on BIND, it seems like this *should* be doable but perhaps I'm wrong.

My problem is that in order for the server to actually forward the request if I have recursion on globally. This means that my server will also respond to pepsi.com.

If I have recursion turned off the query gets refused by my dns server...


Am I going about this all wrong? Is there any way to do this?




Here is my named.conf file

Code:
options {
  directory "/etc/namedb"; // Working directory
  recursion no; // this will disable lookups against our server recursion no;
  pid-file "/var/run/named.pid"; // Put pid file in working dir
  statistics-file "/var/run/named.stats";
  version "Bind 10";
  dnssec-enable no;
  allow-query { any; };

};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1;any; } keys { "rndc-key"; };
};
// Root server hints
// Provide a reverse mapping for the loopback address 127.0.0.1
zone "0.0.127.in-addr.arpa" {
type master;
file "db.127.0.0";
notify no;
};

include "/etc/rndc.key";


zone "foo.org" {
       type forward;
        forwarders {
                xxx.xxx.xxx.xxx;
                };
       };
 
Old 12-14-2010, 11:53 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
I assume the easiest way to get this done is to setup foo.org to be forwarded to its actual DNS server and then remove root hints and disable forwarders.
For the 1st you're right. You can forward the zones you want to their authoritative name servers.
For the second, you should know that some of the root-servers are compiled into bind code, so even without root.hints it still works, as it can resolve domains through those root-servers.
What you can do, is to use a dummy file (like /dev/null) as a zone file for the hint zone. Doing so, your dns will try to use it and it will give a SERVFAIL answer for the rest of the domains.

Regards
 
1 members found this post helpful.
Old 12-14-2010, 05:01 PM   #3
qwerty.yp
LQ Newbie
 
Registered: Dec 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
For the 1st you're right. You can forward the zones you want to their authoritative name servers.
For the second, you should know that some of the root-servers are compiled into bind code, so even without root.hints it still works, as it can resolve domains through those root-servers.
What you can do, is to use a dummy file (like /dev/null) as a zone file for the hint zone. Doing so, your dns will try to use it and it will give a SERVFAIL answer for the rest of the domains.

Regards
Thank you for the idea. I'll give that a try and report back
 
Old 12-14-2010, 10:09 PM   #4
qwerty.yp
LQ Newbie
 
Registered: Dec 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
For the second, you should know that some of the root-servers are compiled into bind code, so even without root.hints it still works, as it can resolve domains through those root-servers.
What you can do, is to use a dummy file (like /dev/null) as a zone file for the hint zone. Doing so, your dns will try to use it and it will give a SERVFAIL answer for the rest of the domains.

Regards
I tried using a dummy file as you suggested but it's giving me SERVFAIL for even my forwarded domain.
here is my updated named.conf:



Code:
options {
  directory "/etc/namedb"; // Working directory
  recursion yes; // this will disable lookups against our server recursion no;
  pid-file "/var/run/named.pid"; // Put pid file in working dir
  statistics-file "/var/run/named.stats";
  version "Bind 10";
  dnssec-enable no;
  allow-query { any; };

};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1;any; } keys { "rndc-key"; };
};
// Root server hints
zone "." {
        type hint;
        file "/dev/null";
        };
// Provide a reverse mapping for the loopback address 127.0.0.1
zone "0.0.127.in-addr.arpa" {
type master;
file "db.127.0.0";
notify no;
};

include "/etc/rndc.key";
zone "linuxquestions.org" {
        type forward;
        forwarders {
               204.13.248.76;
               204.13.249.76;

                };
        };

I'm assuming I'm missing something dumb. any assistance will be greatly appreciated.
 
Old 12-15-2010, 12:24 AM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You should add a "forward only", because the default is to forward first:
Code:
zone "linuxquestions.org" {
        type forward;
        forward only;
        forwarders { 204.13.248.76; 204.13.249.76; };
        };
Regards
 
1 members found this post helpful.
Old 12-15-2010, 07:15 AM   #6
qwerty.yp
LQ Newbie
 
Registered: Dec 2010
Posts: 7

Original Poster
Rep: Reputation: 0
That did it.

Thank you so much. I really appreciate your help.

I had asked this question on another forum a few days ago but no one would even venture a guess as to what my problem was.

Thanks again!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
increase TTL in cached zones on BIND nima0102 Linux - Server 5 11-29-2012 12:14 AM
Bind doesn't show it's zones? freakin'me Linux - Server 2 03-03-2007 10:28 AM
BIND forward AD zones to DC psychobyte Linux - Networking 1 09-24-2006 11:46 AM
Working Bind config Files jagster Linux - Networking 1 09-13-2005 10:48 AM
trying to setup dns zones - bind 9.2.4 LKWPeter Linux - Networking 1 12-01-2004 03:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration