DNS with bind

From ArchWiki

Jump to: navigation, search
Image:Tango-document-new.png This article is a stub.
This typically means the article is a placeholder for more content to come. Knowledgeable users are encouraged to help expand the article.

Contents

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...

Install

Install bind:

pacman -S bind

Basic configuration

Kernel config

load capability-module:

modprobe capability 

Add it to start at boot:

MODULES=(8139too mii via-rhine  capability)

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 instructs bind to listen on any interface.

Zones

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