1 .\" $OpenBSD: pfsync.4,v 1.28 2009/02/17 10:05:18 dlg Exp $
3 .\" Copyright (c) 2002 Michael Shalayeff
4 .\" Copyright (c) 2003-2004 Ryan McBride
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF MIND,
22 .\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 .Nd packet filter state table sychronisation interface
40 interface is a pseudo-device which exposes certain changes to the state
43 State changes can be viewed by invoking
48 If configured with a physical synchronisation interface,
50 will also send state changes out on that interface,
51 and insert state changes received on that interface from other systems
54 By default, all local changes to the state table are exposed via
56 State changes from packets received by
58 over the network are not rebroadcast.
59 Updates to states created by a rule marked with the
61 keyword are ignored by the
69 interface will attempt to collapse multiple state updates into a single
70 packet where possible.
71 The maximum number of times a single state can be updated before a
73 packet will be sent out is controlled by the
78 and the example below for more details).
81 packet will be delayed by a maximum of one second.
82 .Sh NETWORK SYNCHRONISATION
83 States can be synchronised between two or more firewalls using this
84 interface, by specifying a synchronisation interface using
86 For example, the following command sets fxp0 as the synchronisation
88 .Bd -literal -offset indent
89 # ifconfig pfsync0 syncdev fxp0
92 By default, state change messages are sent out on the synchronisation
93 interface using IP multicast packets to the 244.0.0.240 group address.
94 An alternative destination address for
96 packets can be specified using the
99 This can be used in combination with
101 to protect the synchronisation traffic.
102 In such a configuration, the syncdev should be set to the
104 interface, as this is where the traffic arrives when it is decapsulated,
106 .Bd -literal -offset indent
107 # ifconfig pfsync0 syncpeer 10.0.0.2 syncdev enc0
110 It is important that the pfsync traffic be well secured
111 as there is no authentication on the protocol and it would
112 be trivial to spoof packets which create states, bypassing the pf ruleset.
113 Either run the pfsync protocol on a trusted network \- ideally a network
114 dedicated to pfsync messages such as a crossover cable between two firewalls,
115 or specify a peer address and protect the traffic with
121 can be used together to provide automatic failover of a pair of firewalls
122 configured in parallel.
123 One firewall will handle all traffic until it dies, is shut down, or is
124 manually demoted, at which point the second firewall will take over
127 Both firewalls in this example have three
130 sis0 is the external interface, on the 10.0.0.0/24 subnet; sis1 is the
131 internal interface, on the 192.168.0.0/24 subnet; and sis2 is the
133 interface, using the 192.168.254.0/24 subnet.
134 A crossover cable connects the two firewalls via their sis2 interfaces.
135 On all three interfaces, firewall A uses the .254 address, while firewall B
137 The interfaces are configured as follows (firewall A unless otherwise
140 Interfaces configuration in
142 .Bd -literal -offset indent
143 network_interfaces="lo0 sis0 sis1 sis2"
144 cloned_interfaces="carp0 carp1"
145 ifconfig_sis0="10.0.0.254/24"
146 ifconfig_sis1="192.168.0.254/24"
147 ifconfig_sis2="192.168.254.254/24"
148 ifconfig_carp0="vhid 1 pass foo 10.0.0.1/24"
149 ifconfig_carp1="vhid 2 pass bar 192.168.0.1/24"
151 pfsync_syncdev="sis2"
155 must also be configured to allow
160 The following should be added to the top of
162 .Bd -literal -offset indent
163 pass quick on { sis2 } proto pfsync keep state (no-sync)
164 pass on { sis0 sis1 } proto carp keep state (no-sync)
167 It is preferable that one firewall handle the forwarding of all the traffic,
170 on the backup firewall's
172 interfaces should be set to something higher than
174 For example, if firewall B is the backup, its
175 carp1 configuration would look like this:
176 would look like this:
177 .Bd -literal -offset indent
178 ifconfig_carp1="vhid 2 pass bar advskew 100 192.168.0.1/24"
181 The following must also be added to
182 .Pa /etc/sysctl.conf :
183 .Bd -literal -offset indent
184 net.inet.carp.preempt=1
204 device first appeared in
209 protocol and kernel implementation were significantly modified between
213 The two protocols are incompatible and will not interoperate.