Hetzner failover ip with automatic switching

RMM

Active Member
Oct 25, 2013
30
1
28
Hi all

I was just wondering if anybody uses Hetzner with a failover ip.
We would like to use it, and automatically switch the ip over from one machine to an other when a certain machine migrates.
The only solution I've found so far is:
https://blog.kumina.nl/2011/02/hetzner-failover-ip-ocf-script/
which is an ocf script which seems not to be maintained anymore since almost 7 years ;-).
Somebody got a newer solution and maintained solution?
 
Hmmm I've just realized that proxmox doesn't use rgmanager anymore, so ocf scripts won't be a solution in any way...
There also seem to be no hooks or anything to call scripts on migration.
Did anybody solve that nicely, with some kind of cronjob or similar?
 
I was not aware of this. Hetzner told me that it would not be possible with PVE.
it works. Manually I can switch failover IPs and VMs easily in 2 minutes... But obviously the plan is to automatize that.
Once we finished the whole setup I can publish our internal wiki for the whole setup. So other people don't need to start at zero...

Keepalivedd, check it out. :)
I am. It looks promising :).
Any chance you could provide an example config? Just quick and dirty? would save me quite some time :).
 
My solution on this in short words, is as follows (intervalls are choosen to fit my needs, can of course be shortened):

The smallest VM Hetzner provides does 2 things:
1) Check every 15 minutes, to which server the failover-ip´s are currently routed, and write this in a static file provided by lighttpd & restricted via iptables to the proxmox nodes
2) Check every 5 minutes, if this server (noted in the static file) is still reachable via its public ip (one could also use tinc or something else and use an internal ip)

If this server is reachable, nothing happens, otherwise the next server is tried and if reachable, the new routing target.

As I´m using failover subnets, want to use all ip´s and assign public ip´s directly to my vm´s where needed, the proxmox hosts too got something to do:
Pull every 5 minutes the static file provided by lighttpd and compare the ip with the local public ip.
- If it´s the same, use arping to broadcast the local mac internally (ovs-intport-vlan on ovs-bridge with 2nd nic) for the gateway provided in the robot for the subnet
- If it´s not the same, do nothing

Of course for this to work, a static route for the subnet is set to the ovs-intport - some other checks and such are built-in too, but i think this is enough to get an idea of.
Maybe it´s no perfect/beautiful solution, but fits my needs and works since over a year now without problems.
 
Thanks a lot for all your replies.
I finally made it a bit differently. I'm using single failover IPs, not whole subnets.
But basically on each node runs a iontifywait process which checks /etc/pve/qemu-hosts and changes the routing of the failover ip, and also adds the local route needed for the ip. So far it seems to work perfectly. It would work with any amount of failover ips.
Like that you should also be able to implement other scripts, which react on host migration (migrating away or to a server).
see:
https://github.com/yennor/proxmox-hetzner-failover-ip
 
  • Like
Reactions: DerDanilo
Another solution is ucarp. By default any node with ucarp check the VIP node. You can have scripts for up/down events.
 
Hi

I had the same need as RMM, but using online.net instead of hetzner.

I have taken scripts in yennor's repository and converted into more generic solution, it allows running different scripts in down.d and up.d directories. I have written failover ip up and down scripts, and scripts to update failover ip with online.net and hetzner API.

I have added to github.com/scambra/pve-migration-monitor

Comments or improvements are welcome
 
  • Like
Reactions: DerDanilo

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!