How to configure DNS server on CentOS 5 / RHEL 5

0

dnsIn Redhat Enterprise linux or Centos 5 There will be no default named .conf file in /etc directory. We Need to copy sample configuration files from /usr/share/doc/bind-9.3.4/sample/etc/ to /etc directory by using the following command.

cp /usr/share/doc/bind-9.3.4/sample/etc/* /etc/

Copy zone files to /var/named directory from /usr/share/doc/bind-9.3.4/sample/var/named.

cp -a /usr/share/doc/bind-9.X/sample/var/named/* /var/named

We need to create the dns keygen using following command

dns-keygen

a7oGexQBd93D3cyIJWxw6kZxEPCS2O7LvqM6SiT4z2RteBZPgjmdYlTfdGpy

We need to insert the keygen in /etc/named.conf file

vi /etc/named.conf

key ddns_key

{

algorithm hmac-md5;

secret a7oGexQBd93D3cyIJWxw6kZxEPCS2O7LvqM6SiT4z2RteBZPgjmdYlTfdGpy;

};

Open up /etc/named.conf file, enter zone details as per domain requirements. The following file edited to minimal configuration, this is enough to run a DNS Server. You can copy and use it for your server also.

vi /etc/named.conf

options

{

directory “/var/named”; // the default

dump-file “data/cache_dump.db”;

statistics-file “data/named_stats.txt”;

memstatistics-file “data/named_mem_stats.txt”;

};

logging

{

channel default_debug {

file “data/named.run”;

severity dynamic;

};

};

zone “itzgeek.com” IN { —–> Name of the Zone

type master;

file “itzgeek.com“; —–> Name of the file where Zone Saved

allow-update { none; };

};

zone “4.65.10.reverse” IN { —–> Name of the Zone

type master;

file “4.65.10.reverse “; —–> Name of the file where Zone Saved

allow-update { none; };

};

key ddns_key

{

algorithm hmac-md5;

secret a7oGexQBd93D3cyIJWxw6kZxEPCS2O7LvqM6SiT4z2RteBZPgjmdYlTfdGpy ;

};

Create a zone file called itzgeek.com for forward zone under /var/named directory. All domain names should end with dot (.).

There are some special keywords for Zone Files
A – A record
NS – Name Server
MX – Mail for Exchange
CN – Canonical Name

vi /var/named/itzgeek.com

$TTL 86400
@ IN SOA itzgeek.com. [email protected]. (
24211201 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS itzgeek.com.
IN A 10.65.4.55
ns1 IN A 10.65.4.56
server IN A 10.65.4.56
www IN A 10.65.4.56
mail IN A 10.65.4.56
itzgeek.com. IN MX 10 mail.itzgeek.com.

Create a zone file called itzgeek.com for forward zone under /var/named directory, create reverse pointer to the above forward zone entries.
PTR – Pointer
SOA – Start of Authority

vi /var/named/10.65.4.reverse

$TTL 86400
@ IN SOA itzgeek.com. [email protected]. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS itzgeek.com.
55 IN PTR itzgeek.com.
56 IN PTR server.itzgeek.com.
56 IN PTR mail.itzgeek.com.
56 IN PTR www.itzgeek.com.
56 IN PTR ns1.itzgeek.com.

Restart the service using the following command

# service named restart

Simply test the server using command to check forward zone.

# host itzgeek.com

itzgeek.com has address 10.65.4.55
itzgeek.com mail is handled by 10 mail.itzgeek.com

This is for the reverse zone

# host 10.65.4.55

55.4.65.10.in.addr.arpa domain name pointer itzgeek.com.

These above command are good enough to check the DNS. To know more about DNS resolving details we can use Dig or Nslookup

Search Term:

Configure DNS on CentOS 5 / RHEL 5 ,Configure DNS on CentOS 5 / RHEL 5, Configure DNS on CentOS 5, Configure DNS on CentOS, Configure DNS on linux, Configure DNS on RHEL 5 , Configure DNS on RHEL , Configure DNS on CentOS , Configure DNS on CentOS 5, Configure DNS on CentOS 5 / RHEL 5

You might also like