Installation of DNS server on Centos 7

Run the following command on both the machines

yum install bind bind-utils -y

vi /etc/named.conf

acl “trusted” {

172.16.120.179;    # nameserver1 – can be set to localhost

172.16.120.154;  # host1

};

listen-on port 53 { 127.0.0.1; 172.16.120.179; };

allow-query     { trusted; };

zone “atos.local” IN {

type master;

file “forward.learnwithak”;

allow-update { none; };

};

zone “120.16.172.learnwithak.local” IN {

type master;

file “reverse.learnwithak”;

allow-update { none; };

};

 

sudo vi /var/named/forward.learnwithak

$TTL 86400

@   IN  SOA     masterdns.learnwithak.local. root.learnwithak.local. (

2011071001  ;Serial

3600        ;Refresh

1800        ;Retry

604800      ;Expire

86400       ;Minimum TTL

)

@       IN  NS          masterdns.learnwithak.local.

@       IN  A           172.16.120.179

@       IN  A           172.16.120.154

@       IN  A           172.16.120.69

masterdns       IN  A   172.16.120.179

vault          IN  A   172.16.120.154

vault-2          IN  A   172.16.120.69

 

vi /var/named/reverse.learnwithak

$TTL 86400

@   IN  SOA     masterdns.learnwithak.local. root.learnwithak.local. (

2011071001  ;Serial

3600        ;Refresh

1800        ;Retry

604800      ;Expire

86400       ;Minimum TTL

)

@       IN  NS          masterdns.learnwithak.local.

@       IN  PTR         learnwithak.local.

masterdns       IN  A   172.16.120.179

vault          IN  A   172.16.120.154

vault-2          IN  A   172.16.120.69

179     IN  PTR         masterdns.learnwithak.local.

154     IN  PTR         vault.learnwithak.local.

69      IN  PTR         vault-2.learnwithak.local.

 

systemctl enable named
systemctl start named

 

add 53 port in tcp and udp

 

chgrp named -R /var/named
chown -v root:named /etc/named.conf
restorecon -rv /var/named
restorecon /etc/named.conf

 

 

named-checkconf /etc/named.conf

 

named-checkzone learnwithak.local /var/named/forward.learnwithak

 

named-checkzone learnwithak.local /var/named/reverse.learnwithak

In the client machines:

Add the DNS Server details in your network interface config file.

vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

 

Edit file /etc/resolv.conf,

vi /etc/resolv.conf

 

dig masterdns.learnwithak.local

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s