You are on page 1of 4

CONFIGURE BIND AS A MASTER/AUTHORITATIVE PRIVATE DNS SERVER

CONFIGURE DNS SERVER HOST:-


[root@dns ~]# vim /etc/hostname
dns
[root@dns ~]# vim /etc/hosts
192.168.110.21 dns.main.com dns
[root@dns ~]# vim /etc/resolv.conf
nameserver 192.168.110.21

INSTALL BIND:-
[root@dns ~]# yum install bind bind-utils -y

CONFIGUR NAMED.CONF:-
[root@dns ~]# vim /etc/named.conf
options {
listen-on port 53 { 127.0.0.1; 192.168.110.21; };
# listen-on-v6 port 53 { ::1; };
allow-query { localhost; 192.168.110.0/24; };
allow-transfer { localhost; 192.168.110.22; };
####################################
zone "main.com" IN {
type master;
file "forward.main.com";
allow-update { none; };
};
zone "110.168.192.in-addr.arpa" IN {
type master;
file "reverse.main.com";
allow-update { none; };
};
###################################
CREATE FORWARD ZONE FILE:-
[root@dns ~]# vim /var/named/forward.main.com
NOTE:- Every time you edit a zone file, you should increment the serial value be
fore you restart the named process
$TTL 86400
@ IN SOA dns.main.com. root.main.com. (
2011071001 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
@ IN NS dns.main.com.
@ IN NS cdns.main.com.
@ IN A 192.168.110.21
@ IN A 192.168.110.22
@ IN A 192.168.110.30
dns IN A 192.168.110.21
cdns IN A 192.168.110.22
cl1 IN A 192.168.110.30

EDIT REVERSE ZONE FILE:-


[root@dns ~]# vim /var/named/reverse.main.com
NOTE:- Every time you edit a zone file, you should increment the serial value be
fore you restart the named process
$TTL 86400
@ IN SOA dns.main.com. root.main.com. (
2011071001 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
@ IN NS dns.main.com.
@ IN NS cdns.main.com.
@ IN PTR main.com.
dns IN A 192.168.110.21
cdns IN A 192.168.110.22
cl1 IN A 192.168.110.30
101 IN PTR dns.main.com.
102 IN PTR cdns.main.com.
103 IN PTR cl1.main.com.

CHECK BIND CONFIG SYNTAX:-


[root@dns ~]# named-checkconf /etc/named.conf
[root@dns ~]# named-checkzone main.com /var/named/forward.main.com
[root@dns ~]# named-checkzone main.com /var/named/reverse.main.com

SET OWNERSHIP, PERMISSION, SELINUX:-


[root@dns ~]# chgrp named -R /var/named
[root@dns ~]# chown -v root:named /etc/named.conf
[root@dns ~]# restorecon -rv /var/named
[root@dns ~]# restorecon /etc/named.conf

FIREWALL CONFIGURATION:-
[root@dns ~]# firewall-cmd --permanent --add-service=dns
[root@dns ~]# firewall-cmd --permanent --add-port=53/tcp
[root@dns ~]# firewall-cmd --permanent --add-port=53/udp
[root@dns ~]# firewall-cmd --reload
START/ENABLE SERVICE:-
[root@dns ~]# systemctl enable named.service
[root@dns ~]# systemctl start named.service
NETWORK SETTINGS:-
[root@dns etc]# vim /etc/sysconfig/network-scripts/ifcfg-enp0s3
DNS1=192.168.110.21

[root@dns etc]# systemctl restart network

TEST DNS:-
dig dns.main.com
CREATE FORWARD AND REVERSE ZONE FILE:-
CREATE A FORWARD ZONE FILE

vi /etc/named/named.conf.local
zone "dns.main.com" {
type master;
file "/etc/named/zones/db.dns.main.com"; # zone file path
};

CREATE A REVERSE ZONE FILE

You might also like