ifstated 20041117 ifstated: Settings ifstated Modify ifstated settings.
Services
ifstated.xml /pkg_edit.php?xml=ifstated.xml&id=0
pkg_edit.php?xml=ifstated.xml&id=0 installedpackages->package->$packagename->configuration->settings /etc/sysctl.conf net.inet.carp.preempt=1 External Test IP exttestip Enter an IP to test external connectivity with. This should be a host with extremely high availability. input Internal Test IP inttestip Enter an IP to test internal connectivity with. This should be a host with extremely high availability. input Paired Firewall External IP pairextip Enter the real IP of the other firewall's (real) external interface. input Paired Firewall Internal IP pairintip Enter the real IP of the other firewall's (real) internal interface. input Initial State initstate Enter the desired initial state for this firewall. select global $config; $fout = fopen("/usr/local/etc/rc.d/ifstated.sh","w"); fwrite($fout,"#!/bin/sh\n\n/usr/local/sbin/ifstated\n"); fwrite($fout, "# PACKAGE: IFStated\n"); fwrite($fout, "# EXECUTABLE: ifstated\n"); fclose($fout); chmod("/usr/local/etc/rc.d/ifstated.sh", 0755); conf_mount_rw(); config_lock(); global $config; if ($_POST == "") $_POST = $config['installedpackages']['ifstated']['config']; $fout = fopen("/usr/local/etc/ifstated.conf","w"); if($config['installedpackages']['ifstated']['config'] != "") { fwrite($fout, "# This file was automatically generated by the pfSense\n# package management system.\n\n"); fwrite($fout, "init-state " . $_POST['initstate'] . "\n\n"); fwrite($fout, "carp_up = \"((carp0 link up) and (carp1 link up))\"\ncarp_down = \"((! carp0 link up) and (! carp1 link up))\"\ncarp_sync= \"((carp0 link up and carp1 link up) or ((!carp0 link up) and (!carp1 link up)))\"\n\n"); fwrite($fout, "net = '( \"ping -q -c 1 -t 1 " . $_POST['exttestip'] . " > /dev/null\" every 10 and \"ping -q -c 1 -t 1 " . $_POST['inttestip'] . " > /dev/null\" every 10)'\n\n"); fwrite($fout, "peer = '( \"ping -q -c 1 -t 1 " . $_POST['pairextip'] . " > /dev/null\" every 10 and \"ping -q -c 1 -t 1 " . $_POST['pairintip'] . " > /dev/null\" every 10)'\n\n"); fwrite($fout, "state auto {\nif \$carp_up {\nset-state primary\n}\nif \$carp_down {\nset-state backup\n}\n}\n\n"); fwrite($fout, "state primary {\ninit {\nrun \"ifconfig carp0 advskew 10\"\nrun \"ifconfig carp1 advskew 10\"\n}\nif ! \$net {\nset-state demoted\n}\n}\n\nstate demoted {\ninit {\nrun \"ifconfig carp0 advskew 254\"\nrun \"ifconfig carp1 advskew 254\"\n}\nif \$net {\nset-state primary\n}\n}\n\n"); fwrite($fout, "state promoted {\ninit {\nrun \"ifconfig carp0 advskew 0\"\nrun \"ifconfig carp1 advskew 0\"\n}\nif \$peer or ! \$net {\nset-state backup\n}\n}\n\n"); fwrite($fout, "state backup {\ninit {\nrun \"ifconfig carp0 advskew 100\"\nrun \"ifconfig carp1 advskew 100\"\n}\nif ! \$carp_sync and \$net and \"sleep 5\" every 10 {\nif (! \$carp_sync) and \$net {\nset-state promoted\n}\n}\n}\n"); } fclose($fout); conf_mount_ro(); config_unlock(); mwexec("/usr/bin/killall -HUP ifstated");