Want to subscribe to topics you're interested in?
Become a Member

Domains Domain name DNS setup on local NSD server

Discussion in 'Domains, DNS, Email & SSL Certificates' started by eva2000, Jul 19, 2014.

Thread Status:
Not open for further replies.
  1. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,585
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,775
    Local Time:
    11:00 AM
    Nginx 1.13.x
    MariaDB 5.5
    Centmin Mod 123.08stable and older installs a light weight alternative to BIND for local DNS management called NSD. On Centmin Mod 123.09beta01 and higher it's not installed by default and needs to be installed manually via centmin.sh menu option 20.

    NSD domain DNS setup can be done via centmin.sh menu option 3. Official site has full details at Nginx Vhost & NSD DNS Setup. Note, for uptime, performance and reliability I recommend you use 3rd party DNS hosting service instead of locally hosting via NSD. You can use Cloudflare for DNS only hosting which is totally free instead.

    Below is a quick guide to setting up your domain with own custom name servers. I will use centmincache.net as an example.

    Step 1. As per part 1 outlined at Nginx Vhost & NSD DNS Setup, create your custom nameservers. Some DNS registrars call them private nameservers or vanity nameservers. For me I created 2 private name servers ns1.centmincache.net and ns2.cachecache.net. I use Internet.bs domain registrar so created my custom name servers.

    internetbs_private_ns_nsd_setup_centmincache.net.png

    Step 2. Add Nginx vhost via centmin.sh menu option 2

    Code:
    --------------------------------------------------------
    Centmin Mod 1.2.3-eva2000.07 - http://centminmod.com
    --------------------------------------------------------
                       Centmin Mod Menu              
    --------------------------------------------------------
    1).  Centmin Install
    2).  Add Nginx vhost domain
    3).  NSD setup domain name DNS
    4).  Nginx Upgrade / Downgrade
    5).  PHP Upgrade / Downgrade
    6).  XCache Re-install
    7).  APC Cache Re-install
    8).  XCache Install
    9).  APC Cache Install
    10). Memcached Server Re-install
    11). MariaDB 5.2, 5.5, 10 Upgrade Sub-Menu
    12). Zend OpCache Install/Re-install
    13). Install ioping.sh vbtechsupport.com/1239/
    14). SELinux disable
    15). Install/Re-install ImageMagick PHP Extension
    16). Change SSHD Port Number
    17). Multi-thread compression: pigz,pbzip2,lbzip2,p7zip etc
    18). Suhosin PHP Extension install
    19). Install FFMPEG and FFMPEG PHP Extension
    20). NSD Re-install
    21). Update - Nginx + PHP-FPM + Siege
    22). Exit
    --------------------------------------------------------
    Enter option [ 1 - 22 ] 2
    --------------------------------------------------------
    
    ---------------------------------------------
    Enter vhost domain name you want to add (without www. prefix): centmincache.net
    
    ---------------------------------------------
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
    Reloading nginx:                                           [  OK  ]
    ---------------------------------------------
    vhost for centmincache.net created successfully
    vhost conf file for centmincache.net created: /usr/local/nginx/conf/conf.d/centmincache.net.conf
    upload files to /home/nginx/domains/centmincache.net/public
    vhost log files directory is /home/nginx/domains/centmincache.net/log
    Step 3. Add DNS entry via centmin.sh menu option 3 for NSD for centmincache.net. Proper setup would need separate IP addresses for ns1 and ns2 and ns2 would need to have IP address on a separate server for redundancy. Otherwise, usually for same server NSD setup, only ns1 and IP from same server is required and ns2 isn't needed. But for testing purposes I used same IP from same server for ns1 and ns2. If you use 2 separate IP addresses on the same single server, read further below for editing /etc/nsd/nsd.conf config file.

    The menu option 3 will also add an entry for your domain in /etc/nsd/nsd.conf and an individual NSD zone file at /etc/nsd/master/centmincache.net.zone

    Code:
    --------------------------------------------------------
    Centmin Mod 1.2.3-eva2000.07 - http://centminmod.com
    --------------------------------------------------------
                       Centmin Mod Menu              
    --------------------------------------------------------
    1).  Centmin Install
    2).  Add Nginx vhost domain
    3).  NSD setup domain name DNS
    4).  Nginx Upgrade / Downgrade
    5).  PHP Upgrade / Downgrade
    6).  XCache Re-install
    7).  APC Cache Re-install
    8).  XCache Install
    9).  APC Cache Install
    10). Memcached Server Re-install
    11). MariaDB 5.2, 5.5, 10 Upgrade Sub-Menu
    12). Zend OpCache Install/Re-install
    13). Install ioping.sh vbtechsupport.com/1239/
    14). SELinux disable
    15). Install/Re-install ImageMagick PHP Extension
    16). Change SSHD Port Number
    17). Multi-thread compression: pigz,pbzip2,lbzip2,p7zip etc
    18). Suhosin PHP Extension install
    19). Install FFMPEG and FFMPEG PHP Extension
    20). NSD Re-install
    21). Update - Nginx + PHP-FPM + Siege
    22). Exit
    --------------------------------------------------------
    Enter option [ 1 - 22 ] 3
    --------------------------------------------------------
    
    ---------------------------------------------
    New to NSD DNS setup ? Be sure to read NSD setup guide:
    http://centminmod.com/nginx_domain_dns_setup.html#dns
    
    Enter domain name you want to add to NSD (without www. prefix): centmincache.net
    
    Enter IP address you want to assign to domain name (your A record): 107.155.125.126
    ---------------------------------------------------------
    You entered domain name: centmincache.net
    You entered domain IP address (A record): 107.155.125.126
    ---------------------------------------------------------
    
    Are the domain name and IP address (A record) entered correctly ? [y/n]: y
    
    ---------------------------
    Nameserver ns1/ns2 setup:
    ---------------------------
    
    Note #1:
    nameserver ns1/ns2 IP addresses must already exist and be assigned to this
    server by your web host. If unsure, ask your web host the exact IP addresses
    assigned to your server.
    
    
    Note #2:
    For vanity or custom name servers using your own domain name, ensure you
    have created them first with your domain registrar. You can see tutorial guides
    for Namecheap and Godaddy domain registrars for creating domain names'
    private name servers on web site Part #1 at
    http://centminmod.com/nginx_domain_dns_setup.html#dns
    
    
    Want to abort NSD setup to check with web host and/or domain registrar first ? [y/n]: n
    * Enter IP address for ns1 nameserver: 107.155.125.126
    
    * Enter IP address for ns2 nameserver: 107.155.125.126
    --------------------------------------------------------------
    You entered ns1.centmincache.net IP address: 107.155.125.126
    You entered ns2.centmincache.net IP address: 107.155.125.126
    --------------------------------------------------------------
    
    Are the ns1/ns2 name server IP address entered correct ? [y/n]: y
    
    ---------------------------------------------
    checking to see if entry for centmincache.net already exists in /etc/nsd/nsd.conf
    ---------------------------------------------
    
    ---------------------------------------------
    no entry for centmincache.net found in /etc/nsd/nsd.conf
    creating entry for centmincache.net ...
    ---------------------------------------------
    
    #
    # nsd.conf -- the NSD(8) configuration file, nsd.conf(5).
    #
    # Copyright (c) 2001-2006, NLnet Labs. All rights reserved.
    #
    # See LICENSE for the license.
    #
    
    server:
            # for ns1 ip on this server
            #ip-address: xxx.xxx.xxx.xxx
            # for ns2 ip on this server
            #ip-address: yyy.yyy.yyy.yyy
    
            hide-version: yes
    
            # Maximum number of concurrent TCP connections per server.
            # This option should have a value below 1000.
            tcp-count: 100
    
            # Maximum number of queries served on a single TCP connection.
            # By default 0, which means no maximum.
            tcp-query-count: 0
    
            # Override the default (120 seconds) TCP timeout.
            tcp-timeout: 60
    
            # zonefile: to store pid for nsd in.
            pidfile: "/var/run/nsd/nsd.pid"
    
            # The directory for zonefile: files.
            zonesdir: "/etc/nsd"
    
    zone:
            name: "demo.com"
            zonefile: "master/demo.com.zone"
    zone:
            name: "centmincache.net"
            zonefile: "master/centmincache.net.zone"
    ---------------------------------------------
    Stopping nsd:
    Starting nsd:
    
    ---------------------------------------------
    Creating zone file at /etc/nsd/master/centmincache.net.zone
    ---------------------------------------------
    $TTL 14400
    @       IN      SOA     ns1.centmincache.net.      hostmaster.centmincache.net. (
                                                    2010091500
                                                    14400
                                                    3600
                                                    1209600
                                                    86400 )
    
    ; Nameservers
    centmincache.net.       14400   IN      NS      ns1.centmincache.net.
    centmincache.net.       14400   IN      NS      ns2.centmincache.net.
    
    ; A Records
    centmincache.net.       14400   IN      A       107.155.125.126
    ftp                     14400   IN      A       107.155.125.126
    localhost       14400   IN      A       127.0.0.1
    mail            14400   IN      A       107.155.125.126
    ns1                     14400   IN      A       107.155.125.126
    ns2                     14400   IN      A       107.155.125.126
    pop                     14400   IN      A       107.155.125.126
    smtp            14400   IN      A       107.155.125.126
    www                     14400   IN      A       107.155.125.126
    
    ; MX Record
    centmincache.net.       14400   IN      MX      10 mail
    
    ; TXT Record (for SPF)
    centmincache.net.       14400   IN      TXT     "v=spf1 a mx ip4:107.155.125.126 ~all"
    
    ---------------------------------------------
    Current zone files listing at: /etc/nsd/master/
                      
    Jun 21  13:18   883    demo.com.zone
    Jul 19  01:23   1.3K   centmincache.net.zone
    ---------------------------------------------
    
    ---------------------------------------------
    NSD entry for centmincache.net created successfully in /etc/nsd/nsd.conf
    NSD zone created at /etc/nsd/master/centmincache.net.zone
    
    ---------------------------------------------
    Remember to check your domain name's DNS is properly configured
    at both your domain registrar & web server end (NSD) by running
    domain name through these 3 dns test sites
    * http://www.dnsvalidation.com/
    * http://www.intodns.com/
    * http://dnscheck.pingdom.com/
    ---------------------------------------------
    End result is all complete and resolving fine at http://centmincache.net

    Separate IP addresses for ns1 and ns2



    If you use different IP addresses for ns1 and ns2 where both IP addresses reside on the same server or 2nd ns2 IP resides on a separate server which has NSD service running (a 2nd Centmin Mod based server), there's an extra step which I should of mentioned, editing /etc/nsd/nsd.conf to list the 2 ips in ip-address fields. You need to edit and uncomment (remove front hash #) from the ip-address: lines seen below.

    So it goes from
    Code:
            # for ns1 ip on this server
            #ip-address: xxx.xxx.xxx.xxx
            # for ns2 ip on this server
            #ip-address: yyy.yyy.yyy.yyy
    to
    Code:
            # for ns1 ip on this server
            ip-address: xxx.xxx.xxx.xxx
            # for ns2 ip on this server
            ip-address: yyy.yyy.yyy.yyy
    If you have both ns1 and ns2 IP addresses on same server, you need to ensure both IP addresses have been added to your server and should be seen in the inet field output for command. If ns2 IP address is on a separate NSD based server, you DO NOT need to have the ns2 IP address added to same server. Nothing to do if ns2 IP address is on separate NSD based server other than do steps 1 to 3 listed above again, on the 2nd ns2 IP address's server.
    Code:
    ifconfig -a | grep inet
    After editing /etc/nsd/nsd.conf, restart nsd service

    Code:
    service nsd restart
    Code:
    #
    # nsd.conf -- the NSD(8) configuration file, nsd.conf(5).
    #
    # Copyright (c) 2001-2006, NLnet Labs. All rights reserved.
    #
    # See LICENSE for the license.
    #
    
    server:
            # for ns1 ip on this server
            #ip-address: xxx.xxx.xxx.xxx
            # for ns2 ip on this server
            #ip-address: yyy.yyy.yyy.yyy
    
            hide-version: yes
    
            # Maximum number of concurrent TCP connections per server.
            # This option should have a value below 1000.
            tcp-count: 100
    
            # Maximum number of queries served on a single TCP connection.
            # By default 0, which means no maximum.
            tcp-query-count: 0
    
            # Override the default (120 seconds) TCP timeout.
            tcp-timeout: 60
    
            # zonefile: to store pid for nsd in.
            pidfile: "/var/run/nsd/nsd.pid"
    
            # The directory for zonefile: files.
            zonesdir: "/etc/nsd"
    
    zone:
            name: "demo.com"
            zonefile: "master/demo.com.zone"
    
     
    Last edited: Sep 12, 2016
  2. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,585
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,775
    Local Time:
    11:00 AM
    Nginx 1.13.x
    MariaDB 5.5
    whatsmydnsnet_a_check.png

    whatsmydnsnet_ns_check.png

    whatsmydnsnet_txt_check.png
     
Thread Status:
Not open for further replies.