Wednesday, 7 January 2015

Quick Start: Setup CentOS 7 as a DNS Server

Quick Start: Setup CentOS 7 as a DNS Server

In this tutorial, I'll be showing you simply steps using which you can create and configure a functional DNS Server on your CentOS 7 system.

System Details:
Base OS:        CentOS 7 64 Bit (Minimal ISO)


First of all, make sure your system has a static IP address assigned to it and a fully qualified domain name.

Next, install the DNS packages:

# yum install bind bind-utils

Edit the "named.conf" file and edit the content as shown below:

# vi /etc/named.conf

# Replace the content in RED with your values
options {
listen-on port 53 {;;}; ## DNS Server IP
# listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { localhost;;}; # IP Subnet

# Add the following lines before the include statement as shown
zone "" IN { 
type master; 
file ""; 
allow-update { none; }; 
zone "" IN { 
type master; 
file ""; 
allow-update { none; }; 

Save the file and exit the editor.
Next, we create the Zone files. There will be two files created, one for the forward lookup and one for the reverse lookup. These files are created in the /var/named directory and their names should be same as mentioned in the named.conf file (Earlier steps)

Forward Zone Lookup File:

# vi /var/named/

Add the following content as shown. Replace the content marked in RED with your matching requirements.

$TTL 86400 
@ IN SOA ( 
             2011071001 ;Serial 
             3600 ;Refresh 
             1800 ;Retry 
             604800 ;Expire 
             86400 ;Minimum TTL  
@    IN     NS
@    IN     A 
@    IN     A 
@    IN     A 
master       IN       A 
client1       IN       A 
client2       IN       A

Save and exit the editor.

Reverse Zone Lookup File:

# vi /var/named/

$TTL 86400 
@ IN SOA ( 
             2011071001 ;Serial 
             3600 ;Refresh 
             1800 ;Retry 
             604800 ;Expire 
             86400 ;Minimum TTL  
@    IN     NS
@    IN     PTR
master       IN       A 
client1       IN       A 
client2       IN       A
15       IN     PTR
101     IN     PTR
102     IN     PTR

Save and exit the editor.

Enable and start the DNS service:

# systemctl enable named

# systemctl start named

Enable the ports on the Firewall and reload the firewall

# firewall-cmd --permanent --add-port=53/tcp

# firewall-cmd --reload

Verify your DNS:

Check DNS default configuration file for errors:

# named-checkconf /etc/named.conf

Next, check both the forward and reverse lookup files for any errors as well.

# named-checkzone /var/named/

# named-checkzone /var/named/

Once checked, modify the network interface file and add the DNS details as shown below:


NOTE: In my case, I am using multiple DNSs. You can assign multiple DNS values using as shown in the image below.

Alternatively, you can even add the DNS entry in the /etc/resolv.conf file as well for name resolution.

# vi /etc/resolv.conf


Restart your network to apply the changes

# systemctl restart network

Test the DNS:

Run the following commands to verify whether the DNS can resolve the hostnames correctly or not.

# dig

You can alternatively run nslookup to verify your Zones

# nslookup

There you have it.. a simple and easy to use DNS server on a CentOS 7 System.. Hope this post helps you out! Stay tuned for a lot more coming your way soon!!



Heri Wijaya said...

thank you very useful information admin, and pardon me permission to share articles here may help

Obat kista coklat
Obat untuk melancarkan peredaran


Obat pengapuran tulang

Foogle Packers and Movers said...

Thank you for your information the verified and trusted post article visit along time Safe & Reliable services.

Foogle Packers
Packers Movers Pune
Packers Movers Noida
Packers Movers Gurgaon
Packers Movers Bangalore

Foogle Packers and Movers said...

Thank for more information the post article find for economical and Reliable Shift Solution for me satisfy customer's demands.

Foogle Packers and Movers
Packers Movers Delhi
Packers Movers Mumbai
Packers Movers Hyderabad
Packers Movers Chennai

Cheapest Packers India said...

Thanks for your information the quality of link is fine Very wonderful your article and review visit # Cheapest Packers

packers and movers in Delhi
packers and movers in Noida
packers and movers in Faridabad
packers and movers in Ghaziabad
packers and movers in Guwahati

Nuy Nurhasanah said...

may be useful for all, helpful article once and pardon me permission to share also here Obat parkinson ampuh

Heni Herbal said...

This is a website that always presents useful information, thank you for presenting it.
Obat Gagal Ginjal Kronis Yang Ampuh Mengobati & Menyembuhkan Secara Alami
Pengobatan Alternatif Pengapuran Tulang Leher Alami
Pengobatan Alternatif Pengapuran Tulang Leher Alami
Obat Ambeien Alami Tanpa Operasi
Cara Alami Mengobati Mata Silinder

flower dewa said...

Jual Obat Aborsi,, Obat Aborsi,,
Nice bag you can earn money from that
Thanks for your posting
Visit me @, Obat Aborsi,,
Obat Penggugur kandungan,

rizki fahrezy said...

Thanks for the information, very useful
I am very glad to have gotten very useful information
best regards and thanks

obat kencing nanah
obat penghilang kudis
obat tipes
obat nyeri panggul
obat herbal tetanus

rizki fahrezy said...

Thanks for the very useful information, If you do not know then we will share the article. Please read because this is very important for us all.

berry jus
walatra sehat mata
qnc jelly gamat
obat kutil kelamin
obat infeksi jamur

Klinik Sukses said...

Obat Aborsi
Obat Aborsi Di Magelang
Obat Aborsi Sleman

Obat Penggugur Kandungan
Jual Obat Aborsi Singapore
Jual Obat Aborsi Taiwan
Jual Obat Aborsi Malaysia

Obat Aborsi Batam

rizki fahrezy said...

Thanks for the helpful information. Because, I just found out there is a very extraordinary article like this, thanks

Toko Obat Herbal
Obat Nyeri Sendi
Cara Mencegah Penyakit Jantung
Obat Penambah HB
Cara Menghilangkan Milia

Rindu Aku said...

Obat Aborsi ,
Obat Aborsi Ampuh ,
Obat Aborsi Asli ,
Jual Obat Aborsi ,
Obat Pelancar haid ,
Obat Telat datang Bulan ,
Obat Penggugur Kandungan ,
Pesan Cytotec Harga Obat Aborsi ,

Jual Obat Aborsi ,
Obat Aborsi ,
Jual Obat Penggugur Kandungan ,
Obat Penggugur Janin ,
Klinik Aborsi Janin Jakarta ,
Pesan Harga Obat Aborsi Tuntas ,
Order Cytotec Obat Aborsi ,

Jual Obat Aborsi Manjur ,

Post a Comment

Note: only a member of this blog may post a comment.