Huu Phan | Blog Linux operating system | Linux operating system -Blog Huu Phan | www.huuphan.com
huuphan.com. Powered by Blogger.

My blog about Open Source: Zimbra Mail Server,linux,bash script,centos,linux command...

How To Install the BIND DNS Server on CentOS 6

How To Install the BIND DNS Server on CentOS 6. in my post, i'm demo to install and configure BIND DNS server. I'm running command as root account.
Links to below you maybe likes:
How to install php7 on centos 6
How to install and configure redmine on centos 6
How to owncloud 9 install ssl certificate centos 7
How To Install the BIND DNS Server on CentOS 6
KeepAlived IP Failover on CentOS & Red Hat




To prepare package for BIND DNS server.

yum update -y
yum install bind bind-utils -y
yum -y install perl perl-core wget openssh-clients openssh-server unzip nmap sysstat rsync telnet ntp
ntpdate asia.pool.ntp.org
service ntpd start
chkconfig ntpd on

To configure ip address static

#vim /etc/sysconfig/network-scripts/ifcfg-eth1
The content as bellow
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.131.10
NETMASK=255.255.255.0
GATEWAY=192.168.131.2
DNS=192.168.131.10
DNS1=8.8.8.8
DNS2=8.8.4.4
USERCTL=no
PEERDNS=no
To configure hosts file.
vim /etc/hosts
The output as bellow
192.168.131.10 ns1.huuphan.local ns1
192.168.131.11 ldap.huuphan.local ldap
192.168.131.12 mta.huuphan.local mta
192.168.131.13 mailbox.huuphan.local mailbox

To configure resolv.conf

vim /etc/resolv.conf

The output as bellow
; generated by /sbin/dhclient-script
search huuphan.local
nameserver 192.168.131.10
nameserver 8.8.8.8
nameserver 8.8.4.4

To configure network file

#vim /etc/sysconfig/network
The output as bellow
NETWORKING=yes
HOSTNAME=ns1

To configure BIND DNS server

To Create Forward Zone File

vim /var/named/huuphan.local.zone
The output as bellow
;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns1.huuphan.local. admin.huuphan.local. (
3         ; Serial
604800         ; Refresh
86400         ; Retry
2419200         ; Expire
604800 )       ; Negative Cache TTL
;
; name servers - NS records
@       IN      NS      ns1.huuphan.local.
@               MX              10   mail.huuphan.local.
; name servers - A records
ns1                 IN A                 192.168.131.10
ldap     IN      A       192.168.131.11
mta     IN      A       192.168.131.12
mailbox     IN      A       192.168.131.13

To Create Reverse Zone File

vim /var/named/131.168.192.rev
The output as bellow
;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns1.huuphan.local. admin.huuphan.local. (
1         ; Serial
604800         ; Refresh
86400         ; Retry
2419200         ; Expire
604800 )       ; Negative Cache TTL
;
; name servers
@       IN      NS      ns1.huuphan.local.
; PTR Records
11     IN      PTR     ldap.huuphan.local.
12     IN      PTR     mta.huuphan.local.
13     IN      PTR     mailbox.huuphan.local.
To add lines in named.conf file.
vim /etc/named.conf

The output as bellow
# Forward DNS
zone "huuphan.local" IN {
        allow-update { none; };
        file "/var/named/huuphan.local.zone";
        type master;
};
# Reverse DNS
zone "131.168.192.in-addr.arpa" in {
        allow-update { none; };
        file "/var/named/131.168.192.rev";
        type master;
};
To restart and enable DNS bind
service named restart
chkconfig named on

To test BIND DNS

nslookup command host

nslookup ns1.huuphan.local
The output as bellow

Server:         192.168.131.10
Address:        192.168.131.10#53
Name:   ns1.huuphan.local
Address: 192.168.131.10
nslookup command ip address
nslookup 192.168.131.10
The output as bellow
Server:         192.168.131.10
Address:        192.168.131.10#53
10.131.168.192.in-addr.arpa     name = ns1.huuphan.local.
install BIND DNS Server


post new :

Huu Phan | Blog Linux operating system | Huu Phan ~ Zimbra Mail Server,linux,bash script,centos,linux command | www.huuphan.com

This Blog is protected by DMCA.com