blade-router: add keepalived notify script for announcing/withdrawing routes
This commit is contained in:
parent
1071202e7f
commit
f05a063fce
1 changed files with 29 additions and 3 deletions
|
@ -2,9 +2,26 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
{ lib, config, ... }:
|
{ lib, config, pkgs, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
{
|
let
|
||||||
|
notifyBird = pkgs.writeScript "blade-router-vrrp-bird.sh" ''
|
||||||
|
ENDSTATE=$3
|
||||||
|
NAME=$2
|
||||||
|
TYPE=$1
|
||||||
|
|
||||||
|
case $ENDSTATE in
|
||||||
|
"MASTER") birdc enable export4
|
||||||
|
birdc enable export6
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*) birdc disable export4
|
||||||
|
birdc disable export6
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
'';
|
||||||
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
../lib/bgp.nix
|
../lib/bgp.nix
|
||||||
];
|
];
|
||||||
|
@ -112,7 +129,7 @@ with lib;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
enable = true;
|
enable = true;
|
||||||
vrrpInstances.mgmtGateway = mgmtBase // {
|
vrrpInstances.mgmtGateway4 = mgmtBase // {
|
||||||
virtualIps = [
|
virtualIps = [
|
||||||
{ addr = "10.100.0.1/23"; }
|
{ addr = "10.100.0.1/23"; }
|
||||||
{ addr = "${config.my.blade-router.addresses.br-public-vip.v4.addr}/${toString config.my.blade-router.addresses.br-public-vip.v4.prefixLength}"; dev = "br-public"; }
|
{ addr = "${config.my.blade-router.addresses.br-public-vip.v4.addr}/${toString config.my.blade-router.addresses.br-public-vip.v4.prefixLength}"; dev = "br-public"; }
|
||||||
|
@ -126,6 +143,15 @@ with lib;
|
||||||
];
|
];
|
||||||
virtualRouterId = 2;
|
virtualRouterId = 2;
|
||||||
};
|
};
|
||||||
|
extraConfig = ''
|
||||||
|
vrrp_sync_group mgmtGateway {
|
||||||
|
group {
|
||||||
|
mgmtGateway4
|
||||||
|
mgmtGateway6
|
||||||
|
}
|
||||||
|
notify ${notifyBird}
|
||||||
|
}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
services.radvd = {
|
services.radvd = {
|
||||||
|
|
Loading…
Reference in a new issue