Moving many sites to new server - whats the quickest way to update their DNS records?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I'm planning on migrating a large-ish amount of websites (approx 100) to a new server and I'm in the migration planning process.
A typical DNS zone for each website has two A records pointing to the web server IP, one for domain.com and one for the www subdomain.
When we're all setup and ready to launch the new server to production, changing 100x2 DNS records will be time-consuming so I'm searching a way to make this quicker. In a couple cases I read about creating a bash script that iterates the DNS records and performs a find-replace with the new IP.
In other topics I've read suggestions about adding A records with the new IP so that when the current server is no longer available, the DNS server will point the requests to the next record, that containing the new IP.
Apart from these, is there any scenario in which I could replace the A records with some other type of DNS entry ie a hostname so that, when the time comes, I can only change the IP of the hostname with the new one and have all websites point to the new server? I'm sure 'hostname' is not the right term, I hope you all get the idea though.
domain-name-system migration dns-zone
New contributor
bikey77 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
1
down vote
favorite
I'm planning on migrating a large-ish amount of websites (approx 100) to a new server and I'm in the migration planning process.
A typical DNS zone for each website has two A records pointing to the web server IP, one for domain.com and one for the www subdomain.
When we're all setup and ready to launch the new server to production, changing 100x2 DNS records will be time-consuming so I'm searching a way to make this quicker. In a couple cases I read about creating a bash script that iterates the DNS records and performs a find-replace with the new IP.
In other topics I've read suggestions about adding A records with the new IP so that when the current server is no longer available, the DNS server will point the requests to the next record, that containing the new IP.
Apart from these, is there any scenario in which I could replace the A records with some other type of DNS entry ie a hostname so that, when the time comes, I can only change the IP of the hostname with the new one and have all websites point to the new server? I'm sure 'hostname' is not the right term, I hope you all get the idea though.
domain-name-system migration dns-zone
New contributor
bikey77 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
What DNS server / service are you using? When you do make the change you could consider using a CNAME rather than A record then if you move server again you only have a single A record to update
– Phil
36 mins ago
We're using WHM for managing our DNS. Good point about the CNAME, I'm going to use your suggestion.
– bikey77
20 mins ago
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm planning on migrating a large-ish amount of websites (approx 100) to a new server and I'm in the migration planning process.
A typical DNS zone for each website has two A records pointing to the web server IP, one for domain.com and one for the www subdomain.
When we're all setup and ready to launch the new server to production, changing 100x2 DNS records will be time-consuming so I'm searching a way to make this quicker. In a couple cases I read about creating a bash script that iterates the DNS records and performs a find-replace with the new IP.
In other topics I've read suggestions about adding A records with the new IP so that when the current server is no longer available, the DNS server will point the requests to the next record, that containing the new IP.
Apart from these, is there any scenario in which I could replace the A records with some other type of DNS entry ie a hostname so that, when the time comes, I can only change the IP of the hostname with the new one and have all websites point to the new server? I'm sure 'hostname' is not the right term, I hope you all get the idea though.
domain-name-system migration dns-zone
New contributor
bikey77 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I'm planning on migrating a large-ish amount of websites (approx 100) to a new server and I'm in the migration planning process.
A typical DNS zone for each website has two A records pointing to the web server IP, one for domain.com and one for the www subdomain.
When we're all setup and ready to launch the new server to production, changing 100x2 DNS records will be time-consuming so I'm searching a way to make this quicker. In a couple cases I read about creating a bash script that iterates the DNS records and performs a find-replace with the new IP.
In other topics I've read suggestions about adding A records with the new IP so that when the current server is no longer available, the DNS server will point the requests to the next record, that containing the new IP.
Apart from these, is there any scenario in which I could replace the A records with some other type of DNS entry ie a hostname so that, when the time comes, I can only change the IP of the hostname with the new one and have all websites point to the new server? I'm sure 'hostname' is not the right term, I hope you all get the idea though.
domain-name-system migration dns-zone
domain-name-system migration dns-zone
New contributor
bikey77 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
bikey77 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
bikey77 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 59 mins ago
bikey77
1062
1062
New contributor
bikey77 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
bikey77 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
bikey77 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
What DNS server / service are you using? When you do make the change you could consider using a CNAME rather than A record then if you move server again you only have a single A record to update
– Phil
36 mins ago
We're using WHM for managing our DNS. Good point about the CNAME, I'm going to use your suggestion.
– bikey77
20 mins ago
add a comment |Â
What DNS server / service are you using? When you do make the change you could consider using a CNAME rather than A record then if you move server again you only have a single A record to update
– Phil
36 mins ago
We're using WHM for managing our DNS. Good point about the CNAME, I'm going to use your suggestion.
– bikey77
20 mins ago
What DNS server / service are you using? When you do make the change you could consider using a CNAME rather than A record then if you move server again you only have a single A record to update
– Phil
36 mins ago
What DNS server / service are you using? When you do make the change you could consider using a CNAME rather than A record then if you move server again you only have a single A record to update
– Phil
36 mins ago
We're using WHM for managing our DNS. Good point about the CNAME, I'm going to use your suggestion.
– bikey77
20 mins ago
We're using WHM for managing our DNS. Good point about the CNAME, I'm going to use your suggestion.
– bikey77
20 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
4
down vote
The term you're looking for is CNAME, and the answer to your question is both yes and no.
First, here's an example of how a CNAME works in a zone file.
example.se IN SOA ns1.example.se. hostmaster.example.se. (
[....]
)
server1 A 10.1.2.3
www CNAME server1
Now you just need to update the server1
record in order to move both server1
and www
to the new IP address.
The CNAME doesn't have to point to an address within the same domain; it could also look like this:
example.se IN SOA ns1.example.se. hostmaster.example.se. (
[....]
)
www CNAME server1.example.org.
Now, when you update the A record for server1
in the zone example.org
, the record for www.example.se
will follow along without any further configuration.
The bad part, from your point of view, is that this does not work for the apex record - that means the "bare" domain. In other words, you can make www.example.com
into a CNAME, but you can't do that with example.com
. This is because when you use a CNAME record, you can't have any additional records for that entry - meaning that you can't have mail server records, or name server records... meaning that the domain will stop working.
The best-practice solution is to use some kind of configuration management software, such as puppet, chef or ansible, to generate the zone files from a template. If, for some reason, that is not possible for you, then I'd use a script to replace the IP addresses in all files.
You'll also want to reduce the TTL value for the domain in due time before the migration. (And don't forget to update the serial number of the zone file - I have, and it's very embarrassing...)
add a comment |Â
up vote
0
down vote
If I get this right the old server has a single IP address and the new one has only one, too.
So what you could do is to set up the new server and on it just route all relevant http/https/ftp/whatever traffic to the old IP and then update the DNS records to show the new IP.
If you only have one IP you can use a simple find/replace to change all IPs in the DNS (don't forget to update the serial number) at once and wait for your current TTL to run out. Once the TTL has run out you can just remove the routes on the new server and adjust your other settings, so that it serves the sites directly instead of redirecting.
Before removing the routes the websites should have been moved to the new location obviously. This has the advantage that you don't have to rely on other DNS servers to update their records in time you can just "wait it out". To shorten that period you can reduce the TTL but be aware that some DNS caches out there ignore the TTL settings, that's why I don't rely on TTLs any more.
Care to explain a bit more about the routes you mentioned? What type/form do they have?
– bikey77
17 mins ago
I had to explain it a bit broader since you didn't mention which type of server you're using to serve your sites. E.g. in iptables (Linux) you could use Prerouting and masquerading to redirect traffic to a new location, see here: debuntu.org/… The problem with a DNS only approach is that you can't rely on when the DNS caches of your site's visitors update. With the routing approach you determine the time of the switch, minimizing potential downtimes.
– Broco
12 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
The term you're looking for is CNAME, and the answer to your question is both yes and no.
First, here's an example of how a CNAME works in a zone file.
example.se IN SOA ns1.example.se. hostmaster.example.se. (
[....]
)
server1 A 10.1.2.3
www CNAME server1
Now you just need to update the server1
record in order to move both server1
and www
to the new IP address.
The CNAME doesn't have to point to an address within the same domain; it could also look like this:
example.se IN SOA ns1.example.se. hostmaster.example.se. (
[....]
)
www CNAME server1.example.org.
Now, when you update the A record for server1
in the zone example.org
, the record for www.example.se
will follow along without any further configuration.
The bad part, from your point of view, is that this does not work for the apex record - that means the "bare" domain. In other words, you can make www.example.com
into a CNAME, but you can't do that with example.com
. This is because when you use a CNAME record, you can't have any additional records for that entry - meaning that you can't have mail server records, or name server records... meaning that the domain will stop working.
The best-practice solution is to use some kind of configuration management software, such as puppet, chef or ansible, to generate the zone files from a template. If, for some reason, that is not possible for you, then I'd use a script to replace the IP addresses in all files.
You'll also want to reduce the TTL value for the domain in due time before the migration. (And don't forget to update the serial number of the zone file - I have, and it's very embarrassing...)
add a comment |Â
up vote
4
down vote
The term you're looking for is CNAME, and the answer to your question is both yes and no.
First, here's an example of how a CNAME works in a zone file.
example.se IN SOA ns1.example.se. hostmaster.example.se. (
[....]
)
server1 A 10.1.2.3
www CNAME server1
Now you just need to update the server1
record in order to move both server1
and www
to the new IP address.
The CNAME doesn't have to point to an address within the same domain; it could also look like this:
example.se IN SOA ns1.example.se. hostmaster.example.se. (
[....]
)
www CNAME server1.example.org.
Now, when you update the A record for server1
in the zone example.org
, the record for www.example.se
will follow along without any further configuration.
The bad part, from your point of view, is that this does not work for the apex record - that means the "bare" domain. In other words, you can make www.example.com
into a CNAME, but you can't do that with example.com
. This is because when you use a CNAME record, you can't have any additional records for that entry - meaning that you can't have mail server records, or name server records... meaning that the domain will stop working.
The best-practice solution is to use some kind of configuration management software, such as puppet, chef or ansible, to generate the zone files from a template. If, for some reason, that is not possible for you, then I'd use a script to replace the IP addresses in all files.
You'll also want to reduce the TTL value for the domain in due time before the migration. (And don't forget to update the serial number of the zone file - I have, and it's very embarrassing...)
add a comment |Â
up vote
4
down vote
up vote
4
down vote
The term you're looking for is CNAME, and the answer to your question is both yes and no.
First, here's an example of how a CNAME works in a zone file.
example.se IN SOA ns1.example.se. hostmaster.example.se. (
[....]
)
server1 A 10.1.2.3
www CNAME server1
Now you just need to update the server1
record in order to move both server1
and www
to the new IP address.
The CNAME doesn't have to point to an address within the same domain; it could also look like this:
example.se IN SOA ns1.example.se. hostmaster.example.se. (
[....]
)
www CNAME server1.example.org.
Now, when you update the A record for server1
in the zone example.org
, the record for www.example.se
will follow along without any further configuration.
The bad part, from your point of view, is that this does not work for the apex record - that means the "bare" domain. In other words, you can make www.example.com
into a CNAME, but you can't do that with example.com
. This is because when you use a CNAME record, you can't have any additional records for that entry - meaning that you can't have mail server records, or name server records... meaning that the domain will stop working.
The best-practice solution is to use some kind of configuration management software, such as puppet, chef or ansible, to generate the zone files from a template. If, for some reason, that is not possible for you, then I'd use a script to replace the IP addresses in all files.
You'll also want to reduce the TTL value for the domain in due time before the migration. (And don't forget to update the serial number of the zone file - I have, and it's very embarrassing...)
The term you're looking for is CNAME, and the answer to your question is both yes and no.
First, here's an example of how a CNAME works in a zone file.
example.se IN SOA ns1.example.se. hostmaster.example.se. (
[....]
)
server1 A 10.1.2.3
www CNAME server1
Now you just need to update the server1
record in order to move both server1
and www
to the new IP address.
The CNAME doesn't have to point to an address within the same domain; it could also look like this:
example.se IN SOA ns1.example.se. hostmaster.example.se. (
[....]
)
www CNAME server1.example.org.
Now, when you update the A record for server1
in the zone example.org
, the record for www.example.se
will follow along without any further configuration.
The bad part, from your point of view, is that this does not work for the apex record - that means the "bare" domain. In other words, you can make www.example.com
into a CNAME, but you can't do that with example.com
. This is because when you use a CNAME record, you can't have any additional records for that entry - meaning that you can't have mail server records, or name server records... meaning that the domain will stop working.
The best-practice solution is to use some kind of configuration management software, such as puppet, chef or ansible, to generate the zone files from a template. If, for some reason, that is not possible for you, then I'd use a script to replace the IP addresses in all files.
You'll also want to reduce the TTL value for the domain in due time before the migration. (And don't forget to update the serial number of the zone file - I have, and it's very embarrassing...)
answered 37 mins ago


Jenny D
22.9k115789
22.9k115789
add a comment |Â
add a comment |Â
up vote
0
down vote
If I get this right the old server has a single IP address and the new one has only one, too.
So what you could do is to set up the new server and on it just route all relevant http/https/ftp/whatever traffic to the old IP and then update the DNS records to show the new IP.
If you only have one IP you can use a simple find/replace to change all IPs in the DNS (don't forget to update the serial number) at once and wait for your current TTL to run out. Once the TTL has run out you can just remove the routes on the new server and adjust your other settings, so that it serves the sites directly instead of redirecting.
Before removing the routes the websites should have been moved to the new location obviously. This has the advantage that you don't have to rely on other DNS servers to update their records in time you can just "wait it out". To shorten that period you can reduce the TTL but be aware that some DNS caches out there ignore the TTL settings, that's why I don't rely on TTLs any more.
Care to explain a bit more about the routes you mentioned? What type/form do they have?
– bikey77
17 mins ago
I had to explain it a bit broader since you didn't mention which type of server you're using to serve your sites. E.g. in iptables (Linux) you could use Prerouting and masquerading to redirect traffic to a new location, see here: debuntu.org/… The problem with a DNS only approach is that you can't rely on when the DNS caches of your site's visitors update. With the routing approach you determine the time of the switch, minimizing potential downtimes.
– Broco
12 mins ago
add a comment |Â
up vote
0
down vote
If I get this right the old server has a single IP address and the new one has only one, too.
So what you could do is to set up the new server and on it just route all relevant http/https/ftp/whatever traffic to the old IP and then update the DNS records to show the new IP.
If you only have one IP you can use a simple find/replace to change all IPs in the DNS (don't forget to update the serial number) at once and wait for your current TTL to run out. Once the TTL has run out you can just remove the routes on the new server and adjust your other settings, so that it serves the sites directly instead of redirecting.
Before removing the routes the websites should have been moved to the new location obviously. This has the advantage that you don't have to rely on other DNS servers to update their records in time you can just "wait it out". To shorten that period you can reduce the TTL but be aware that some DNS caches out there ignore the TTL settings, that's why I don't rely on TTLs any more.
Care to explain a bit more about the routes you mentioned? What type/form do they have?
– bikey77
17 mins ago
I had to explain it a bit broader since you didn't mention which type of server you're using to serve your sites. E.g. in iptables (Linux) you could use Prerouting and masquerading to redirect traffic to a new location, see here: debuntu.org/… The problem with a DNS only approach is that you can't rely on when the DNS caches of your site's visitors update. With the routing approach you determine the time of the switch, minimizing potential downtimes.
– Broco
12 mins ago
add a comment |Â
up vote
0
down vote
up vote
0
down vote
If I get this right the old server has a single IP address and the new one has only one, too.
So what you could do is to set up the new server and on it just route all relevant http/https/ftp/whatever traffic to the old IP and then update the DNS records to show the new IP.
If you only have one IP you can use a simple find/replace to change all IPs in the DNS (don't forget to update the serial number) at once and wait for your current TTL to run out. Once the TTL has run out you can just remove the routes on the new server and adjust your other settings, so that it serves the sites directly instead of redirecting.
Before removing the routes the websites should have been moved to the new location obviously. This has the advantage that you don't have to rely on other DNS servers to update their records in time you can just "wait it out". To shorten that period you can reduce the TTL but be aware that some DNS caches out there ignore the TTL settings, that's why I don't rely on TTLs any more.
If I get this right the old server has a single IP address and the new one has only one, too.
So what you could do is to set up the new server and on it just route all relevant http/https/ftp/whatever traffic to the old IP and then update the DNS records to show the new IP.
If you only have one IP you can use a simple find/replace to change all IPs in the DNS (don't forget to update the serial number) at once and wait for your current TTL to run out. Once the TTL has run out you can just remove the routes on the new server and adjust your other settings, so that it serves the sites directly instead of redirecting.
Before removing the routes the websites should have been moved to the new location obviously. This has the advantage that you don't have to rely on other DNS servers to update their records in time you can just "wait it out". To shorten that period you can reduce the TTL but be aware that some DNS caches out there ignore the TTL settings, that's why I don't rely on TTLs any more.
edited 20 mins ago
answered 26 mins ago
Broco
1,075617
1,075617
Care to explain a bit more about the routes you mentioned? What type/form do they have?
– bikey77
17 mins ago
I had to explain it a bit broader since you didn't mention which type of server you're using to serve your sites. E.g. in iptables (Linux) you could use Prerouting and masquerading to redirect traffic to a new location, see here: debuntu.org/… The problem with a DNS only approach is that you can't rely on when the DNS caches of your site's visitors update. With the routing approach you determine the time of the switch, minimizing potential downtimes.
– Broco
12 mins ago
add a comment |Â
Care to explain a bit more about the routes you mentioned? What type/form do they have?
– bikey77
17 mins ago
I had to explain it a bit broader since you didn't mention which type of server you're using to serve your sites. E.g. in iptables (Linux) you could use Prerouting and masquerading to redirect traffic to a new location, see here: debuntu.org/… The problem with a DNS only approach is that you can't rely on when the DNS caches of your site's visitors update. With the routing approach you determine the time of the switch, minimizing potential downtimes.
– Broco
12 mins ago
Care to explain a bit more about the routes you mentioned? What type/form do they have?
– bikey77
17 mins ago
Care to explain a bit more about the routes you mentioned? What type/form do they have?
– bikey77
17 mins ago
I had to explain it a bit broader since you didn't mention which type of server you're using to serve your sites. E.g. in iptables (Linux) you could use Prerouting and masquerading to redirect traffic to a new location, see here: debuntu.org/… The problem with a DNS only approach is that you can't rely on when the DNS caches of your site's visitors update. With the routing approach you determine the time of the switch, minimizing potential downtimes.
– Broco
12 mins ago
I had to explain it a bit broader since you didn't mention which type of server you're using to serve your sites. E.g. in iptables (Linux) you could use Prerouting and masquerading to redirect traffic to a new location, see here: debuntu.org/… The problem with a DNS only approach is that you can't rely on when the DNS caches of your site's visitors update. With the routing approach you determine the time of the switch, minimizing potential downtimes.
– Broco
12 mins ago
add a comment |Â
bikey77 is a new contributor. Be nice, and check out our Code of Conduct.
bikey77 is a new contributor. Be nice, and check out our Code of Conduct.
bikey77 is a new contributor. Be nice, and check out our Code of Conduct.
bikey77 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f932945%2fmoving-many-sites-to-new-server-whats-the-quickest-way-to-update-their-dns-rec%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What DNS server / service are you using? When you do make the change you could consider using a CNAME rather than A record then if you move server again you only have a single A record to update
– Phil
36 mins ago
We're using WHM for managing our DNS. Good point about the CNAME, I'm going to use your suggestion.
– bikey77
20 mins ago