PDA

View Full Version : Moved all clients from one server to another - need to mass update DNS


hostpc.com
05-09-2004, 10:36 AM
We've got a server failing - rapidly I might add, and I'm not sure we've got time for DNS propogation.

I took all the clients backups from the failing server, restored them to the new. The only issue noted was that when every client restored on the new server, they restored with the DNS of the old server (ns10a/ns10b). I need to be able to mass update to ns12a/ns12b.

I know I can redirect the IP's with the registrar - but there are some clients that went to one server, and some to another server (ns11a/ns11b) - so that's out of the question (as far as I can see).

Is there a way, to take all clients restored on each server, and have their DNS entries updated to the correct DNS? I'm thinking like a command line update?

I'm really desperate for help on this one... I'd sure appreciate any help you guys can offer.

Thanks

hostpc.com
05-09-2004, 10:38 AM
Forgot to mention - these servers are in different datacenters, so I can't just assign IP's from one server to another... that would have been too easy. :(

wdv
05-09-2004, 11:20 AM
Hello,

To do a mass nameserver change, the easiest is to just use perl:

perl -pi -e 's/ns1.oldns.com/ns1.newns.com/' /var/named/*.db

Do that for both ns's you want to change. You'll probably also want to change the values for in the user.conf file for new domains, eg:

perl -pi -e 's/ns1.oldns.com/ns1.newns.com/' /usr/local/directadmin/data/users/*/user.conf

hostpc.com
05-09-2004, 11:50 AM
Oh, that was WAY too easy.

Thanks!

Dixiesys
05-09-2004, 06:35 PM
That was an easy one, I'da done something like this:

mkdir /root/var/named
cp /var/named/*.db /root/var/named
cd /root/var/named
for i in *
do
cat $i | sed -e s/'nsOLD.domain.com'/'nsNEW.domain.com'/g - > $i
done

Make sure the files are good

then (as an added precaution)
mkdir /root/var/named/old
mv /var/named/*.db /root/var/named/old/
cp /root/var/named/*.db /var/named/
service named restart