DA server: how to change domain name?

Ximmer

Verified User
Joined
Feb 12, 2006
Messages
22
Location
The Netherlands
It might be something simple but I would like to avoid getting into trouble therefor my question and situation.

Question:
I recently installed DA for the first time and used the domain which was available at that time, this was a temporary situation however. The domain used was also used to host a website and it will be used in the future too. So the domain remains in use.

I have now registered a new domain name which I would like to use for the DA server.
This domain will also be used to host a website.

The DA control panel has the FQDN of the server's hostname which is: myserver.my-old-domain.com which I would like to change in myserver.my-new-domain.com.
Please note that the hostname won't change, it will still be "myserver". Only the domain name will change.
The IP does not change either, the new domain will also point to the same (shared) IP address.

Is a change of the server's hostname in the appropriate DA control panel field sufficient?
The name servers need to be changed too I guess, they are now called ns1.my-old-domain.com this needs to be ns1.my-new-domain.com.
The old domain will probably work too, because it will be resolved to the same IP address. I would like to be consistent and use the same domain in all fields if possible.

Please advice what the right sequence is to change the domain name of the DA server. I am not sure if the domain name is stored somewhere in config files which I am not aware of.
 
Ximmer said:
Is a change of the server's hostname in the appropriate DA control panel field sufficient?
Do it, but it's not sufficient. See below:

The name servers need to be changed too I guess, they are now called ns1.my-old-domain.com this needs to be ns1.my-new-domain.com.
Yes.

And also make sure you have reverse DNS pointing the shared IP to the new hostname. Putting it into your own local server won't be enough unless your upstream connection provider has delegated reverse DNS to you. Most don't.

Jeff
 
Re: Re: DA server: how to change domain name?

jlasman said:
Do it, but it's not sufficient. See below:


Yes.

And also make sure you have reverse DNS pointing the shared IP to the new hostname. Putting it into your own local server won't be enough unless your upstream connection provider has delegated reverse DNS to you. Most don't.

Jeff

About the Reverse DNS.
So you say I have to point the rDNS back to the hostname+domain name of the DA server?

In my case: 85.xxx.xxx.xxx => myserver.my-new-domain.com ?

My provider now gives me the choice to enter something in the Reverse DNS field like: hosted.by.myhostingcompany.com

This does work but shows an error.
(Reverse DNS lookup www.dnsstuff.com)
Results in:
A=None] *ERROR* There is no A record (may be cached).

That is not a surprise because the "hosted.by...." is not a valid name. I will change this now.

Problem with Reverse DNS solved: changed entry to the domain name of the DA server and replaced the name of my choice
 
Last edited:
My new domain for the DA server arrived.

I have changed the domain using the DA panel (Administrator Settings).

DA is restarted and resolving the new domain works fine.
Note, the IP address has not been changed, only the domain name has been changed.

I have noticed the /etc/host file has been changed by DA.
It now contains an extra line with (ofcourse) the same IP and the new domain.


Code:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
85.xx.xxx.xx            my-daserver.my-old-domain.com
85.xx.xxx.xx            my-daserver.my-new-domain.com

My already existing domains and website hosted on my server are still pointing to the old name server (ns1.my-old-domain.com) and not the new NS1/NS2, like: ns1.my-new-domain.com.

Do I need to edit each domain in the configuration, delete the old NS's and add the new NS's?
Or is it possible to use a kind of template and edit all the sites at once?

The info in the directory /var/named contains the data for my sites, i.e. domain1.com.db, domain2.com.db etc...
All these ".db" files still contain the old name servers.
In fact it looks like the same info as shown in the DA control panel.

O yeah....
I have changed the Reverse DNS entries too.
They now return "hosted.by.my-new-domain.com" if I check my IP address.

This looks good if I am using the DNS stuff check tools. (www.dnsstuff.com)
 
Last edited:
Ximmer said:
Do I need to edit each domain in the configuration, delete the old NS's and add the new NS's?
Or is it possible to use a kind of template and edit all the sites at once?
I do it with a perl one-liner.

I've always updated the serial numbes manually (if you have slave nameservers and don't update the serial numbers in the .db file, the slaves won't ever get the new zone records; they'll think the old ones are still good.

But someone told me recently that the DA command-line command to rewrite all the DNS records will update the serial numbers.

Try:
Code:
echo "action=rewrite&value=named" >> /usr/local/directadmin/data/task.queue
and see if the serial numbers have all been updated.

(Can anyone tell me if there's a list of all of these action=rewrite commands somewhere?)
The info in the directory /var/named contains the data for my sites, i.e. domain1.com.db, domain2.com.db etc...
All these ".db" files still contain the old name servers.
In fact it looks like the same info as shown in the DA control panel.[/quote
As in fact it should, since the DA control panel is simply reading those .db files :) .
O yeah....
I have changed the Reverse DNS entries too.
They now return "hosted.by.my-new-domain.com" if I check my IP address.

This looks good if I am using the DNS stuff check tools. (www.dnsstuff.com)
It probably looks good for you, but to Internet professionals it looks like you don't realize the purpose of reverse DNS is to maintain network integrety, not to advertise :p .

Jeff
 
jlasman said:
I do it with a perl one-liner.

I've always updated the serial numbes manually (if you have slave nameservers and don't update the serial numbers in the .db file, the slaves won't ever get the new zone records; they'll think the old ones are still good.

But someone told me recently that the DA command-line command to rewrite all the DNS records will update the serial numbers.

Try:
Code:
echo "action=rewrite&value=named" >> /usr/local/directadmin/data/task.queue
and see if the serial numbers have all been updated.

(Can anyone tell me if there's a list of all of these action=rewrite commands somewhere?)

It probably looks good for you, but to Internet professionals it looks like you don't realize the purpose of reverse DNS is to maintain network integrety, not to advertise :p .

Jeff

Jeff, I did the change as you suggested, but the Name Servers are still the same in the xxxxx.db files (/var/named/*.db)

The only thing what has been changed is the date in the xxxx.db files. (serial?)
It was 2006021300 and is now 2006030100.

I don't know if there is another way of changing the Name Server entries for all domain, if not I have to change them manually. This is not a big deal because I only have 5 domains hosted at this moment, but I would be a problem if there are a lot of domains present.

BTW:
I will change the Reverse DNS again, so it reflects the real domain name and remove the "hosted.by" prefix :)
 
You've answered my question; the command does update the serial number.

What it's doing is rewriting all the DNS zone files from the master template.

Changing the template is one way to change the zone files, but it's a bad way.

I think if you just change the default nameservers for all the resellers and then rerun that command I pasted into my previous post, all the nameservers may be changed.

Otherwise, I suggest a perl one-liner. Of which I didn't show an example.

Something like this:
Code:
perl -i.bak -p -e 's/old-text/new-text/ig' *.db
But I don't recommend doing it blindly without knowing what it's supposed to do.

Even though it creates backup files (which you should delete after you've run my other command (from the previous post), you should probably back up the entire directory first.

Jeff
 
jlasman said:
You've answered my question; the command does update the serial number.

What it's doing is rewriting all the DNS zone files from the master template.

Changing the template is one way to change the zone files, but it's a bad way.

I think if you just change the default nameservers for all the resellers and then rerun that command I pasted into my previous post, all the nameservers may be changed.

Otherwise, I suggest a perl one-liner. Of which I didn't show an example.

Something like this:
Code:
perl -i.bak -p -e 's/old-text/new-text/ig' *.db
But I don't recommend doing it blindly without knowing what it's supposed to do.

Even though it creates backup files (which you should delete after you've run my other command (from the previous post), you should probably back up the entire directory first.

Jeff

I have used the "simple" way now using the DA Control panel and modified every dns entry for each hosted domain.
This was not a lot of work in my case because I am hosting just five domains now.
It would be a different story if you have to change let's say a hundred domains. In that case a perl script would be a lot easier.

Here is a part of the logging which shows you that DA controls the "named" process too. It stops and starts processes and indeed, modifies the .db files in /var/named as to be expected.


Code:
Mar  2 17:50:01 arcadia crond(pam_unix)[23466]: session opened for user root by (uid=0)
Mar  2 17:50:01 arcadia crond(pam_unix)[23472]: session opened for user root by (uid=0)
Mar  2 17:50:01 arcadia httpd: httpd shutdown succeeded
Mar  2 17:50:02 arcadia httpd: httpd startup succeeded
Mar  2 17:50:02 arcadia named[2799]: loading configuration from '/etc/named.conf'
Mar  2 17:50:02 arcadia named[2799]: zone secure.xxxxx.com/IN: loaded serial 2006030200
Mar  2 17:50:02 arcadia named[2799]: zone secure.xxxxx.com/IN: sending notifies (serial 2006030200)
Mar  2 17:50:02 arcadia named[2799]: received notify for zone 'secure.xxxxx.com'
Mar  2 17:50:02 arcadia proftpd[2816]: arcadia.xxxxx.com - received SIGHUP -- master server rehashing configuration file
Mar  2 17:50:02 arcadia proftpd: proftpd -HUP succeeded
Mar  2 17:50:02 arcadia sshd: sshd -HUP succeeded
Mar  2 17:50:02 arcadia crond(pam_unix)[23472]: session closed for user root
Mar  2 17:50:02 arcadia crond(pam_unix)[23466]: session closed for user root
 
Back
Top