2/14/2011

Install and configure BIND on Linux

Build DNS server which resolves domain name or IP address. Install bind and caching-nameserver for it. And it's also neccessary to configure router so that TCP and UDP packets to 53 can pass through.

1. Install BIND
[root@ns ~]#
yum -y install bind caching-nameserver
2. Configure BIND
This example is done with grobal IP address [172.16.0.80/29], Private IP address [192.168.0.0/24], Domain name [server-linux.info]. However, Please use your own IPs and domain name when you set config on your server. ( Actually, [172.16.0.80/29] is for private IP address, though. )
[root@ns ~]#
vi /etc/named.conf


options {
directory "/var/named";

# query range

allow-query { localhost; 192.168.0.0/24; };

# transfer range

allow-transfer { localhost; 192.168.0.0/24; };

# recursion range

allow-recursion { localhost; 192.168.0.0/24; };

};
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };

};
# here is the section for internal informations

view "internal" {
match-clients {

localhost;

192.168.0.0/24;

};

zone "." IN {

type hint;

file "named.ca";

};

# set zones for internal

zone "server-linux.info" IN {

type master;

file "server-linux.info.lan";

allow-update { none; };

};

# set zones for internal

zone "0.168.192.in-addr.arpa" IN {

type master;

file "0.168.192.db";

allow-update { none; };

};

zone "localdomain" IN {

type master;

file "localdomain.zone";

allow-update { none; };

};

zone "localhost" IN {

type master;

file "localhost.zone";

allow-update { none; };

};

zone "0.0.127.in-addr.arpa" IN {

type master;

file "named.local";

allow-update { none; };

};

zone "255.in-addr.arpa" IN {

type master;

file "named.broadcast";

allow-update { none; };

};

zone "0.in-addr.arpa" IN {

type master;

file "named.zero";

allow-update { none; };

};

};
view "external" {
match-clients {

any;

};

zone "." IN {

type hint;

file "named.ca";

};

# set zones for external

zone "server-linux.info" IN {

type master;

file "server-linux.info.wan";

allow-update { none; };

};

# set zones for external *note

zone "80.0.16.172.in-addr.arpa" IN {

type master;

file "80.0.16.172.db";

allow-update { none; };

};

};
include "/etc/rndc.key";

# *note : For How to write for reverse resolving, Write network address reversely like below.

the case for 192.168.0.0/24
network address
⇒ 192.168.0.0

range of network
⇒ 192.168.0.0 - 192.168.0.255

how to write
⇒ 0.168.192.in-addr.arpa


case of 172.16.0.80/29
network address
⇒ 172.16.0.80

range of network
⇒ 172.16.0.80 - 172.16.0.87

how to write
⇒ 80.0.16.172.in-addr.arpa


From (server-world.info)

No comments:

Post a Comment