tutorial centos installing NSD as DNS server with low memory consumption

tutorial VPS, how to install NSD to your VPS and configure as dns name server. why nsd? nsd only use little memory than bind9. if you have vps with little memory just 128Mb you can choose NSD as your DNS than switching from bind. This tutorial is geared towards a super-simple DNS setup. We’ll be using NSD, a very lightweight DNS server. While the most-widely used package is BIND, BIND supports every possible option and feature, which is overkill for most people

Things I won’t be covering:

  • reverse DNS
  • zone transfers
  • MX records

Here is how we’ll configure NSD:

  • Two servers, each of which listen for DNS on their public interfaces.
  • /etc/nsd/nsd.conf will contain the NSD configuration specific to that server
  • /etc/nsd/zones will contain all the zone files (the DNS records for your domain(s))
  • we’ll use rsync to keep both servers in sync. NSD supports zone transfers, but it complicates the setup and is unnecessary if all you’re doing is DNS for a few domains and it doesn’t change much. If you have a lot of DNS changes and a complex setup, then this tutorial isn’t for you

lets start how to install NSD on centos 5 or centos 6,

first we can add repo epel your Centos VPS Server,
Repo Epel CentOS 6 32bit:

Repo Epel CentOS 5 32bit:

then install NSD on Centos Server

now you have unblock on port 53 UDP, if you dont have installed iptables you can skip this step

configure NSD create backup first :

now edit /etc/nsd/nsd.conf, i like using nano editor

and using like this :

# The 'server:' section is the configuration for the DNS server
server:
# this is the IP address it will listen on for DNS requests
# change this to the public-facing IP address of your VPS
ip-address: 1.23.45.67

# no need to tell people what version we’re running
hide-version: yes

# the database to use
database: “/var/lib/nsd/nsd.db”

# log file
logfile: “/var/log/nsd.log”

# Number of NSD servers to fork.
server-count: 1

# we’ll use a separate “zone list” file to make rsync easier
include: “/etc/nsd/zones/zone_list.conf”

Configure nsd zone_list.conf
remember before on editing /etc/nsd/nsd.conf? you can see at last line
# we’ll use a separate “zone list” file to make rsync easier
include: “/etc/nsd/zones/zone_list.conf”
now we create file to zone list

content file like this :

zone:
name: example.com
zonefile: /etc/nsd/zones/example.com

Configure zone_list.conf
This is probably the most complicated part. The format of the zone file is the same one BIND uses.
Back on ns1, edit /etc/nsd/zones/example.com:
if you have 2 ip

$ORIGIN example.com.
$TTL 3600

@ IN SOA ns1.example.com. admin.example.com. (
2011102301 ; serial number
28800 ; Refresh
7200 ; Retry
864000 ; Expire
86400 ; Min TTL
)

IN NS ns1.example.com.
IN NS ns2.example.com.

ns1 IN A 1.23.45.67
ns2 IN A 1.23.45.68
bigvps IN A 1.23.45.67
www IN CNAME domain

Now you’ve finished the zone list setup on ns1. You should have an entry for example.com in your /etc/nsd/zones/zone_list.conf file, and the above DNS record in /etc/nsd/zones/example.com file. You want to get these files to ns2. From ns1:

now starting nsd :

Leave a Reply

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