Score:0

DNS Record to "redirect" from old server to new server

fr flag

I have a question regarding DNS:

I have the following setup:

srv-old.example.com | Host(A) | 192.168.1.2 | timestamp
srv-new.example.com | Host(A) | 192.168.1.3 | static 

can I just add another static A-Record like the following to achive, that all requests to srv-old.example.com will redirected to srv-new.example.com:

srv-old.example.com | Host(A) | 192.168.1.3 | static

so in summary i will have

srv-old.example.com | Host(A) | 192.168.1.2 | timestamp
srv-new.example.com | Host(A) | 192.168.1.3 | static 
srv-old.example.com | Host(A) | 192.168.1.3 | static

Or will this lead to a 50/50 chance to land on the new server when calling srv-old.example.com? I already tried to edit the already existing non-static A-Record of srv-old.example.com, but it got updated after 1 day (i think by DHCP-Server).

The difficulty is, that srv-old needs to exist some more weeks, so i just cant take it offline and deleting the non-static A-Record will bring nothing in my opinion, because it will be recreated after one day.

I thought about a CNAME-Record like this too:

srv-old.example.com | CNAME | srv-new.example.com

But i think this will cause the same Problem to have a 50/50 Chance to land on the old or new server

Does anyone of you have a hint for me? (A simple redirect 301 on the old webserver is no option at the moment)

Vadim avatar
ar flag
Change IP settings on srv-old from DHCP to static and disable DNS record updating. Then remove the old record again.
StartedFromTheBottom avatar
fr flag
Thanks. The IP of server-old was already static. I disabled the DNS record updating in the network adapter tab of the server an then deleted dynamic A-Record of srv-old and next created a new static record for srv-old to point to the IP of srv-new. However, on the next day, the static(!) entry i created was overwritten with the IP of srv-old... My solution: to rename the srv-old to e.g. srv-old-old and set the static A-Record back how i need it (pointing to the IP of srv-new). In case the srv-old reregister itself in DNS, it does it with an other name and will not overwrite the A-Record.
Score:0
jp flag

It is not possible to do HTTP redirects with DNS only. You can point srv-old.example.com to another server (possibly light temporary VM) which would send 301 to the new server.

StartedFromTheBottom avatar
fr flag
Thanks. Yes, i already know that. I already set up an additional virtual host (apache) on the srv-new, to redirect request coming via srv-old.example.com. But i first need to "redirect" the name resolution so the call of srv-old.example.com will point to the IP of srv-new.example.com (via DNS). But my problem atm is, that in DNS a dynamic A-Record for srv-old.example.com already exists (with the old IP), which will be upadted every 24h. I need to stop srv-old to register himself to the DNS to set a static A-Record pointing to the IP of srv-new, without round robin effect.
Score:0
cf flag

I would switch to Round Robin DNS until it was time to deprecate old server and then remove old servers A record.

srv.example.com | Host(A) | 192.168.1. | static

srv.example.com | Host(A) | 192.168.1.3 | static

StartedFromTheBottom avatar
fr flag
Thank you for your answer, but i think this is not possible in my example. With round robin, half of the requests will land on the old server, with old Web GUI and old Informations. I need to make sure that 100% of the requests land on the new server
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.