internet marketer bekasi

DNS server | CentOS 7

Kali ini abiabang akan mencoba mengikuti panduan yang sudah ada pada forum/blog yang duluan dibuatkan,bagaimana cara membuat DNS server pada system Operasi CentOS 7.dalam hal ini hal ini dibatasi hanya Master DNS saja ya sob (tanpa secondary dns).oke kita langsung aja yuk.

Sebelum melakukan setting perlu disiapkan informasi sebagai berikut

Primary (Master) DNS Server Details:

Operating System     : CentOS 7 
Hostname             :
IP Address           :

Client Details:


Operating System     : Windows 7 64bit Laptop  
Hostname             : client.laptop
IP Address           :

Pengaturan (Master) DNS Server

Install bind9 packages pada Server
yum install bind bind-utils -y

1. Configure DNS Server

Edit ‘/etc/named.conf’ file.
vi /etc/named.conf
Add the lines as shown in bold:
// named.conf
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
// See /usr/share/doc/bind*/sample/ for example named configuration files.

options {
    listen-on port 53 {;;}; ### Master DNS 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 Range ###
    allow-transfer{ localhost;; };   ### Slave DNS IP ###

     - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
     - If you are building a RECURSIVE (caching) DNS server, you need to enable 
     - If your recursive DNS server has a public IP address, you MUST enable access 
       control to limit queries to your legitimate users. Failing to do so will
       cause your server to become part of large scale DNS amplification 
       attacks. Implementing BCP38 within your network would greatly
       reduce such attack surface 
    recursion yes;

    dnssec-enable yes;
    dnssec-validation yes;
    dnssec-lookaside auto;

    /* Path to ISC DLV key */
    bindkeys-file "/etc/named.iscdlv.key";

    managed-keys-directory "/var/named/dynamic";

    pid-file "/run/named/";
    session-keyfile "/run/named/session.key";

logging {
        channel default_debug {
                file "data/";
                severity dynamic;

zone "." IN {
    type hint;
    file "";

zone "" IN {
      type master;
      file "/var/named/forward.abi";
      allow-update { none; };
zone "" IN {
      type master;
      file "/var/named/reverse.abi";
      allow-update { none; };

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

2. Create Zone files

Create forward and reverse zone files which we mentioned in the ‘/etc/named.conf’ file.

2.1 Create Forward Zone

Create forward.unixmen file in the ‘/var/named’ directory.
vi /var/named/forward.abi
Add the following lines:
$TTL 86400
@   IN  SOA (
                2011071001  ;Serial
                3600        ;Refresh
                1800        ;Retry
                604800      ;Expire
                86400       ;Minimum TTL
@       IN  NS
@       IN  NS
@       IN  A
ns      IN  A
web     IN  A

2.2 Create Reverse Zone

Create reverse.unixmen file in the ‘/var/named’ directory.
vi /var/named/reverse.abi
Add the following lines:
$TTL 86400
@   IN  SOA (
        2011071001  ;Serial
        3600        ;Refresh
        1800        ;Retry
        604800      ;Expire
        86400       ;Minimum TTL
@       IN  NS
@       IN  PTR
1       IN  PTR
1       IN  PTR
1       IN  PTR

3. Start the DNS service

Enable and start DNS service:
systemctl enable named --> meangaktifkan 
systemctl start named --> menjalankan service
systemctl start named --> melihat status service

4. Firewall Configuration

We must allow the DNS service default port 53 through firewall.
firewall-cmd --permanent --add-port=53/tcp
firewall-cmd --permanent --add-port=53/udp
*bila perintah/command firewall belun ada
#yum install firewalld
#systemctl start firewalld 
#systemctl enable firewalld
#systemctl status firewalld  

5. Restart Firewall

firewall-cmd --reload

6. Configuring Permissions, Ownership, and SELinux

Run the following commands one by one:
chgrp named -R /var/named
chown -v root:named /etc/named.conf
restorecon -rv /var/named
restorecon /etc/named.conf

7. Test DNS configuration and zone files for any syntax errors

Check DNS default configuration file:
named-checkconf /etc/named.conf
If it returns nothing, your configuration file is valid.

Check Forward zone:
named-checkzone /var/named/forward.abi
Sample output:
zone unixmen.local/IN: loaded serial 2011071001

Check reverse zone:
named-checkzone /var/named/reverse.abi 
Sample Output:
zone unixmen.local/IN: loaded serial 2011071001

Add the DNS Server details in your network interface config file.
vi /etc/sysconfig/network-scripts/ifcfg-eno1

Edit file /etc/resolv.conf,
vi /etc/resolv.conf
Add the name server ip address:

Save and close the file.
:wq atau dengan perintah shift+ZZ

Restart network service:
systemctl restart network

8. Test DNS Server


semoga membantu

sumber asli klik disini

0 Response to "DNS server | CentOS 7"

Post a Comment

Komentar Saudara/i sangat bermanfaat untuk membangun Blog ini,Terimakasih
Your comments are very useful for building this blog, thank you

Blog Info Teknologi