Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Noob Bind Question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ksool
Guru
Guru


Joined: 27 May 2006
Posts: 337
Location: Cambridge, MA

PostPosted: Sun Jul 23, 2006 4:28 am    Post subject: Noob Bind Question Reply with quote

I'm trying to setup a dns server for my home network. I looked at all the bind documentation (and djbdns) and it seems to all be much more complicanted than what I'm trying to do. Right now, I have bind installed on a server, and really, all I want to do is be able to add hostnames for all the local machines, and add a lists of banned internet servers (redirect to 127.0.0.1). Essentially keep one network wide hosts file and then redirect everything else to my isp's dns servers, (cacheing would also be useful).

Any help would be great.
Back to top
View user's profile Send private message
nobspangle
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1318
Location: Manchester, UK

PostPosted: Sun Jul 23, 2006 8:59 am    Post subject: Reply with quote

I think you should take a look at dnsmasq, it will probably be better suited to what you want.
Back to top
View user's profile Send private message
chris.c.hogan
Apprentice
Apprentice


Joined: 02 Oct 2005
Posts: 189

PostPosted: Sun Jul 23, 2006 9:11 am    Post subject: Reply with quote

Bind 9 is fairly easy to set up. Take a look at the Administrator's Handbook. It's at /usr/share/doc/bind-9.3.2/html/Bv9ARM.html

Quote:
redirect everything else to my isp's dns servers, (cacheing would also be useful).


Try add this to /etc/bind/named.conf

Code:

options {
directory "/var/bind";
        forward first;
        forwarders {
                123.123.123.123;
               123.123.123.123 ;
        };
        listen-on port 53 {
                127.0.0.1;
                192.168.0.1;
        };
        listen-on-v6 { none; };
        allow-query {
                127/8;
                192.168.0/24;
        };
        notify no;
};


Change forwarders to whatever your ISP provides for DNS. Change 192.168.0.1 to your lan interface. Change 192.168.0/24 to match your lan setup.

Adding hosts, in /etc/bind/named.conf:

Code:

zone "mylocallan.private" in {
        file "pri/mylocallan.private";
        type master;
};

zone "0.168.192.in-addr.arpa" in {
        file "pri/0.168.192.in-addr.arpa";
        type master;
};

Change mylocallan.private to your domain name. Change 0.168.192 to match your network. Hint, It's your lan address, backwards, without the last digit.

In /var/bind/pri/mylocallan.private:
Code:

$TTL 2W
@               IN SOA          @       hostmaster (
                                2006070901      ; serial
                                2D              ; refresh
                                4H              ; retry
                                6W              ; expiry
                                1W )            ; minimum
                IN MX           10 mail
                IN NS           ns1
ns1             IN A            192.168.0.1
myc             IN A            192.168.0.2

In this setup, ns1 is my name server. It's at 192.168.0.1. myc is a workstation at 192.168.0.2. I also have a mail server, but it's not defined in this example.

For reverse lookup,add /var/bind/pri/0.168.192.in-addr.arpa:
Code:

$TTL 2W
@               IN SOA          @       hostmaster.mylocallan.private. (
                                2005050101      ; serial
                                2D              ; refresh
                                4H              ; retry
                                6W              ; expiry
                                1W )            ; minimum

                IN MX           10 mail.mylocallan.private.
                IN NS           ns1.mylocallan.private.
1               IN PTR          ns1.mylocallan.private.
2               IN PTR          myc.mylocallan.private.


Not too hard. Of course, some people might just set up a rsync/cron job that copies thier hosts file around the network. However, I've found a nice, central name server to work well...
Back to top
View user's profile Send private message
ksool
Guru
Guru


Joined: 27 May 2006
Posts: 337
Location: Cambridge, MA

PostPosted: Sun Jul 23, 2006 7:01 pm    Post subject: Reply with quote

I'm working on this now.
Would I add the list of banned sites to the bottom of /var/bind/pri/mylocallan.private as redirects to 127.0.0.1?
Back to top
View user's profile Send private message
ksool
Guru
Guru


Joined: 27 May 2006
Posts: 337
Location: Cambridge, MA

PostPosted: Sun Jul 23, 2006 8:02 pm    Post subject: Reply with quote

Ok, so I've got the dns up and running just fine.

It resolvs host and host.domainname for all my local computers, and it resolves sites on the internet as well.

Now, I'm just looking into how to ban those sites.
Back to top
View user's profile Send private message
ksool
Guru
Guru


Joined: 27 May 2006
Posts: 337
Location: Cambridge, MA

PostPosted: Sun Jul 23, 2006 8:30 pm    Post subject: Reply with quote

I think I got the job done using this tool...
http://pgl.yoyo.org/adservers/hosts2bind.php

It essentially takes a list of sites and makes them all point to empty zones (I think) and it seems to server its purpose.

I just have one last question:

My dns domain is called domain.school.edu. That same dns domain is registered with my schools dns, but of course from behind the dns server, trying to access domain.school.edu just points to the dns authority. Is there any way I can set it to point to the external ip?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum