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!

SOLVED Global zone update command not working?

Discussion in 'Bind/DNS/Nameserver' started by rhm.geerts, Apr 20, 2018.

Tags:
  1. rhm.geerts

    rhm.geerts Well-Known Member

    Joined:
    Jul 29, 2008
    Messages:
    93
    Likes Received:
    6
    Trophy Points:
    58
    Location:
    Maastricht
    cPanel Access Level:
    Root Administrator
    I wanted to make some small changes to zone files.
    On the forums I found several thread that if you change values, you also have to update the serial number of all zone files.

    And I found this command to do that in a couple of threads:
    Code:
    find /var/named/*.db -mtime -1 -exec perl -pi -e 'if (/^\s+(\d{10})\s+;\s+serial/i) { my $i = $1+1; s/$1/$i/;}' '{}' \;
    Ofcourse I made a backup first and this is what happening.
    Original (backup) file serial:
    Code:
                                                    2018042000 ;Serial Number
                                                    3600 ;refresh

    So I issue the command given and the serial is still exactly the same instead of changing to 2018042001. Reloading the namserver does not make any difference.

    When I edit the zone file via Edit DNS Zone in WHM, then the serial does change to 2018042001. So then it gets updated.

    Am I doing something wrong or why isn't this changing the 0 to a 1?

    Als something else confuses me from the Zone editor.
    Because of the moment of change, the server date/time is:
    April 21 2018, but the serial will be 2018042001.

    Serial numbers format are in normally YYYYmmddss.
    So I wonder why when the zonefile is editted, it's not updated to 20180421xx but the old date of 20180420xx is kept and used and only the last number is updated without the date?
     
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,888
    Likes Received:
    90
    Trophy Points:
    78
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    # cd /var/named
    # sed -i 's/<old>/2018042001/g' *.db

    You can execute above command to change the serial number..
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    rhm.geerts likes this.
  3. rhm.geerts

    rhm.geerts Well-Known Member

    Joined:
    Jul 29, 2008
    Messages:
    93
    Likes Received:
    6
    Trophy Points:
    58
    Location:
    Maastricht
    cPanel Access Level:
    Root Administrator
    Thank you, I can use that for the domains not changed manually yet.

    Still wondering why on manual change the date is not change to todays date like 20180422xx. I discovered for some reason the WHM date is not corresponding the server date.
    Changes made today with the zone editor will change the serial to 20180421.xx today on the 22th which is server date/time.
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,214
    Likes Received:
    1,936
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @rhm.geerts,

    Changes to the DNS zone using a cPanel & WHM feature such as "WHM >> Edit DNS Zone" don't replace the serial with the current date. Instead, the serial is simply incremented by one digit. For example, let's say a zone was created on 04-16-2018:

    Code:
    # grep -i 'serial' /var/named/domain.tld.db
                           2018041600 ;Serial Number
    Using "WHM >> Edit DNS Zone" to make a change to this zone in the future will increment the serial by one. EX:

    Code:
    # grep -i 'serial' /var/named/domain.tld.db
                            2018041601 ;Serial Number
    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. rhm.geerts

    rhm.geerts Well-Known Member

    Joined:
    Jul 29, 2008
    Messages:
    93
    Likes Received:
    6
    Trophy Points:
    58
    Location:
    Maastricht
    cPanel Access Level:
    Root Administrator
    Hello Michael.

    That's indeed what I discovered. For some reason it changed to 20180421 yesterday on that domain I tested. Normally it doesn't, you're correct.

    But my question was if there is a reason for it. I know it's not really necessary to use the correct date, but as far as I know it's common practice. DA for example uses correct dates too.
    And when used it's easy to see when the last DNS change was made. Which can't be seen by the way it's used now.

    So that's why I wonder why cPanel is not using it that way.
     
  6. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,214
    Likes Received:
    1,936
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    I don't believe we avoid using the date of the modification for any specific reason, other than it's not required as long as the serial is incremented. I encourage you to open a feature request if you'd like to see a change to how this works:

    Submit A Feature Request

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    rhm.geerts likes this.
  7. rhm.geerts

    rhm.geerts Well-Known Member

    Joined:
    Jul 29, 2008
    Messages:
    93
    Likes Received:
    6
    Trophy Points:
    58
    Location:
    Maastricht
    cPanel Access Level:
    Root Administrator
    It's indeed no requirement, I thought that would be the reason. Thank you for confirmation.
    This can be marked as solved!
     
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