Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Feb 2012 12:42:50 +0100
From:      peter knezel <peter.knezel@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   carp+devd+ifstated on master problem
Message-ID:  <CAAwfu_mgMEYnBMuQd0=O2DE0WM8v1QaVYzW6XqAbR2cBtQb%2BqA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hello all,

I have configured devd and ifstated on a master FreeBSD server (slave
not changed so far) on which carp was configured with three
carp0,carp1 and carp2 virtual addresses.

When I as root do ifconfig carp0 down and up, the corresponding
testdown.sh and testup.sh
scripts are run (defined in ifstated.conf).
The status of carp0 interface changes to INIT then to MASTER (after
ifconfig carp0 up).

However this is not valid when doing the same with carp1 or carp2.
It goes to INIT+testdown.sh executed but then immediately afterwards
it goes to MASTER+testup.sh executed.

What can be the problem?

cd /usr/local/etc
cat ifstated.conf
init-state one

net = '( "ifconfig -a -u |grep carp0 > /dev/null" every 3 && "ifconfig -a -u
|grep carp1 > /dev/null" every 3 && "ifconfig -a -u |grep carp2 > /dev/null"
every 3)'

state one {
       if ( ! $net ) {
               run "/sbin/ifconfig_carp0 vhid 1 pass newpass 192.xx.xx.1/24"
               run "/sbin/ifconfig carp1 vhid 2 pass newpass 192.xx.xx.2/24"
               run "/sbin/ifconfig carp2 vhid 3 pass newpass 192.xx.xx.3/24"
               run "/usr/local/testdown.sh"
               set-state two
       }
}

state two {
       if ( $net ) {
               run "/sbin/ifconfig carp0 vhid 1 advskew 100 pass
tnewpass 192.xx.xx.1/24"
               run "/sbin/ifconfig carp1 vhid 2 advskew 100 pass
newpass 192.xx.xx.2/24"
               run "/sbin/ifconfig carp2 vhid 3 advskew 100 pass
newpass 192.xx.xx.3/24"
               run "/usr/local/testup.sh"
               set-state one
       }
}

In addition I had to configure devd.conf to have ifdown.sh and ifup.sh
scripts executed when reboot is done on the master.

notify 30 {
match "system" "IFNET";
match "subsystem" "carp0";
match "type" "LINK_UP";
action "/usr/local/etc/rc.d/ifdown.sh";
};

notify 30 {
match "system" "IFNET";
match "subsystem" "carp0";
match "type" "LINK_DOWN";
action "/usr/local/etc/rc.d/ifup.sh";

Thanks for any suggestion in advance.

Ardi



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAAwfu_mgMEYnBMuQd0=O2DE0WM8v1QaVYzW6XqAbR2cBtQb%2BqA>