Redirecting DNS when server is offline

I have an Apache server running on a Raspberry Pi 4.
I’d like to redirect the DNS to my 1&1 hosting when my Raspberry doesn’t respond or when it’s turned off.
Is that posssible? it would be a good option in case the server fails.

You can use Cloudflare’s load balancing or write a script somewhere to update the DNS entry when the original origin is not available.

https://www.cloudflare.com/learning/performance/what-is-server-failover

I understand that it’s not free, right?

Definitely. Else, you might need to write your own script to check the availability of your Raspberry Pi periodically, then update the DNS record once the health check shows your Raspberry Pi is down.

2 Likes

I found this similar post with info/suggestions

Hey, just wanted to chime in here with the solution I came up with. It’s not free but it’s less expensive than a paid plan. We have a docker swarm cluster, and I wanted the traffic to be re-routed if one of the managers went down.

First I set up 3 subdomains swarm00, swarm01, swarm02 on CF. Then I delegated the subdomain r53 to Route53 on aws.

I then created a subdomain “swarm” that points to swarm.r53 (on Route53). Swarm.r53 then sends requests BACK to CF load balancing between swarm00, swarm01, swarm02. I also set up healthchecks on AWS to remove one should a host go down. Not the most elegant solution but it was inexpensive and works.

1 Like