Tag: dns

  • Disable systemd-resolved on Ubuntu/Deb/CentOS

    systemd-resolved provide DNS resolver facility in newer version of Linux servers running systemd.

    I prefer manually editing /etc/resolv.conf and add resolvers. If you are running your own DNS server, then you need to disable systemd-resolved as it listen on port 53, with out disabling the service, you can’t start your DNS server.

    To disable systemd-resolved, run

    wget https://raw.githubusercontent.com/serverok/server-setup/master/tools/disable-systemd-resolved.sh
    bash disable-systemd-resolved.sh
    

    Or do the following.

    systemctl disable systemd-resolved.service
    systemctl stop systemd-resolved
    

    Now create /etc/resolv.conf file

    rm -f /etc/resolv.conf
    tee /etc/resolv.conf << END
    nameserver 8.8.8.8
    nameserver 1.1.1.1
    END
    

    See resolv.conf, dns

  • Requesting a zone trasnfer with dig

    To request a zone transfer using dig, use

    dig @NAME_SERVER_HERE  -t AXFR  DOMAIN_NAME_HERE
    

    Example

    [root@vps3 poweradmin]# dig @server10.hosthat.com  -t AXFR  bizhat.com
    
    ; <<>> DiG 9.5.1-P2-RedHat-9.5.1-2.P2.fc10 <<>> @server10.hosthat.com -t AXFR bizhat.com
    ; (1 server found)
    ;; global options:  printcmd
    bizhat.com.             86400   IN      SOA     dns10.hosthat.com. hostonnet.gmail.com. 2008091126 7100 7200 2419100 86400
    bizhat.com.             14400   IN      MX      0 server52.hosthat.com.
    bizhat.com.             86400   IN      NS      dns10.hosthat.com.
    bizhat.com.             86400   IN      NS      server70.hosthat.com.
    bizhat.com.             14400   IN      A       67.228.96.44
    *.bizhat.com.           14400   IN      A       66.90.101.78
    aaj.bizhat.com.         14400   IN      A       67.228.37.136
    adserver.bizhat.com.    14400   IN      A       174.37.154.236
    advt.bizhat.com.        14400   IN      A       67.228.95.96
    alappuzha.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    angamaly.bizhat.com.    14400   IN      CNAME   cms.bizhat.com.
    arthunkal.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    astrology.bizhat.com.   14400   IN      A       67.228.37.136
    austin.bizhat.com.      14400   IN      CNAME   cms.bizhat.com.
    autos.bizhat.com.       14400   IN      CNAME   cms.bizhat.com.
    bangalore.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    banner.bizhat.com.      14400   IN      A       67.228.37.136
    bb.bizhat.com.          14400   IN      A       76.76.18.19
    beauty.bizhat.com.      14400   IN      CNAME   cms.bizhat.com.
    bizhat-radio.bizhat.com. 14400  IN      A       72.21.41.242
    blog.bizhat.com.        14400   IN      A       76.76.18.23
    *.blog.bizhat.com.      14400   IN      A       76.76.18.23
    blogs.bizhat.com.       14400   IN      A       208.53.161.106
    books.bizhat.com.       14400   IN      CNAME   cms.bizhat.com.
    bsc.bizhat.com.         14400   IN      A       67.228.37.136
    calendar.bizhat.com.    14400   IN      CNAME   cms.bizhat.com.
    chat.bizhat.com.        14400   IN      A       67.228.37.136
    chellanam.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    cherthala.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    cherthalainfo.bizhat.com. 14400 IN      CNAME   cms.bizhat.com.
    classifieds.bizhat.com. 14400   IN      A       67.228.37.136
    cms.bizhat.com.         14400   IN      A       76.76.18.22
    computer.bizhat.com.    14400   IN      A       67.228.37.136
    counter.bizhat.com.     14400   IN      A       76.76.18.19
    dating.bizhat.com.      14400   IN      A       76.76.18.23
    dileep.bizhat.com.      14400   IN      CNAME   cms.bizhat.com.
    dir.bizhat.com.         14400   IN      A       72.36.166.222
    directory.bizhat.com.   14400   IN      A       67.228.96.44
    divyaunni.bizhat.com.   14400   IN      A       67.228.96.44
    domainname.bizhat.com.  14400   IN      CNAME   cms.bizhat.com.
    domains.bizhat.com.     14400   IN      A       67.228.37.136
    downloads.bizhat.com.   14400   IN      A       67.228.95.96
    ecards.bizhat.com.      14400   IN      A       67.228.37.136
    education.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    emedia.bizhat.com.      14400   IN      A       67.228.37.136
    ernakulam.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    ezhupunna.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    filmreviews.bizhat.com. 14400   IN      A       76.76.18.23
    finance.bizhat.com.     14400   IN      CNAME   cms.bizhat.com.
    findhost.bizhat.com.    14400   IN      A       67.228.37.136
    forums.bizhat.com.      14400   IN      A       69.59.28.85
    free.bizhat.com.        14400   IN      A       208.53.161.106
    freeforums.bizhat.com.  14400   IN      A       208.53.161.107
    freeinfo.bizhat.com.    14400   IN      A       67.228.37.136
    freelance.bizhat.com.   14400   IN      A       67.228.37.136
    friends.bizhat.com.     14400   IN      A       65.98.61.140
    ftp.bizhat.com.         14400   IN      CNAME   bizhat.com.
    gallery.bizhat.com.     14400   IN      A       69.59.28.85
    games.bizhat.com.       14400   IN      A       67.228.37.136
    gifts.bizhat.com.       14400   IN      CNAME   cms.bizhat.com.
    git.bizhat.com.         14400   IN      A       67.228.104.123
    gptcktm.bizhat.com.     14400   IN      CNAME   cms.bizhat.com.
    guestbook.bizhat.com.   14400   IN      A       67.228.37.136
    gujarat.bizhat.com.     14400   IN      CNAME   cms.bizhat.com.
    hamradio.bizhat.com.    14400   IN      CNAME   cms.bizhat.com.
    health.bizhat.com.      14400   IN      CNAME   cms.bizhat.com.
    home.bizhat.com.        14400   IN      A       67.228.37.136
    homebiz.bizhat.com.     14400   IN      A       67.228.37.136
    hosted.bizhat.com.      14400   IN      A       67.228.37.136
    hosting.bizhat.com.     14400   IN      A       67.228.37.136
    hotels.bizhat.com.      14400   IN      CNAME   cms.bizhat.com.
    htmltutorial.bizhat.com. 14400  IN      CNAME   cms.bizhat.com.
    idukki.bizhat.com.      14400   IN      CNAME   cms.bizhat.com.
    image.bizhat.com.       14400   IN      A       74.86.201.216
    imagehost.bizhat.com.   14400   IN      A       67.228.104.120
    images.bizhat.com.      14400   IN      A       74.86.201.216
    img1.bizhat.com.        14400   IN      A       69.59.28.86
    img2.bizhat.com.        14400   IN      A       76.76.18.24
    img3.bizhat.com.        14400   IN      A       67.228.104.120
    img4.bizhat.com.        14400   IN      A       208.53.161.108
    img5.bizhat.com.        14400   IN      A       76.76.18.24
    india.bizhat.com.       14400   IN      CNAME   cms.bizhat.com.
    interactivecd.bizhat.com. 14400 IN      A       67.228.37.136
    iptools.bizhat.com.     14400   IN      A       67.228.96.44
    ishtam.bizhat.com.      14400   IN      A       67.228.37.136
    jagathi.bizhat.com.     14400   IN      A       67.228.96.44
    jayaram.bizhat.com.     14400   IN      CNAME   cms.bizhat.com.
    jobs.bizhat.com.        14400   IN      A       76.76.18.23
    jokes.bizhat.com.       14400   IN      A       67.228.37.136
    kannur.bizhat.com.      14400   IN      CNAME   cms.bizhat.com.
    karnataka.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    kasaragod.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    kashmir.bizhat.com.     14400   IN      CNAME   cms.bizhat.com.
    kerala.bizhat.com.      14400   IN      CNAME   cms.bizhat.com.
    kidsempire.bizhat.com.  14400   IN      CNAME   cms.bizhat.com.
    kochi.bizhat.com.       14400   IN      CNAME   cms.bizhat.com.
    koilparampil.bizhat.com. 14400  IN      CNAME   cms.bizhat.com.
    kollam.bizhat.com.      14400   IN      CNAME   cms.bizhat.com.
    kottayam.bizhat.com.    14400   IN      CNAME   cms.bizhat.com.
    kovalam.bizhat.com.     14400   IN      CNAME   cms.bizhat.com.
    kozhikode.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    kumarakom.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    kunchackoboban.bizhat.com. 14400 IN     A       67.228.96.44
    labs.bizhat.com.        14400   IN      A       69.93.202.216
    lifestyle.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    linuxcd.bizhat.com.     14400   IN      CNAME   cms.bizhat.com.
    localhost.bizhat.com.   14400   IN      A       127.0.0.1
    lonavala.bizhat.com.    14400   IN      CNAME   cms.bizhat.com.
    lotus.bizhat.com.       14400   IN      CNAME   cms.bizhat.com.
    mail.bizhat.com.        14400   IN      A       76.76.18.23
    www.mail.bizhat.com.    14400   IN      A       76.76.18.23
    malappuram.bizhat.com.  14400   IN      CNAME   cms.bizhat.com.
    mammooty.bizhat.com.    14400   IN      CNAME   cms.bizhat.com.
    mano.bizhat.com.        14400   IN      A       67.228.95.96
    www.mano.bizhat.com.    14400   IN      A       67.228.95.96
    mariasadanam.bizhat.com. 14400  IN      CNAME   cms.bizhat.com.
    media.bizhat.com.       14400   IN      A       76.76.18.22
    mohanlal.bizhat.com.    14400   IN      CNAME   cms.bizhat.com.
    movies.bizhat.com.      14400   IN      A       74.86.201.216
    munnar.bizhat.com.      14400   IN      CNAME   cms.bizhat.com.
    music.bizhat.com.       14400   IN      A       67.228.37.136
    news.bizhat.com.        14400   IN      A       67.228.96.44
    newsletter.bizhat.com.  14400   IN      A       67.228.95.96
    newstar.bizhat.com.     14400   IN      A       67.228.37.136
    novel.bizhat.com.       14400   IN      A       67.228.37.136
    palakkad.bizhat.com.    14400   IN      CNAME   cms.bizhat.com.
    pallipuram.bizhat.com.  14400   IN      CNAME   cms.bizhat.com.
    pallithode.bizhat.com.  14400   IN      CNAME   cms.bizhat.com.
    pathanamthitta.bizhat.com. 14400 IN     CNAME   cms.bizhat.com.
    pets.bizhat.com.        14400   IN      CNAME   cms.bizhat.com.
    phpbb.bizhat.com.       14400   IN      CNAME   cms.bizhat.com.
    phptutorial.bizhat.com. 14400   IN      CNAME   cms.bizhat.com.
    postfix.bizhat.com.     14400   IN      CNAME   cms.bizhat.com.
    print.bizhat.com.       14400   IN      CNAME   cms.bizhat.com.
    qmail.bizhat.com.       14400   IN      CNAME   cms.bizhat.com.
    radio.bizhat.com.       14400   IN      A       67.228.96.44
    ranakpur.bizhat.com.    14400   IN      CNAME   cms.bizhat.com.
    realestate.bizhat.com.  14400   IN      A       67.228.37.136
    recipes.bizhat.com.     14400   IN      A       67.228.37.136
    s1.bizhat.com.          14400   IN      A       76.76.18.23
    *.s1.bizhat.com.        14400   IN      A       76.76.18.23
    s2.bizhat.com.          14400   IN      A       76.76.18.21
    *.s2.bizhat.com.        14400   IN      A       76.76.18.21
    s3.bizhat.com.          14400   IN      A       76.76.18.21
    *.s3.bizhat.com.        14400   IN      A       76.76.18.21
    s4.bizhat.com.          14400   IN      A       76.76.18.21
    *.s4.bizhat.com.        14400   IN      A       76.76.18.21
    salu.bizhat.com.        14400   IN      CNAME   cms.bizhat.com.
    sanjeevani.bizhat.com.  14400   IN      CNAME   cms.bizhat.com.
    screensaver.bizhat.com. 14400   IN      A       67.228.37.136
    scripts.bizhat.com.     14400   IN      A       67.228.37.136
    search.bizhat.com.      14400   IN      A       67.228.37.136
    sites.bizhat.com.       14400   IN      CNAME   cms.bizhat.com.
    smartboss.bizhat.com.   14400   IN      A       174.37.154.236
    sms.bizhat.com.         14400   IN      A       76.76.18.23
    star.bizhat.com.        14400   IN      CNAME   cms.bizhat.com.
    stefin.bizhat.com.      14400   IN      CNAME   cms.bizhat.com.
    stmarys.bizhat.com.     14400   IN      CNAME   cms.bizhat.com.
    www.stmarys.bizhat.com. 14400   IN      CNAME   cms.bizhat.com.
    submit.bizhat.com.      14400   IN      A       67.228.37.136
    sureshgopi.bizhat.com.  14400   IN      CNAME   cms.bizhat.com.
    test.bizhat.com.        14400   IN      A       67.228.37.136
    thanki.bizhat.com.      14400   IN      CNAME   cms.bizhat.com.
    thiruvananthapuram.bizhat.com. 14400 IN CNAME   cms.bizhat.com.
    thrissur.bizhat.com.    14400   IN      CNAME   cms.bizhat.com.
    top100.bizhat.com.      14400   IN      A       76.76.18.23
    tourism.bizhat.com.     14400   IN      CNAME   cms.bizhat.com.
    tutorials.bizhat.com.   14400   IN      CNAME   cms.bizhat.com.
    uploads.bizhat.com.     14400   IN      A       67.228.226.99
    uploads.bizhat.com.     14400   IN      A       76.76.18.19
    ftp.uploads.bizhat.com. 14400   IN      A       208.53.170.247
    s1.uploads.bizhat.com.  14400   IN      A       127.0.0.1
    s2.uploads.bizhat.com.  14400   IN      A       208.53.168.39
    s3.uploads.bizhat.com.  14400   IN      A       208.53.168.13
    s4.uploads.bizhat.com.  14400   IN      A       208.53.158.66
    s5.uploads.bizhat.com.  14400   IN      A       67.159.61.214
    s6.uploads.bizhat.com.  14400   IN      A       67.159.60.15
    s7.uploads.bizhat.com.  14400   IN      A       66.90.104.210
    s8.uploads.bizhat.com.  14400   IN      A       208.53.136.114
    s9.uploads.bizhat.com.  14400   IN      A       66.90.104.184
    www.uploads.bizhat.com. 14400   IN      A       67.228.226.99
    uploads-nu-s54.bizhat.com. 14400 IN     A       76.76.18.23
    varkala.bizhat.com.     14400   IN      CNAME   cms.bizhat.com.
    video.bizhat.com.       14400   IN      A       67.228.116.84
    s1.video.bizhat.com.    14400   IN      A       69.59.28.86
    s2.video.bizhat.com.    14400   IN      CNAME   1wp-f2a00a0000000000.id.velocix.com.
    static1.video.bizhat.com. 14400 IN      A       76.76.18.24
    visitation.bizhat.com.  14400   IN      CNAME   cms.bizhat.com.
    wayanad.bizhat.com.     14400   IN      CNAME   cms.bizhat.com.
    webftp.bizhat.com.      14400   IN      A       208.53.161.106
    webmaster.bizhat.com.   14400   IN      A       67.228.37.136
    world.bizhat.com.       14400   IN      A       67.228.37.136
    worldseven.bizhat.com.  14400   IN      A       127.0.0.2
    www.bizhat.com.         14400   IN      CNAME   bizhat.com.
    yearofdevil.bizhat.com. 14400   IN      A       67.228.37.136
    yellowpages.bizhat.com. 14400   IN      A       67.228.95.96
    yourname.bizhat.com.    14400   IN      CNAME   cms.bizhat.com.
    youtubescript.bizhat.com. 14400 IN      A       67.228.192.156
    bizhat.com.             86400   IN      SOA     dns10.hosthat.com. hostonnet.gmail.com. 2008091126 7100 7200 2419100 86400
    ;; Query time: 113 msec
    ;; SERVER: 67.228.226.101#53(67.228.226.101)
    ;; WHEN: Mon Jul  6 04:22:03 2009
    ;; XFR size: 199 records (messages 1, bytes 4605)
    
    [root@vps3 poweradmin]#
    

    See dig

  • Wildcard DNS zone in bind

    Wildcard DNS zone will act as authoritative DNS for any domain name. This is useful when you have a service like domain name parking service, where customers will change name servers of their domain name to your private label name servers. You need all thse domains get resolved to a specific IP address with out manually configuring DNS zone for each of the domain name.

    Install Bind DNS server.

    On Ubuntu/Debian

    apt-get install bind9
    

    On CentOS/RHEL

    yum install bind9
    

    Create a Catch-All zone file.

    vi  /etc/bind/catch-all.zone
    

    Add following content to the file

    @ IN SOA ns1.yourdomain.com. hostmaster.yourdomain.com. ( 1 3h 1h 1w 1d )
      IN NS YOUR_IP_ADDR_HERE
    * IN A YOUR_IP_ADDR_HERE
    

    In above, replace

    YOUR_IP_ADDR_HERE = IP you need all domains resolve to.
    yourdomain.com = replace with your private label name server domain.

    To make this zone active, you need to add it to named.conf, edit

    On CentOS

    vi  /etc/bind/named.conf.local
    

    On Debian

    vi  /etc/bind/named.conf
    

    At the end of the file, add

    zone "." IN {
            type master;
            file "/etc/bind/catch-all.zone";
    };
    

    Verify there is no error.

    named-checkconf
    

    Restart bind

    systemctl restart bind9
    

    Now verify Catch all DNS zone works with

    nslookup serverok.in YOUR_DNS_SERVER_IP_HERE
    

    It should resolve to the IP address specified in DNS zone file catch-all.zone. In above example, i used serverok.in for testing, you can use any domain, that should resolve to the IP address.

    If you need to set MX rcord for the domains, you can add following to end of catch-all.zone file

      IN    MX      0       mx1.mail-server.com.
      IN    MX      5       mx2.mail-server.com.
    

    See bind

  • bind

    bind is a DNS server.

    To check bind configuration for errors, run

    named-checkconf -z /etc/named.conf
    

    if chroot

    named-checkconf -z -t /var/named/chroot /etc/named.conf
    

    Installation

    Install bind in CentOS 7

  • Install Unbound DNS caching server

    Unbound is an Open source DNS caching and recursive resolver. You can find more about unbound at

    https://nlnetlabs.nl/projects/unbound/about/

    To install unbound on Ubuntu/Debian, run

    apt install unbound
    

    To start unbound

    systemctl start unbound
    

    Set unbound to start on boot

    systemctl enable unbound
    

    To configure your server to use local name servers provided by unbound, edit file

    vi /etc/resolv.conf
    

    Add

    nameserver 127.0.0.1
    

    See dns

  • Free DNS Hosting

    Free DNS Hosting

    Paid DNS Hosting

    • Google Cloud DNS – $0.2 per domain. Traffic will be charged at $0.40 per million queries per month.

    Free Dynamic DNS

  • Delegate a sub domain to DNS server

    Delegate a sub domain to DNS server

    To point a domain to another server, you can create an A record, point to the server.

    If your provider only provide name servers and no fixed IP, you can create NS record for your sub domain like

    sub.domain NS ns1.nameserver.com
    sub.domain NS ns2.nameserver.com
    

    Here is how i added NS record in Amazon Route 53

  • Dig

    Dig

    dig is a command line tool like nslookup used to check dns

    Find Reverse-DNS/PTR using dig, nslookup, host
    Requesting a zone trasnfer with dig

    Here is the basic usage

    dig DOMAIN_NAME
    

    dig have multiple sections, ANSWER SECTION is what you need to look for. After answer section, it shows some info about DNS server used to query.

    +short

    +short option allow you to just slow the answer.

    root@ok-vm:~# dig +short serverok.in
    104.28.18.89
    104.28.19.89
    root@ok-vm:~# 
    

    To find Specific Record type

    dig DOMAIN_NAME RECORD_TYPE
    

    Example

    root@ok-vm:~# dig +short serverok.in mx
    5 alt1.aspmx.l.google.com.
    5 alt2.aspmx.l.google.com.
    10 alt3.aspmx.l.google.com.
    11 alt4.aspmx.l.google.com.
    1 aspmx.l.google.com.
    root@ok-vm:~# 
    

    Dig show detailed info

    You can use +trace to get more detailed info on dig query.

    dig +trace RECORD_TYPE DOMAIN_NAME
    

    Example

    dig +trace ns boby.serverok.in
    

    See nslookup, dns

  • DNS Resolver

    CloudFlare announced privacy-first consumer DNS service.

    IP of CloudFlare public DNS servers are

    1.1.1.1
    1.0.0.1
    

    So far i was using Google Public DNS servers as my resolver.

    8.8.8.8
    8.8.4.4
    

    Quad9

    Quad9 is from IMB and Global Cyber Allience.

    https://www.quad9.net

    9.9.9.9
    

    Other public DNS server is OpenDNS

    208.67.222.222
    208.67.220.220
    

    All these DNS servers have good connectivity in india. I get ~65 ping to these serves, that is normal for indian servers.

    On linux you can configure DNS server by editing file

    vi /etc/resolv.conf
    

    Add

    nameserver 1.1.1.1
    nameserver 8.8.8.8
    nameserver 9.9.9.9