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.

Wrong nameservers in each DNS entry

Discussion in 'Bind / DNS / Nameserver Issues' started by dan_c, Mar 30, 2006.

  1. dan_c

    dan_c Active Member

    Joined:
    Jul 23, 2005
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    I got a new server which came with nameservers set as, say ns1.datacenter.com and ns2.datacenter.com. I copied over all the cPanel accounts to this new server, then went and set ns1.mydomain.com and ns2.mydomain.com as the domains in the basic WHM configuration. However, now when I go to "edit DNS" for any account which i transferred over, it still has ns1/ns2.datacenter.com set for its nameservers. Is there any easier way than to manually go through to fix this?
     
  2. CollateralFX

    CollateralFX Active Member

    Joined:
    Jan 19, 2005
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    USA
    Try going into WHM as root, going down to DNS Functions, then clicking on "Sync DNS Records" then click on Sync all local.

    Might work might not.

    ~Nick
     
  3. dan_c

    dan_c Active Member

    Joined:
    Jul 23, 2005
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    no such luck. Thanks anyways.
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
  5. dan_c

    dan_c Active Member

    Joined:
    Jul 23, 2005
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    What would be the linux ssh command to do a replace command over all those files?
     
  6. Murtaza_t

    Murtaza_t Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    476
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Earth
    cPanel Access Level:
    Website Owner
    Not a command but this is a small script that will make your work easy :

    Code:
    ]# cd /var/named 
    THE ABOVE STEP IS VERY IMPORTANT
    Code:
    /var/named]# touch replace
    /var/named]# chmod 700 replace
    /var/named]# pico replace 
    And paste this script :
    Code:
    #!/bin/bash
    for fl in *.db; do
    mv $fl $fl.old
    sed -e 's/ns1.datacenter.com/ns1.mydomain.com/; s/ns2.datacenter.com/ns2.mydomain.com/' $fl.old > $fl
    #rm -f $fl.old
    done
    Save and exit.
    Code:
    /var/named]# ./replace
    Uncomment rm -f $fl.old if you don't want to bother keeping a copy of the old files.

    I would also suggest you take the backup of your /var/named folder in case you make any mistakes. How ever I am sure that the above script does work.
     
  7. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    You can also just use the replace command:

    replace ns1.olddomain.com ns1.newdomain.com -- /var/named/*.db
    replace ns2.olddomain.com ns2.newdomain.com -- /var/named/*.db
     
  8. dan_c

    dan_c Active Member

    Joined:
    Jul 23, 2005
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    What is the affect if I just leave these as they are? I have the domain names pointing to my nameservers, and they seem to be working properly. (Why mess with something if its not broken?).
     
  9. dan_c

    dan_c Active Member

    Joined:
    Jul 23, 2005
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    I went ahead and did the replace, but I put the serialupdate into a file and tried to run it, but had some compile hangup on line 9 about BEGIN FAILED, so I am guessing the serials didn't update. How does this affect things?
     
  10. kirkmiesle

    kirkmiesle Member

    Joined:
    Jan 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    OHIO
    #10 kirkmiesle, Sep 26, 2006
    Last edited: Sep 26, 2006
Loading...

Share This Page