Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
High availability
»
CARP - change gateway status on switch from master/backup
« previous
next »
Print
Pages: [
1
]
Author
Topic: CARP - change gateway status on switch from master/backup (Read 567 times)
Bubba88
Newbie
Posts: 3
Karma: 0
CARP - change gateway status on switch from master/backup
«
on:
May 22, 2024, 08:25:09 pm »
I'm setting up a 2 node cluster. What I need to happen is when a given nodes CARP status is BACKUP, then I need to disable a gateway (System - Gateways - Configuration) when viewed in the GUI. I've been researching this for a few hours and it appears I may need to put a script in /usr/local/etc/rc.syshook.d/carp/ such that when the node enters BACKUP state, it disables a specific gateway and when it enters MASTER state the gateway is enabled again. I know the concept works, as if I do the work in the GUI then things work as I expect.
In my research I found
https://gist.github.com/spali/2da4f23e488219504b2ada12ac59a7dc
but that deals with enabling/disabling the WAN interface, which does not accomplish what I'm after. From a FreeBSD level, I need the default gateway to be changed (from WAN to LAN) thus enabling the backup node to be a client on the LAN and thus able to update, etc.. When the CARP state goes back to MASTER, then the default route needs to be changed again.
Currently I don't have enough knowledge about the internals of opnsense to figure out what the PHP code would have to look like to do what I'm after. I'm hoping someone who knows more about opnsense can point me in the right direction.
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
High availability
»
CARP - change gateway status on switch from master/backup