Hi,
I have dig into the documentation and found the vrrp transition scripts.
I have 3 vyos router. All doing bgp and export networks. They also to vrrp for one common network. The master there is default gateway.
I now want to export this network only on the vyos how is vrrp master via bgp so I do not get asynchrone routing.
I tought the solution would be a transition script which add the network to the bgp export list or remove it. So I create the following:
/config/scripts/vrrp_master.sh
#!/bin/vbash
if [ "$(id -g -n)" != 'vyattacfg' ] ; then
exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
fi
source /opt/vyatta/etc/functions/script-template
configure
delete policy prefix-list 'No-Export-Networks' rule 10
commit
exit
/config/scripts/vrrp_backup.sh
#!/bin/vbash
if [ "$(id -g -n)" != 'vyattacfg' ] ; then
exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
fi
source /opt/vyatta/etc/functions/script-template
configure
set policy prefix-list 'No-Export-Networks' rule 10 action permit
set policy prefix-list 'No-Export-Networks' rule 10 prefix '192.168.43.0/24'
commit
exit
adding the scripts to the vrrp group
edit high-availability vrrp group publicVSwitch
set transition-script backup /config/scripts/vrrp_backup.sh
set transition-script fault /config/scripts/vrrp_backup.sh
set transition-script stop /config/scripts/vrrp_backup.sh
set transition-script master /config/scripts/vrrp_master.sh
to try the scripts without ending in a locked config use this commands:
sg vyattacfg -c /config/scripts/vrrp_master.sh
sg vyattacfg -c /config/scripts/vrrp_backup.sh
Version info I did it with
vyos@hetrvpn01:~$ show version
Version: VyOS 1.4.0
Release train: sagitta
Release flavor: generic
Built by: Sentrium S.L.
Built on: Tue 04 Jun 2024 09:23 UTC
Build UUID: 5e6ae0c4-4d17-4b69-9247-b4ba44a3e3c2
Build commit ID: 35dd8ae6522c78-dirty
Architecture: x86_64
Boot via: installed image
System type: KVM guest
Hardware vendor: QEMU
Hardware model: Standard PC (i440FX + PIIX, 1996)