Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Feb 2012 15:36:08 +0100
From:      peter knezel <peter.knezel@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   From analysis of a simple ifstated.conf to more compex example
Message-ID:  <CAAwfu_n+VjgeihzWRa1F6v6PhCA943sFHR7eFxA1Ycc8NbjXpQ@mail.gmail.com>

Next in thread | Raw E-Mail | Index | Archive | Help
Hello all,

I would like to ask somebody to explain me how the ifstated works according to
the following configuration file.
I have three virtual carp interfaces carp0,carp1 and carp2.

I try to understand the following setting:
The server is in state one (all carp interfaces are up) and if there
is carp down of any:
one (carp0 or carp1 or carp2),
two ([carp0 and carp1] or [carp0 and carp2] or [carp1 and carp2]),
three interfaces (carp 0 and carp1 and carp2), server
runs the script testdown.sh and put the server into state two.
If all carp interfaces are up, the server runs the testup.sh and set
the state to one.

Is it the way the system works?
Or am I wrong?

===
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 "/usr/local/testdown.sh"
               set-state two
       }
}

state two {
       if ( $net ) {
               run "/usr/local/testup.sh"
               set-state one
       }
}
===

Is there any possibility to define and set ifstated.conf that reacts when:

 any one of the carp interfaces is down - followed by another any
other carp interface down


I tried to define states:

duu ="!carp0.link.up && carp1.link.up && carp2.link.up"
udu ="carp0.link.up && !carp1.link.up && carp2.link.up"
uud ="carp0.link.up && carp1.link.up && !carp2.link.up"
ddu ="!carp0.link.up && !carp1.link.up"
dud ="!carp0.link.up && !carp2.link.up"
udd ="!carp1.link.up && !carp2.link.up"

and used them but somehow I cannot incorporate all state changes and
include it in ifstated.conf.


Thanks and regards,

Peter Knezel



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?CAAwfu_n+VjgeihzWRa1F6v6PhCA943sFHR7eFxA1Ycc8NbjXpQ>