OpenBSD | ifstated | carp


init-state offline

carp_master = “carp1.link.up && carp2.link.up”
carp_slave = “carp1.link.down && carp2.link.down”
carp_down = “carp1.link.unknown && carp2.link.unknown”

You have any problems at system startup even you have been used the example conf?

Your state jitters and doesn’t switch to master?

Use this example. Hint: The daemon loops inside a formerly reached state (function) until the ‘if’-clauses catches a new state.

state offline {
init {
run “test -d /var/ifstated/status || mkdir -p /var/ifstated”
run “test -r /var/ifstated/MASTER && rm -f /var/ifstated/MASTER”
run “test -r /var/ifstated/SLAVE && rm -f /var/ifstated/SLAVE”
run “date \”+%Y-%m-%d %H:%M:%S\” > /var/ifstated/OFFLINE”
}
if $carp_master {
set-state master
}
if $carp_slave {
set-state slave
}
}

state master {
init {
run “test -r /var/ifstated/SLAVE && rm -f /var/ifstated/SLAVE”
run “test -r /var/ifstated/OFFLINE && rm -f /var/ifstated/OFFLINE”
run “date \”+%Y-%m-%d %H:%M:%S\” > /var/ifstated/MASTER”
}
if $carp_slave {
set-state slave
}
if $carp_down {
set-state offline
}
}

state slave {
init {
run “test -r /var/ifstated/MASTER && rm -f /var/ifstated/MASTER”
run “test -r /var/ifstated/OFFLINE && rm -f /var/ifstated/OFFLINE”
run “date \”+%Y-%m-%d %H:%M:%S\” > /var/ifstated/SLAVE”
}
if $carp_master {
set-state master
}
if $carp_down {
set-state offline
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s