首页 > 代码库 > install and config bind9(named) on linux server

install and config bind9(named) on linux server

This article shows my process of installing and configuring bind9 DNS server on a linux server. I didn‘t touch every aspects of bind9, but following the process, a DNS server is configured with A/AAAA, NAPTR and SRV resource record types. The DNS server is able to be used for testing.

## download bind-9.10.0-P1.tar.gz
https://www.isc.org/downloads/bind/

## untar the package 
tar xzvf bind-9.10.0-P1.tar.gz

## config and install 
cd bind-9.10.0-P1
./configure 
./make 
./make install 

## test named is installed
named -v
named -g 

## generate rndc.key
cd /etc
rndc-confgen -a

## generate /etc/named.conf with contents 
cat /etc/named.conf
zone "lingcloud.com" {
type master;
file "/etc/bind/zones/lingcloud.com.db";
};

## config zone with example contents
cat /etc/bind/zones/lingcloud.com.db
; BIND data file for lingcloud.com
;
$TTL 14400 ;lingcloud.com
;start of authority resource record type. Every domain must have a Start of Authority record at the cutover
ts parent domain.
@ IN SOA ns1.lingcloud.com. host.lingcloud.com. (
201006601 ; Serial
7200 ; Refresh
120 ; Retry
2419200 ; Expire
604800) ; Default TTL
;
; NS record indicate which name server are authoritative for the zone/domain. It is primarily used if you w
lingcloud.com. IN NS ns1.lingcloud.com.
;A record
lingcloud.com. IN A 10.41.104.171
; ns seems to be name server's ip
ns1 IN A 10.41.104.232

nodeB IN A 10.41.104.171
nodeB.realmB IN A 10.41.104.171
nodeC IN A 10.41.104.171
nodeC.realmC IN A 10.41.104.171

;NAPTR record
realmB IN NAPTR 50 100 "s" "aaa:diameter.tcp" "" _diameter._tcp.srvB.realmB.lingcloud.com.
realmC IN NAPTR 51 101 "s" "aaa:diameter.tcp" "" _diameter._tcp.srvC.realmC.lingcloud.com.
;SRV record
_diameter._tcp.srvB.realmB IN SRV 0 1 3868 nodeB.realmB.lingcloud.com.
_diameter._tcp.srvC.realmC IN SRV 0 1 3868 nodeC.realmC.lingcloud.com.

## start named
/usr/local/sbin/named

## check named status 
rndc status

## nslookup can be used to query DNS server
 nslookup
> server 127.0.0.1
Default server: 127.0.0.1
Address: 127.0.0.1#53
> lingcloud.com
Server:		127.0.0.1
Address:	127.0.0.1#53

Name:	lingcloud.com
Address: 10.41.104.172
> nodeB.lingcloud.com
Server:		127.0.0.1
Address:	127.0.0.1#53

Name:	nodeB.lingcloud.com
Address: 10.41.104.171
> set type=NAPTR
> realm1.lingcloud.com     
Server:		127.0.0.1
Address:	127.0.0.1#53

realm1.lingcloud.com	naptr = 50 100 "s" "aaa:diameter.tcp" "" _diameter._tcp.srv1.lingcloud.com.
> set type=SRV
> _diameter._tcp.srv1
Server:		127.0.0.1
Address:	127.0.0.1#53

_diameter._tcp.srv1.lingcloud.com	service = 0 1 3868 nodeB.lingcloud.com.

Reference:

http://www.servermom.org/how-to-install-and-setup-bind9-on-ubuntu-server/136/
https://kb.isc.org/article/AA-00768/0/Getting-started-with-BIND-how-to-build-and-run-named-with-a-basic-recursive-configuration.html
http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-bind-rndc.html