1 .\" $OpenBSD: pfsync.4,v 1.24 2006/10/23 07:05:49 jmc 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 logging interface
40 interface is a pseudo-device which exposes certain changes to the state
44 .\" State changes can be viewed by invoking
49 If configured with a physical synchronisation interface,
51 will send state changes out on that interface using IP multicast,
52 and insert state changes received on that interface from other systems
55 By default, all local changes to the state table are exposed via
57 However, state changes from packets received by
59 over the network are not rebroadcast.
60 States created by a rule marked with the
62 keyword are omitted from the
70 interface will attempt to collapse multiple updates of the same
71 state into one message where possible.
72 The maximum number of times this can be done before the update is sent out
78 and the example below for more details).
80 Each packet retrieved on this interface has a header associated
83 The header indicates the version of the protocol, address family,
84 action taken on the following states, and the number of state
85 table entries attached in this packet.
86 This structure is defined in
87 .Aq Pa net/if_pfsync.h
89 .Bd -literal -offset indent
90 struct pfsync_header {
97 .Sh NETWORK SYNCHRONISATION
98 States can be synchronised between two or more firewalls using this
99 interface, by specifying a synchronisation interface using
101 For example, the following command sets fxp0 as the synchronisation
103 .Bd -literal -offset indent
104 # ifconfig pfsync0 syncdev fxp0
107 It is important that the underlying synchronisation interface is up
108 and has an IP address assigned.
110 By default, state change messages are sent out on the synchronisation
111 interface using IP multicast packets.
112 The protocol is IP protocol 240, PFSYNC, and the multicast group
114 When a peer address is specified using the
116 keyword, the peer address is used as a destination for the pfsync traffic,
117 and the traffic can then be protected using
119 In such a configuration, the syncdev should be set to the
121 interface, as this is where the traffic arrives when it is decapsulated,
123 .Bd -literal -offset indent
124 # ifconfig pfsync0 syncpeer 10.0.0.2 syncdev enc0
127 It is important that the pfsync traffic be well secured
128 as there is no authentication on the protocol and it would
129 be trivial to spoof packets which create states, bypassing the pf ruleset.
130 Either run the pfsync protocol on a trusted network \- ideally a network
131 dedicated to pfsync messages such as a crossover cable between two firewalls,
132 or specify a peer address and protect the traffic with
137 to start its operation automatically at the system boot time,
141 variables should be used in
143 It is not advisable to set up
145 with common network interface configuration variables of
151 which cannot be always ensured in the latter case.
154 .\" There is a one-to-one correspondence between packets seen by
158 .\" interface, and packets sent out on the synchronisation interface, i.e.\&
159 .\" a packet with 4 state deletion messages on
161 .\" means that the same 4 deletions were sent out on the synchronisation
163 .\" However, the actual packet contents may differ as the messages
164 .\" sent over the network are "compressed" where possible, containing
165 .\" only the necessary information.
170 can be used together to provide automatic failover of a pair of firewalls
171 configured in parallel.
172 One firewall handles all traffic \- if it dies or
173 is shut down, the second firewall takes over automatically.
175 Both firewalls in this example have three
178 sis0 is the external interface, on the 10.0.0.0/24 subnet; sis1 is the
179 internal interface, on the 192.168.0.0/24 subnet; and sis2 is the
181 interface, using the 192.168.254.0/24 subnet.
182 A crossover cable connects the two firewalls via their sis2 interfaces.
183 On all three interfaces, firewall A uses the .254 address, while firewall B
185 The interfaces are configured as follows (firewall A unless otherwise
188 Interfaces configuration in
190 .Bd -literal -offset indent
191 network_interfaces="lo0 sis0 sis1 sis2"
192 cloned_interfaces="carp0 carp1"
193 ifconfig_sis0="10.0.0.254/24"
194 ifconfig_sis1="192.168.0.254/24"
195 ifconfig_sis2="192.168.254.254/24"
196 ifconfig_carp0="vhid 1 pass foo 10.0.0.1/24"
197 ifconfig_carp1="vhid 2 pass bar 192.168.0.1/24"
199 pfsync_syncdev="sis2"
203 must also be configured to allow
208 The following should be added to the top of
210 .Bd -literal -offset indent
211 pass quick on { sis2 } proto pfsync
212 pass on { sis0 sis1 } proto carp
215 If it is preferable that one firewall handle the traffic,
218 on the backup firewall's
220 interfaces should be set to something higher than
222 For example, if firewall B is the backup, its
223 carp1 configuration would look like this:
224 .Bd -literal -offset indent
225 ifconfig_carp1="vhid 2 pass bar advskew 100 192.168.0.1/24"
228 The following must also be added to
229 .Pa /etc/sysctl.conf :
230 .Bd -literal -offset indent
231 net.inet.carp.preempt=1
234 Possibility to view state changes using
236 has not been ported from
257 device first appeared in
261 device was imported to