OPNsense Forum

English Forums => General Discussion => Topic started by: nertwork on September 11, 2019, 11:54:12 am

Title: CARP Trigger Script
Post by: nertwork on September 11, 2019, 11:54:12 am
Hello,

I'm trying to run something on this where if carp is no longer master but in backup I can run a script. I'm not sure if this is possible but if it is I would like to know where to put that and how to do it.

Thanks!
Title: Re: CARP Trigger Script
Post by: mimugmail on September 11, 2019, 01:03:38 pm
https://github.com/opnsense/core/tree/master/src/etc/rc.syshook.d/carp

We also had some addions to frr plugin and Ad did some nice additions to capture syslog-ng events and trigger actions.
Title: Re: CARP Trigger Script
Post by: nertwork on September 11, 2019, 09:26:35 pm
Sorry, I'm kinda new to this. I have an ISO install that doesn't seem to have anything in /etc/rc.syshook.d/carp/

root@router2:/etc # uname -r
11.2-RELEASE-p14-HBSD
Title: Re: CARP Trigger Script
Post by: mimugmail on September 11, 2019, 09:55:18 pm
Prefix is always /usr/local
:)
Title: Re: CARP Trigger Script
Post by: nertwork on September 12, 2019, 12:46:18 am
Oh cool! I see it now - so I tried putting a shell script in there with just grabbing some ARGV stuff and it doesn't seem like it calls it. So all I want to do is shut an interface off when it's backup and when it's master bring the interface back online again.

Not sure if that's something to easily do in php here, or if there's an existing script template to use.

Thanks for any additional help here - you've been great on the forums!  ;D ;D :D
Title: Re: CARP Trigger Script
Post by: mimugmail on September 12, 2019, 05:45:14 am
You want it for pppoe? :)
Title: Re: CARP Trigger Script
Post by: nertwork on September 12, 2019, 08:05:42 am
Not ppoe - I have residential cable internet with DHCP for the home lab. I have a 2960g and when I set up HA it shows the MAC address bouncing between the two nodes. I also see slower internet speeds and some missed pings when HA is enabled.

Not sure if I'm doing it right but I have CARP set on just the LAN with a .2 and .3 physical with a .1 virtual address on the lan. I don't have anything set up for the WAN. OVPN works fine when bound to the virtual address.
Title: Re: CARP Trigger Script
Post by: mimugmail on September 12, 2019, 08:08:35 am
How do you handle WAN failover with DHCP? Usually you need the Modem do the dialup and OPN with private subnet as WAN
Title: Re: CARP Trigger Script
Post by: nertwork on September 12, 2019, 09:02:16 am
So I'm hoping to have carp trigger an interface down on the wan interface when it's backup. When it's master I would like it to trigger an interface up on the wan interface. I don't want to double-nat here, I want to be able to have opnsense have a public dynamic ip address.