DNS Server on CentOS

DNS- Domain Name System

Mainly DNS is used for the public ip resolution, to get your public ip resolved over Internet.

Today many admins are using it over LAN / WAN also. It is became necessity for admins to use same FQDN for internal & external users to avoid any kind of confusion / configuration changes.

e.g

1) I have many live servers running at data center like jabber messenger, qmail, vpn, backoffice sites & few online application. I have few offices in Mumbai itself, want to provide all these applications over leased line. For these offices Internet is backup, primary link is leased line. What if leased line fails ? I can’t have my tech support team change ip address in user’s mail client / for backoffice application.

2) I have few officers & sales personals  using laptop. Often they are roaming, I can’t have them change configuration whenever they connect from internet / office LAN.

For above reasons I am using different dns servers for internal & external world. My all offices are on DHCP.

Install dns server.

yum install bind

We will create dns entry for linuxreaders.com.

Edit named.conf & insert following lines.

vi /etc/named.conf
options {
directory “/var/named”;
};

zone “linuxreaders.com” {
type master;
file “linuxreaders.zone”;
};

I used sample zone file to create linuxreaders.zone

cat /usr/share/doc/bind-9.3.4/sample/var/named/localdomain.zone > /var/named/linuxreaders.zone

Following are the entries in linuxreaders.zone

$TTL    86400
@               IN SOA  localhost root (
42              ; serial (d. adams)
3H              ; refresh
15M             ; retry
1W              ; expiry
1D )            ; minimum
IN NS           localhost
localhost       IN A            127.0.0.1
www             IN A            192.168.222.1

start named service

service named start

With the above configuration you’ll be able to resolve ip address for www.linuxreaders.com

Also this dns server can be used to resolve public domains, i.e you can have single dns defined in you user’s system to resolve ip address for internal server & for public servers.

If you wish to use specific dns address use forward option.

options {
directory “/var/named”;
forwarders { 4.4.4.1; 4.4.4.2; };
forward first;
};

To meet requirement of first example you need to create script to remove dns entries for linuxreaders.com from named.conf & restart service.

This will resolve public ip address.

Refer

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Archives

Categories

Page optimized by WP Minify WordPress Plugin