The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Bulk dns zone ttl editor script

Discussion in 'Bind / DNS / Nameserver Issues' started by Branko, Jun 12, 2008.

  1. Branko

    Branko Active Member
    PartnerNOC

    Joined:
    Sep 16, 2005
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    DataCenter Provider
    Not really sure where to put this, so I figured this should be a good place.

    Anyway, probably you have already find yourself in a situation when you have to move a client from one server to another. So to minimize the new ip propagation time one should edit clients dns zones and put as minimal ttl as one can afford.
    After account migration, dns records propagate much faster then usual and client don't even notice they have been moved.

    When it comes to one account it's all fair and simple, edit zone, wait for 24h, migrate the account, edit zone back. But what when you have like 200+ accounts to migrate, 400+ dns zones, and it's absolutely vital that they have minimum dns propagation time.

    Ofc. it would take ages to edit all those zones.

    So... faced with so much migration these days, I decided to write this script that should help me in that dns zone editing job.

    Script will edit ttl for single or a list of domain names. It changes the zone db file in /var/named/ (if you have your db files placed anywhere else rewrite that). It sets desired ttl, increments the serial, and then invokes cpanel's perl script for that zone dns cluster sync.

    It should be pretty easy to use.

    It also requires installed http://search.cpan.org/~simonflk/DNS-ZoneParse-0.95/lib/DNS/ZoneParse.pm perl module.

    BEFORE YOU USE THIS SCRIPT, MAKE A BACKUP COPY OF YOUR DATA.
    USE THIS SCRIPT AT YOUR OWN RISK, AUTHOR TAKES NO RESPONSIBILITY FOR ANY DAMAGE CAUSED BY USING IT.


    Ps. Any feedback would be more than welcomed
     

    Attached Files:

    #1 Branko, Jun 12, 2008
    Last edited: Oct 29, 2008
  2. vikins

    vikins Well-Known Member

    Joined:
    Oct 3, 2006
    Messages:
    92
    Likes Received:
    1
    Trophy Points:
    8
    We all need this, but we're all afraid to try it! ;)

    I'm going to try it next time I do a big migration. I just finished one, so I don't need it right now. Thank you sharing.
     
  3. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    If you use cPanel/WHM 11.23 on both servers, simply use the option to update DNS on the source server to negate the need for manually editing DNS TTLs during transfers to minimize downtime due to DNS propagation.
     
  4. Branko

    Branko Active Member
    PartnerNOC

    Joined:
    Sep 16, 2005
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    DataCenter Provider
    Usually I do when there is a need to transfer only few domains, but 20+ already gets pain in the ass to edit.

    So you just put domain list in file, and give it to script to do the rest :D

    Also thing is... from one of the latest updates in whm/cpanel, during transfers it now remembers custom dns entrys even custom TTLs, so if you forget to re-edit them back, soon you end up with bunch of domains with extremely low TTL. Tbh, thats the real reason why I made this script. :D
     
  5. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Why not use the transfer multiple accounts function and simply check the box? You only need to check the box once for the entire transfer if you are doing a multi-account transfer.

    No manual script editing is needed.
     
  6. CoolMike

    CoolMike Well-Known Member

    Joined:
    Sep 6, 2001
    Messages:
    307
    Likes Received:
    0
    Trophy Points:
    16
    At least my WHM don't have this function yet. I have it for single account transfer, but not for multiple account transfers.

    Michael
     
  7. Kurieuo

    Kurieuo Well-Known Member

    Joined:
    Dec 13, 2002
    Messages:
    98
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Australia
    I personally did not want to do multiple account as I have read it does not always carry an account across in one piece.

    I used this script and worked like a charm once I installed the perl mod and created the list of files.

    Thanks a bunch!
     
  8. Branko

    Branko Active Member
    PartnerNOC

    Joined:
    Sep 16, 2005
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    DataCenter Provider
    Jeah me neither... and judging by this thread http://forums.cpanel.net/showthread.php?t=76972

    that function really don't do the "trick" I want while moving inside same dns cluster. You really need to manually edit zones you wish to move day before, and wait day or two to allow new small ttl propagation time, so when you eventually move the acc. it should propagate it's A, Cname and MX records almost instantaneously.
     
  9. websnail.net

    websnail.net Active Member

    Joined:
    Mar 24, 2002
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    6
    Unfortunately what this doesn't resolve is those users going to pick up their email from mail.foo.tld...

    I've found that every single one of my clients (post move) is connecting to the wrong server to get their email whilst all the email is being delivered to the new one. 24 hour wait pending now for the nameservers to catch up and they'll start getting their emails.
     
    #9 websnail.net, Sep 24, 2008
    Last edited: Sep 24, 2008
Loading...

Share This Page