EXAMPLES
pfsync and carp(4) can be used together to provide automatic failover of a pair of firewalls configured in parallel. One firewall handles all traffic - if it dies or is shut down, the second firewall takes over automatically. Both firewalls in this example have three sis(4) interfaces. sis0 is the external interface, on the 10.0.0.0/24 subnet; sis1 is the internal interface, on the 192.168.0.0/24 subnet; and sis2 is the pfsync interface, using the 192.168.254.0/24 subnet. A crossover cable connects the two firewalls via their sis2 interfaces. On all three interfaces, firewall A uses the .254 address, while firewall B uses .253. The interfaces are configured as follows (firewall A unless otherwise indicated):
Interfaces configuration in /etc/rc.conf:
network_interfaces="lo0 sis0 sis1 sis2"
cloned_interfaces="carp0 carp1"
ifconfig_sis0="10.0.0.254/24"
ifconfig_sis1="192.168.0.254/24"
ifconfig_sis2="192.168.254.254/24"
ifconfig_carp0="vhid 1 pass foo 10.0.0.1/24"
ifconfig_carp1="vhid 2 pass bar 192.168.0.1/24"
pfsync_enable="YES"
pfsync_syncdev="sis2"
pf(4) must also be configured to allow pfsync and carp(4) traffic through. The following should be added to the top of /etc/pf.conf:
pass quick on { sis2 } proto pfsync
pass on { sis0 sis1 } proto carp keep state
If it is preferable that one firewall handle the traffic, the advskew on the backup firewalls carp(4) interfaces should be set to something higher than the primarys. For example, if firewall B is the backup, its carp1 configuration would look like this:
ifconfig_carp1="vhid 2 pass bar advskew 100 192.168.0.1/24"
The following must also be added to /etc/sysctl.conf:
net.inet.carp.preempt=1
BUGS
Possibility to view state changes using tcpdump(1) has not been ported from
.Ox yet.
SEE ALSO
bpf(4), carp(4), ifconfig(8), inet(4), inet6(4), ipsec(4), netintro(4), pf(4), pf.conf(5), protocols(5), rc.conf(5)
HISTORY