Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

DNS updates / few simple scripts to help ...

Discussion in 'Bind/DNS/Nameserver' started by hostmedic, Apr 5, 2007.

  1. hostmedic

    hostmedic Well-Known Member

    Joined:
    Apr 30, 2003
    Messages:
    544
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Washington Court House, Ohio, United States
    cPanel Access Level:
    DataCenter Provider
    In many of the forums - I have read " make sure to update your serial number after making a mass update to DSN"

    the question is How?


    using the sed command you can do this very easily

    After the 200 add the year, month,day and then add 1 each time you make a change
    this is for April 6 2007 change # 10 for the day

    Code:
    sed -i 's/200[0-9]\{7\}/2007040610/g' *.db*
    -----------------

    Now lets say you want to update that pesky 3600000 TTL for SOA --- as shown in DNS stuff...
    from cli run:

    Code:
     /usr/bin/replace '3600000' '1209600' -- /var/named/*.db
    To replace that pesky little 86400 TTL for SOA as shown in DNSstuff.com ... from cli run:

    Code:
     /usr/bin/replace '86400' '1200' -- /var/named/*.db
    
    If you need to change from an old nameserver name to a new one for all domain zones - from cli run:

    Code:
     /usr/bin/replace 'ns.oldname.com' 'ns.newdnsname.com' -- /var/named/*.db
    (changing oldname.com and newdnsname.com to what yours were / are...

    run that for ns2, ns3, etc... as needed.


    Hope that helps

    PS - it is wise to first copy into a backup

    to do this

    Code:
    mkdir /var/named/backup
    
    cp /var/named/*.db /var/named/backup/
    
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #1 hostmedic, Apr 5, 2007
    Last edited: Apr 5, 2007
  2. binaer

    binaer Well-Known Member

    Joined:
    Jul 6, 2004
    Messages:
    60
    Likes Received:
    0
    Trophy Points:
    156
    Hi

    I've to change the DNS-Entry, type "MX", from
    IN MX 10 mail.mydomain.com.
    to
    IN MX 10 mail.mailcluster.domain.com.

    and this for every zone...

    so, I've to make first a grep on
    zone.com.db equals to IN MX 10 mail.zone.com.
    then, replace with
    IN MX 10 mail.mailcluster.domain.com.

    any Idea, how to handle this? I standing on the tube atm
     
  3. ianmarie

    ianmarie Well-Known Member

    Joined:
    Mar 27, 2006
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    156
    Great Post

    Just what the doctor ordered; thanks for the post

    One thing I would comment on is that if changing dns refresh rates for the purpose of moving servers; best not to use values that are less than 256 using these sample commands; as these lower numbers will then conflict with ip addresses and do damage to your zone files.

    discovered this as I ran some tests first on non-active files before I made a huge mistake!

    Thanks again

    Ian
     
  4. whplus

    whplus Well-Known Member

    Joined:
    Dec 8, 2007
    Messages:
    74
    Likes Received:
    2
    Trophy Points:
    58
    Location:
    Behind your business
    you can also use this command to keep old files:
    Code:
    cd /var/named && perl -pi.bak -e "s/oldstring/newstring/g" *.db
    susan,
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice