Configure a DNS Server (Bind Server)

We have to configure there are two type of DNS Servers

1. SDNS (Static Domain Name System)

2. DDNS (Dynamic Domain Name System)

Configure DNS Master and Slave

1. (M/S) Check the necessary RPM’s

#rpm –q bind caching-nameserver system-config-bind

2. (M/S) Set the public domain name, set the local loopback IP as the primary DNS server IP, set the ISP’s DNS server IP as the secondary DNS server IP to resolved domain name that does not belong to our domain and set the default gateway to access ISP’s DNS servers.

#system-config-network-tui

Edit a Device params à eth0 à Default gateway (Router LAN IP) à Ok à Save à Edit DNS Configuration à Primary DNS (127.0.0.1) à Secondary DNS (Router LAN IP, to access ISP DNS) àSearch (server.lk – Registered Domain) à Ok à Save and Exit

#service network restart

Check the Configuration

· Default Gateway

#cat /etc/sysconfig/network-script/ifcfg-eth0

· DNS

#cat /etc/resolv.conf

3. (M) only on the master server

Create a DNS Zone file that contains all the information about your domain

Zone File Location à /var/named

Zone File Name à any name (ex – zone.server.lk)

#cd /var/named

#ls –l

#nano zone.server.lk

Download sample DNS Zone file – download

4. (M/S) Now we have to authorized the zone file that we created for our domain

Copy the authorization configuration file in to the /etc folder

#cd /usr/share/system-config-bind/profiles/default

#ls –l

#cp named.conf /etc

#ls –l /etc/named.conf

· Edit the authorization configuration file on master DNS

#nano /etc/named.conf

Go to end of file, but before the final line

Type

zone “server.lk” IN {

type master;

file “zone.server.lk”;

allow-transfer { 10.0.0.xxx; 10.0.0.xxx; }; //First Slave Server IP and Second Slave Server IP

};

· Edit the authorization configuration file on Slave Servers

#nano /etc/named.conf

Go to end of file, but before the final line

Type

zone “server.lk” IN {

type slave;

file “slaves/zone.server.lk”; //Backup location (/var/named/slaves)

masters { 10.0.0.xxx; }; //Master Server IP

};

· Download the root DNS server information file so our DNS server can communicate with the root DNS Servers

#cd /var/named

#wget ftp://ftp.internic.net/domain/named.root

#la –l

#cat named.root |more

5. (M/S) First in master then in slave

Start the DNS Service

#service named start

#chkconfig named on

6. (S) Check the slave servers to see wither the zone file has been properly backup

Only on the slave server

#cd /var/named/slaves

#ls –l

#cat zone.server.lk

7. Setting up DNS Clients

Go to TCP/IP Properties

Preferred DNS – 10.0.0.xxx //Master Server IP

Alternate DNS – 10.0.0.xxx //Slave Server IP

More DNS servers can be set through ADVANCED button

IF Linux

#nano /etc/resolv.conf

nameserver 10.0.0.xxx //Master Server IP

nameserver 10.0.0.xxx //Slave Server IP

nameserver 10.0.0.xxx //Slave Server IP

8. Checking DNS

#nslookup ns1.server.lk

#nslookup www.google.lk

If you are going to implement multiple services on a single machine rather than using a single IP better to assign different IP’s to each and every service

How to assign multiple IP’s to a machine running with Linux

#system-config-network-tui

Edit a device params à New device à Ethernet à Add à Name : eth0:0 à Device : eth0:0 à DHCP : Cant use DHCP à Static IP : 10.0.0.xxx à Net mask : 255.255.255.0 à Default Gateway : not necessary à Ok à Save à Save and Exit

#service network restart

#ifconfig |more

· To stop a network device

#ifdown eth0:0

#ifconfig

· To start a network device

#ifup eth0:0

#ifconfig

9. (M) Now we can assign the new IP’s to services using DNS

On Master DNS

#nano /var/named/zone.server.lk

www IN A 10.0.0.xxx

sales IN A 10.0.0.xxx

mail IN A 10.0.0.xxx

ftp IN A 10.0.0.xxx

Increase the serial by one, save and exit

· Restart DNS

#killall named

#service named start

· Check DNS

#nslookup www.server.lk

#nslookup sales.server.lk

#nslookup mail.server.lk

#nslookup ftp.server.lk

------------------------------------------------------------------------------------------