DNS with bind

From ArchWiki

Jump to: navigation, search


Image:Tango-document-new.png This article is a stub.
It may be confusing, not contain enough information, or be a placeholder for an article to come. People are invited to expand it to full article status and remove this box.

Contents

[edit] Introduction

This is a simple tutorial in howto setup a simple home network DNS-server with bind. This tutorial is based upon Two-in-one DNS...

If you have suggestions please tell me of maybe if you think that you can help me !! (this is my first wiki-entry)

[edit] Install

Install bind:

pacman -S bind

[edit] Basic configuration

[edit] Kernel config

load capability-module:

modprobe capability 

Add it to start at boot:

MODULES=(8139too mii via-rhine  capability)

[edit] Main config

Edit /etc/named.conf and edit under options:

options {
       directory "/var/named";
       pid-file "/var/run/named/named.pid";
       auth-nxdomain yes;
       datasize default;
       allow-recursion { 127.0.0.1; };
       listen-on { any; };
};

This is so that bind can take requests from the whole network.

[edit] Zones

[edit] Adding zone

Add your own zone (/etc/named.conf):

zone "cgeek.net" {
       type master;
       file "cgeek.net.zone"; 
};

On BIND 9.4.1 and later, the defaults for allowing queries changed; consider also defining allow-query { any; }; to allow queries for this zone.

Then create the file <domain>.zone (same name as in config above) in /var/named and paste this content and edit to fit your needs:

cgeek.net
$TTL    604800
@       IN      SOA     ns1.cgeek.net. root.cgeek.net. (
                    2006020201 ; Serial
                        604800 ; Refresh
                         86400 ; Retry
                       2419200 ; Expire
                        604800); Negative Cache TTL
;
@       IN      NS      ns1
       IN      MX      10 mail
       IN      A       192.168.0.2
; servers
ns1     IN      A       192.168.0.2
www     IN      A       192.168.0.2
max     IN      A       192.168.0.2
gw      IN      A       192.168.0.1

; Clients
desk    IN      A       192.168.0.20
mini    IN      A       192.168.0.16

Restart bind with:

/etc/rc.d/named restart

Test the config by trying:

host <computer>.<domain> localhost

If all is well, you should get something like this:

[root@max named]# host max.cgeek.net localhost 
Using domain server:
Name: localhost
Address: 127.0.0.1#53
Aliases:  

max.cgeek.net has address 192.168.0.2
Personal tools