Keepalived with NetworkManager. Can they work together? #2474
Replies: 2 comments 3 replies
-
In principle there is no reason why you cannot run both keepalived and NetworkManager at the same time, however there are some issues that need to be managed. If the version of NetworkManager is less than 1.18 and you are using VMACs, then keepalived needs to be compiled with direct support for NetworkManager so that keepalived can set the VMAC interfaces it creates to be unmanaged by NetworkManager. This is not needed for NetworkManager >=1.18. It is not possible to have addresses managed by both NetworkManager and keepalived. If you want NetworkManager to manage the addresses when keepalived is not running, but keepalived manages them when it is running, then when keepalived starts up it would be necessary to stop NetworkManager managing those addresses. The best way to do this would be to configure keepalived to have a startup_script and a shutdown_script. In those scripts you can use nmcli commands to (in the startup script) remove the addresses from NetworkManager's control, and in the shutdown script add the addresses back into NetworkManager. |
Beta Was this translation helpful? Give feedback.
-
@steven-bloom When keepalived starts up, there is a short delay between before it can become master, since it has to ascertain that there is not a higher priority master already running (the delay is 3 advert intervals plus "a bit"). When an instance becomes master it adds its virtual_ipaddresses. If the startup script is causing NetworkManager to remove the IP address, then there will be the 3 advert intervals + a bit delay before keepalived adds the address back. Your startup script could execute another script in background and then exit, allowing keepalived to start its initial delay timer. The script run in backgroup could sleep for 3 advert intervals and then instruct NetworkManager to remove the address. |
Beta Was this translation helpful? Give feedback.
-
Hi there! 👋
I saw some issues in Github where keepalived issues indirectly related with NetworkManager work and i faced an issue in my own experience... But i'm not going to ask about it (for now 😄).
As i know, NetworkManager (NM) is used for static network configuration in OS Linux (it's settings are applied on OS start or if NM daemon is restarted), as keepalved is used for "dynamic" configuration such as VIP, which is floating between several machines.
So i want to ask... Is that necessary to stop and disable NM if i want to run keepalived or they both can be run at the same time and in base cases it would be normal and won't cause any problems?
I'm talking about case where keepalived uses IPs which is already configured in OS (usually with NM help) as VIPs.
Beta Was this translation helpful? Give feedback.
All reactions