2 .\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.63.2.33 2003/02/04 01:36:02 brueffer Exp $
3 .\" $DragonFly: src/sbin/ipfw/ipfw.8,v 1.16 2008/05/02 02:05:05 swildner Exp $
10 .Nd IP firewall and traffic shaper control program
25 .Brq Cm delete | zero | resetlog
30 .Brq Cm firewall | one_pass | debug | verbose | dyn_keepalive
33 .Brq Cm firewall | one_pass | debug | verbose | dyn_keepalive
36 .Cm set Oo Cm disable Ar number ... Oc Op Cm enable Ar number ...
40 .Ar number Cm to Ar number
42 .Cm set swap Ar number number
54 .Brq Cm delete | list | show
62 .Ar macro Ns Op = Ns Ar value
70 utility is the user interface for controlling the
76 .Bd -ragged -offset XXXX
78 this manual page documents the newer version of
82 CURRENT in July 2002, also known as
85 is a superset of the old firewall,
87 The differences between the two are listed in Section
88 .Sx IPFW2 ENHANCEMENTS ,
89 which you are encouraged to read to revise older rulesets and possibly
90 write them more efficiently.
99 numbered from 1 to 65535.
100 Packets are passed to
102 from a number of different places in the protocol stack
103 (depending on the source and destination of the packet,
106 is invoked multiple times on the same packet).
107 The packet passed to the firewall is compared
108 against each of the rules in the firewall
110 When a match is found, the action corresponding to the
111 matching rule is performed.
113 Depending on the action and certain system settings, packets
114 can be reinjected into the firewall at some rule after the
115 matching one for further processing.
119 ruleset always includes a
121 rule (numbered 65535) which cannot be modified,
122 and matches all packets.
123 The action associated with the
129 depending on how the kernel is configured.
131 If the ruleset includes one or more rules with the
139 behaviour, i.e. upon a match it will create dynamic rules matching
140 the exact parameters (addresses and ports) of the matching packet.
142 These dynamic rules, which have a limited lifetime, are checked
143 at the first occurrence of a
148 rule, and are typically used to open the firewall on-demand to
149 legitimate traffic only.
151 .Sx STATEFUL FIREWALL
154 Sections below for more information on the stateful behaviour of
157 All rules (including dynamic ones) have a few associated counters:
158 a packet count, a byte count, a log count and a timestamp
159 indicating the time of the last match.
160 Counters can be displayed or reset with
164 Rules can be added with the
166 command; deleted individually or in groups with the
168 command, and globally with the
170 command; displayed, optionally with the content of the
176 Finally, counters can be reset with the
182 Also, each rule belongs to one of 32 different
186 commands to atomically manipulate sets, such as enable,
187 disable, swap sets, move all rules in a set to another
188 one, delete all rules in a set. These can be useful to
189 install temporary configurations, or to test them.
192 for more information on
195 The following options are available:
196 .Bl -tag -width indent
198 While listing, show counter values.
201 command just implies this option.
203 When entering or showing rules, print them in compact form,
204 i.e. without the optional "ip from any to any" string
205 when this does not carry any additional information.
207 While listing, show dynamic rules in addition to static ones.
209 While listing, if the
211 option was specified, also show expired dynamic rules.
213 Don't ask for confirmation for commands that can cause problems
216 If there is no tty associated with the process, this is implied.
218 Try to resolve addresses and service names in output.
226 be quiet about actions
229 This is useful for adjusting rules by executing multiple
233 .Ql sh\ /etc/rc.firewall ) ,
234 or by processing a file of many
236 rules across a remote login session.
239 is performed in normal (verbose) mode (with the default kernel
240 configuration), it prints a message.
241 Because all rules are flushed, the message might not be delivered
242 to the login session, causing the remote login session to be closed
243 and the remainder of the ruleset to not be processed.
244 Access to the console would then be required to recover.
246 While listing rules, show the
248 each rule belongs to.
249 If this flag is not specified, disabled rules will not be
252 While listing pipes, sort according to one of the four
253 counters (total or current packets or bytes).
255 While listing, show last match timestamp.
258 To ease configuration, rules can be put into a file which is
261 as shown in the last synopsis line.
265 The file will be read line by line and applied as arguments to the
269 Optionally, a preprocessor can be specified using
273 is to be piped through.
274 Useful preprocessors include
280 doesn't start with a slash
282 as its first character, the usual
284 name search is performed.
285 Care should be taken with this in environments where not all
286 file systems are mounted (yet) by the time
288 is being run (e.g. when they are mounted over NFS).
291 has been specified, optional
295 specifications can follow and will be passed on to the preprocessor.
296 This allows for flexible configuration files (like conditionalizing
297 them on the local hostname) and the use of macros to centralize
298 frequently required arguments like IP addresses.
305 commands are used to configure the traffic shaper, as shown in the
306 .Sx TRAFFIC SHAPER (DUMMYNET) CONFIGURATION
309 If the world and the kernel get out of sync the
311 ABI may break, preventing you from being able to add any rules. This can
312 adversely affect the booting process. You can use
316 to temporarily disable the firewall to regain access to the network,
317 allowing you to fix the problem.
319 A packet is checked against the active ruleset in multiple places
320 in the protocol stack, under control of several sysctl variables.
321 These places and variables are shown below, and it is important to
322 have this picture in mind in order to design a correct ruleset.
323 .Bd -literal -offset indent
326 +----------->-----------+
328 [ip_input] [ip_output] net.inet.ip.fw.enable=1
331 [ether_demux] [ether_output_frame] net.link.ether.ipfw=1
336 As can be noted from the above picture, the number of
337 times the same packet goes through the firewall can
338 vary between 0 and 4 depending on packet source and
339 destination, and system configuration.
341 Note that as packets flow through the stack, headers can be
342 stripped or added to it, and so they may or may not be available
344 E.g., incoming packets will include the MAC header when
348 but the same packets will have the MAC header stripped off when
353 Also note that each packet is always checked against the complete ruleset,
354 irrespective of the place where the check occurs, or the source of the packet.
355 If a rule contains some match patterns or actions which are not valid
356 for the place of invocation (e.g. trying to match a MAC header within
358 the match pattern will not match, but a
360 operator in front of such patterns
364 match on those packets.
365 It is thus the responsibility of
366 the programmer, if necessary, to write a suitable ruleset to
367 differentiate among the possible places.
369 rules can be useful here, as an example:
370 .Bd -literal -offset indent
371 # packets from ether_demux
372 ipfw add 10 skipto 1000 all from any to any layer2 in
373 # packets from ip_input
374 ipfw add 10 skipto 2000 all from any to any not layer2 in
375 # packets from ip_output
376 ipfw add 10 skipto 3000 all from any to any not layer2 out
377 # packets from ether_output_frame
378 ipfw add 10 skipto 4000 all from any to any layer2 out
383 rules is the following:
384 .Bd -ragged -offset indent
386 .Op Cm set Ar set_number
387 .Op Cm prob Ar match_probability
390 .Op Cm log Op Cm logamount Ar number
394 where the body of the rule specifies which information is used
395 for filtering packets, among the following:
397 .Bl -tag -width "Source and dest. addresses and ports" -offset XXX -compact
398 .It Layer-2 header fields
402 .It Source and dest. addresses and ports
406 .It Transmit and receive interface
408 .It Misc. IP header fields
409 Version, type of service, datagram length, identification,
410 fragment flag (non-zero IP offset),
413 .It Misc. TCP header fields
414 TCP flags (SYN, FIN, ACK, RST, etc.),
415 sequence number, acknowledgment number,
421 When the packet can be associated with a local socket.
424 Note that some of the above information, e.g. source MAC or IP addresses and
425 TCP/UDP ports, could easily be spoofed, so filtering on those fields
426 alone might not guarantee the desired results.
427 .Bl -tag -width indent
429 Each rule is associated with a
431 in the range 1..65535, with the latter reserved for the
434 Rules are checked sequentially by rule number.
435 Multiple rules can have the same number, in which case they are
436 checked (and listed) according to the order in which they have
438 If a rule is entered without specifying a number, the kernel will
439 assign one in such a way that the rule becomes the last one
443 Automatic rule numbers are assigned by incrementing the last
444 non-default rule number by the value of the sysctl variable
445 .Ar net.inet.ip.fw.autoinc_step
446 which defaults to 100.
447 If this is not possible (e.g. because we would go beyond the
448 maximum allowed rule number), the number of the last
449 non-default value is used instead.
450 .It Cm set Ar set_number
451 Each rule is associated with a
453 in the range 0..31, with the latter reserved for the
456 Sets can be individually disabled and enabled, so this parameter
457 is of fundamental importance for atomic ruleset manipulation.
458 It can be also used to simplify deletion of groups of rules.
459 If a rule is entered without specifying a set number,
461 .It Cm prob Ar match_probability
462 A match is only declared with the specified probability
463 (floating point number between 0 and 1).
464 This can be useful for a number of applications such as
465 random packet drop or
468 to simulate the effect of multiple paths leading to out-of-order
470 .It Cm log Op Cm logamount Ar number
471 When a packet matches a rule with the
473 keyword, a message will be
479 The logging only occurs if the sysctl variable
480 .Em net.inet.ip.fw.verbose
482 (which is the default when the kernel is compiled with
483 .Dv IPFIREWALL_VERBOSE
484 ) and the number of packets logged so far for that
485 particular rule does not exceed the
490 is specified, the limit is taken from the sysctl variable
491 .Em net.inet.ip.fw.verbose_limit .
492 In both cases, a value of 0 removes the logging limit.
494 Once the limit is reached, logging can be re-enabled by
495 clearing the logging counter or the packet counter for that entry, see the
500 A rule can be associated with one of the following actions, which
501 will be executed when the packet matches the body of the rule.
502 .Bl -tag -width indent
503 .It Cm allow | accept | pass | permit
504 Allow packets that match rule.
505 The search terminates.
507 Checks the packet against the dynamic ruleset.
508 If a match is found, execute the action associated with
509 the rule which generated this dynamic rule, otherwise
510 move to the next rule.
513 rules do not have a body.
516 rule is found, the dynamic ruleset is checked at the first
522 Update counters for all packets that match rule.
523 The search continues with the next rule.
525 Discard packets that match this rule.
526 The search terminates.
527 .It Cm divert Ar port
528 Divert packets that match this rule to the
532 The search terminates.
533 .It Cm fwd | forward Ar ipaddr Ns Op , Ns Ar port
534 Change the next-hop on matching packets to
536 which can be an IP address in dotted quad format or a host name.
537 The search terminates if this rule matches.
541 is a local address, then matching packets will be forwarded to
543 (or the port number in the packet if one is not specified in the rule)
544 on the local machine.
548 is not a local address, then the port number
549 (if specified) is ignored, and the packet will be
550 forwarded to the remote address, using the route as found in
551 the local routing table for that IP.
555 rule will not match layer-2 packets (those received
556 on ether_input or ether_output).
560 action does not change the contents of the packet at all.
561 In particular, the destination address remains unmodified, so
562 packets forwarded to another system will usually be rejected by that system
563 unless there is a matching rule on that system to capture them.
564 For packets forwarded locally,
565 the local address of the socket will be
566 set to the original destination address of the packet.
569 entry look rather weird but is intended for
570 use with transparent proxy servers.
571 .It Cm pipe Ar pipe_nr
575 (for bandwidth limitation, delay, etc.).
577 .Sx TRAFFIC SHAPER (DUMMYNET) CONFIGURATION
578 Section for further information.
579 The search terminates; however, on exit from the pipe and if
583 .Em net.inet.ip.fw.one_pass
584 is not set, the packet is passed again to the firewall code
585 starting from the next rule.
586 .It Cm queue Ar queue_nr
590 (for bandwidth limitation using WF2Q+).
596 Discard packets that match this rule, and if the
597 packet is a TCP packet, try to send a TCP reset (RST) notice.
598 The search terminates.
599 .It Cm skipto Ar number
600 Skip all subsequent rules numbered less than
602 The search continues with the first rule numbered
606 Send a copy of packets matching this rule to the
610 The search terminates and the original packet is accepted
614 .It Cm unreach Ar code
615 Discard packets that match this rule, and try to send an ICMP
616 unreachable notice with code
620 is a number from 0 to 255, or one of these aliases:
621 .Cm net , host , protocol , port ,
622 .Cm needfrag , srcfail , net-unknown , host-unknown ,
623 .Cm isolated , net-prohib , host-prohib , tosnet ,
624 .Cm toshost , filter-prohib , host-precedence
626 .Cm precedence-cutoff .
627 The search terminates.
630 The body of a rule contains zero or more patterns (such as
631 specific source and destination addresses or ports,
632 protocol options, incoming or outgoing interfaces, etc.)
633 that the packet must match in order to be recognised.
634 In general, the patterns are connected by (implicit)
636 operators -- i.e. all must match in order for the
638 Individual patterns can be prefixed by the
640 operator to reverse the result of the match, as in
642 .Dl "ipfw add 100 allow ip from not 1.2.3.4 to any"
644 Additionally, sets of alternative match patterns (
646 ) can be constructed by putting the patterns in
647 lists enclosed between parentheses ( ) or braces { }, and
652 .Dl "ipfw add 100 allow ip from { x or not y or z } to any"
654 Only one level of parentheses is allowed.
655 Beware that most shells have special meanings for parentheses
656 or braces, so it is advisable to put a backslash \\ in front of them
657 to prevent such interpretations.
659 The body of a rule must in general include a source and destination
663 can be used in various places to specify that the content of
664 a required field is irrelevant.
666 The rule body has the following format:
667 .Bd -ragged -offset indent
668 .Op Ar proto Cm from Ar src Cm to Ar dst
672 The first part (protocol from src to dst) is for backward
677 any match pattern (including MAC headers, IPv4 protocols,
678 addresses and ports) can be specified in the
682 Rule fields have the following meaning:
683 .Bl -tag -width indent
684 .It Ar proto : protocol | Cm { Ar protocol Cm or ... }
685 An IPv4 protocol (or an
687 with multiple protocols) specified by number or name
688 (for a complete list see
689 .Pa /etc/protocols ) .
694 keywords mean any protocol will match.
695 .It Ar src No and Ar dst : ip-address | Cm { Ar ip-address Cm or ... } Op Ar ports
700 containing one or more of them,
701 optionally followed by
705 An address (or set of addresses) specified in one of the following
706 ways, optionally preceded by a
709 .Bl -tag -width indent
711 matches any IP address.
713 matches any IP address configured on an interface in the system.
714 The address list is evaluated at the time the packet is
716 .It Ar numeric-ip | hostname
717 Matches a single IPv4 address, specified as dotted-quad or a hostname.
718 Hostnames are resolved at the time the rule is added to the firewall list.
719 .It Ar addr Ns / Ns Ar masklen
720 Matches all addresses with base
722 (specified as a dotted quad or a hostname)
726 As an example, 1.2.3.4/25 will match
727 all IP numbers from 1.2.3.0 to 1.2.3.127 .
728 .It Ar addr Ns / Ns Ar masklen Ns Cm { Ns Ar num,num,... Ns Cm }
729 Matches all addresses with base address
731 (specified as a dotted quad or a hostname)
732 and whose last byte is in the list between braces { } .
733 Note that there must be no spaces between braces, commas and
737 field is used to limit the size of the set of addresses,
738 and can have any value between 24 and 32.
740 As an example, an address specified as 1.2.3.4/24{128,35,55,89}
741 will match the following IP addresses:
743 1.2.3.128 1.2.3.35 1.2.3.55 1.2.3.89 .
745 This format is particularly useful to handle sparse address sets
746 within a single rule. Because the matching occurs using a
747 bitmask, it takes constant time and dramatically reduces
748 the complexity of rulesets.
749 .It Ar addr Ns : Ns Ar mask
750 Matches all addresses with base
752 (specified as a dotted quad or a hostname)
755 specified as a dotted quad.
756 As an example, 1.2.3.4/255.0.255.0 will match
758 We suggest to use this form only for non-contiguous
759 masks, and resort to the
760 .Ar addr Ns / Ns Ar masklen
761 format for contiguous masks, which is more compact and less
764 .It Ar ports : Oo Cm not Oc Bro Ar port | port Ns \&- Ns Ar port Ns Brc Op , Ns Ar ...
765 For protocols which support port numbers (such as TCP and UDP), optional
767 may be specified as one or more ports or port ranges, separated
768 by commas but no spaces, and an optional
773 notation specifies a range of ports (including boundaries).
777 may be used instead of numeric port values.
778 The length of the port list is limited to 30 ports or ranges,
779 though one can specify larger ranges by using an
787 can be used to escape the dash
789 character in a service name (from a shell, the backslash must be
790 typed twice to avoid the shell itself interpreting it as an escape
793 .Dl "ipfw add count tcp from any ftp\e\e-data-ftp to any"
795 Fragmented packets which have a non-zero offset (i.e. not the first
796 fragment) will never match a rule which has one or more port
800 option for details on matching fragmented packets.
802 .Ss RULE OPTIONS (MATCH PATTERNS)
803 Additional match patterns can be used within
804 rules. Zero or more of these so-called
806 can be present in a rule, optionally prefixed by the
808 operand, and possibly grouped into
811 The following match patterns can be used (listed in alphabetical order):
812 .Bl -tag -width indent
813 .It Cm dst-ip Ar ip address
814 Matches IP packets whose destination IP is one of the address(es)
815 specified as argument.
816 .It Cm dst-port Ar source ports
817 Matches IP packets whose destination port is one of the port(s)
818 specified as argument.
820 Matches TCP packets that have the RST or ACK bits set.
822 Matches packets that are fragments and not the first
823 fragment of an IP datagram. Note that these packets will not have
824 the next protocol header (e.g. TCP, UDP) so options that look into
825 these headers cannot match.
827 Matches all TCP or UDP packets sent by or received for a
831 may be specified by name or number.
832 .It Cm icmptypes Ar types
833 Matches ICMP packets whose ICMP type is in the list
835 The list may be specified as any combination of ranges or
836 individual types separated by commas.
837 The supported ICMP types are:
841 destination unreachable
853 time-to-live exceeded
867 and address mask reply
870 Matches incoming or outgoing packets, respectively.
874 are mutually exclusive (in fact,
879 Matches IP packets whose
884 Matches IP packets whose total length, including header and data, is
887 .It Cm ipoptions Ar spec
888 Matches packets whose IP header contains the comma separated list of
891 The supported IP options are:
894 (strict source route),
896 (loose source route),
898 (record packet route) and
901 The absence of a particular option may be denoted
904 .It Cm ipprecedence Ar precedence
905 Matches IP packets whose precedence field is equal to
908 Matches IP packets whose
910 field contains the comma separated list of
911 service types specified in
913 The supported IP types of service are:
916 .Pq Dv IPTOS_LOWDELAY ,
918 .Pq Dv IPTOS_THROUGHPUT ,
920 .Pq Dv IPTOS_RELIABILITY ,
922 .Pq Dv IPTOS_MINCOST ,
925 The absence of a particular type may be denoted
929 Matches IP packets whose time to live is
931 .It Cm ipversion Ar ver
932 Matches IP packets whose IP version field is
935 Upon a match, the firewall will create a dynamic rule, whose
936 default behaviour is to match bidirectional traffic between
937 source and destination IP/port using the same protocol.
938 The rule has a limited lifetime (controlled by a set of
940 variables), and the lifetime is refreshed every time a matching
943 Matches only layer2 packets, i.e. those passed to
945 from ether_demux() and ether_output_frame().
946 .It Cm limit Bro Cm src-addr | src-port | dst-addr | dst-port Brc Ar N
947 The firewall will only allow
949 connections with the same
950 set of parameters as specified in the rule.
952 of source and destination addresses and ports can be
954 .It Cm { MAC | mac } Ar dst-mac src-mac
955 Match packets with a given
959 addresses, specified as the
961 keyword (matching any MAC address), or six groups of hex digits
963 and optionally followed by a mask indicating how many bits are
966 .Dl "MAC 10:20:30:40:50:60/33 any"
968 Note that the order of MAC addresses (destination first,
970 the same as on the wire, but the opposite of the one used for
972 .It Cm mac-type Ar mac-type
973 Matches packets whose Ethernet Type field
974 corresponds to one of those specified as argument.
976 is specified in the same way as
978 (i.e. one or more comma-separated single values or ranges).
979 You can use symbolic names for known values such as
980 .Em vlan , ipv4, ipv6 .
981 Values can be entered as decimal or hexadecimal (if prefixed by 0x),
982 and they are always printed as hexadecimal (unless the
984 option is used, in which case symbolic resolution will be attempted).
985 .It Cm proto Ar protocol
986 Matches packets with the corresponding IPv4 protocol.
987 .It Cm recv | xmit | via Brq Ar ifX | Ar if Ns Cm * | Ar ipno | Ar any
988 Matches packets received, transmitted or going through,
989 respectively, the interface specified by exact name
990 .Ns No ( Ar ifX Ns No ),
992 .Ns No ( Ar if Ns Ar * Ns No ),
993 by IP address, or through some interface.
997 keyword causes the interface to always be checked.
1004 then only the receive or transmit interface (respectively)
1006 By specifying both, it is possible to match packets based on
1007 both receive and transmit interface, e.g.:
1009 .Dl "ipfw add deny ip from any to any out recv ed0 xmit ed1"
1013 interface can be tested on either incoming or outgoing packets,
1016 interface can only be tested on outgoing packets.
1021 is invalid) whenever
1025 A packet may not have a receive or transmit interface: packets
1026 originating from the local host have no receive interface,
1027 while packets destined for the local host have no transmit
1030 Matches TCP packets that have the SYN bit set but no ACK bit.
1031 This is the short form of
1032 .Dq Li tcpflags\ syn,!ack .
1033 .It Cm src-ip Ar ip-address
1034 Matches IP packets whose source IP is one of the address(es)
1035 specified as argument.
1036 .It Cm src-port Ar ports
1037 Matches IP packets whose source port is one of the port(s)
1038 specified as argument.
1039 .It Cm tcpack Ar ack
1041 Match if the TCP header acknowledgment number field is set to
1043 .It Cm tcpflags Ar spec
1045 Match if the TCP header contains the comma separated list of
1048 The supported TCP flags are:
1057 The absence of a particular flag may be denoted
1060 A rule which contains a
1062 specification can never match a fragmented packet which has
1066 option for details on matching fragmented packets.
1067 .It Cm tcpseq Ar seq
1069 Match if the TCP header sequence number field is set to
1071 .It Cm tcpwin Ar win
1073 Match if the TCP header window field is set to
1075 .It Cm tcpoptions Ar spec
1077 Match if the TCP header contains the comma separated list of
1078 options specified in
1080 The supported TCP options are:
1083 (maximum segment size),
1085 (tcp window advertisement),
1089 (rfc1323 timestamp) and
1091 (rfc1644 t/tcp connection count).
1092 The absence of a particular option may be denoted
1096 Match all TCP or UDP packets sent by or received for a
1100 may be matched by name or identification number.
1103 Each rule belongs to one of 32 different
1106 Set 31 is reserved for the default rule.
1108 By default, rules are put in set 0, unless you use the
1110 attribute when entering a new rule.
1111 Sets can be individually and atomically enabled or disabled,
1112 so this mechanism permits an easy way to store multiple configurations
1113 of the firewall and quickly (and atomically) switch between them.
1114 The command to enable/disable sets is
1115 .Bd -ragged -offset indent
1117 .Cm set Oo Cm disable Ar number ... Oc Op Cm enable Ar number ...
1124 sections can be specified.
1125 Command execution is atomic on all the sets specified in the command.
1126 By default, all sets are enabled.
1128 When you disable a set, its rules behave as if they do not exist
1129 in the firewall configuration, with only one exception:
1130 .Bd -ragged -offset indent
1131 dynamic rules created from a rule before it had been disabled
1132 will still be active until they expire. In order to delete
1133 dynamic rules you have to explicitly delete the parent rule
1134 which generated them.
1137 The set number of rules can be changed with the command
1138 .Bd -ragged -offset indent
1141 .Brq Cm rule Ar rule-number | old-set
1145 Also, you can atomically swap two rulesets with the command
1146 .Bd -ragged -offset indent
1148 .Cm set swap Ar first-set second-set
1153 Section on some possible uses of sets of rules.
1154 .Sh STATEFUL FIREWALL
1155 Stateful operation is a way for the firewall to dynamically
1156 create rules for specific flows when packets that
1157 match a given pattern are detected. Support for stateful
1158 operation comes through the
1159 .Cm check-state , keep-state
1166 Dynamic rules are created when a packet matches a
1170 rule, causing the creation of a
1172 rule which will match all and only packets with
1176 .Em src-ip/src-port dst-ip/dst-port
1181 are used here only to denote the initial match addresses, but they
1182 are completely equivalent afterwards).
1183 Dynamic rules will be checked at the first
1184 .Cm check-state, keep-state
1187 occurrence, and the action performed upon a match will be the same
1188 as in the parent rule.
1190 Note that no additional attributes other than protocol and IP addresses
1191 and ports are checked on dynamic rules.
1193 The typical use of dynamic rules is to keep a closed firewall configuration,
1194 but let the first TCP SYN packet from the inside network install a
1195 dynamic rule for the flow so that packets belonging to that session
1196 will be allowed through the firewall:
1198 .Dl "ipfw add check-state"
1199 .Dl "ipfw add allow tcp from my-subnet to any setup keep-state"
1200 .Dl "ipfw add deny tcp from any to any"
1202 A similar approach can be used for UDP, where an UDP packet coming
1203 from the inside will install a dynamic rule to let the response through
1206 .Dl "ipfw add check-state"
1207 .Dl "ipfw add allow udp from my-subnet to any keep-state"
1208 .Dl "ipfw add deny udp from any to any"
1210 Dynamic rules expire after some time, which depends on the status
1211 of the flow and the setting of some
1215 .Sx SYSCTL VARIABLES
1217 For TCP sessions, dynamic rules can be instructed to periodically
1218 send keepalive packets to refresh the state of the rule when it is
1223 for more examples on how to use dynamic rules.
1224 .Sh TRAFFIC SHAPER (DUMMYNET) CONFIGURATION
1226 is also the user interface for the
1231 operates by first using the firewall to classify packets and divide them into
1233 using any match pattern that can be used in
1236 Depending on local policies, a flow can contain packets for a single
1237 TCP connection, or from/to a given host, or entire subnet, or a
1240 Packets belonging to the same flow are then passed to either of two
1241 different objects, which implement the traffic regulation:
1242 .Bl -hang -offset XXXX
1244 A pipe emulates a link with given bandwidth, propagation delay,
1245 queue size and packet loss rate.
1246 Packets are queued in front of the pipe as they come out from the classifier,
1247 and then transferred to the pipe according to the pipe's parameters.
1251 is an abstraction used to implement the WF2Q+
1252 (Worst-case Fair Weighted Fair Queueing) policy, which is
1253 an efficient variant of the WFQ policy.
1255 The queue associates a
1257 and a reference pipe to each flow, and then all backlogged (i.e.,
1258 with packets queued) flows linked to the same pipe share the pipe's
1259 bandwidth proportionally to their weights.
1260 Note that weights are not priorities; a flow with a lower weight
1261 is still guaranteed to get its fraction of the bandwidth even if a
1262 flow with a higher weight is permanently backlogged.
1266 can be used to set hard limits to the bandwidth that a flow can use, whereas
1268 can be used to determine how different flow share the available bandwidth.
1274 configuration commands are the following:
1275 .Bd -ragged -offset indent
1276 .Cm pipe Ar number Cm config Ar pipe-configuration
1278 .Cm queue Ar number Cm config Ar queue-configuration
1281 The following parameters can be configured for a pipe:
1283 .Bl -tag -width indent -compact
1284 .It Cm bw Ar bandwidth
1285 Bandwidth, measured in
1288 .Brq Cm bit/s | Byte/s .
1291 A value of 0 (default) means unlimited bandwidth.
1292 The unit must immediately follow the number, as in
1294 .Dl "ipfw pipe 1 config bw 300Kbit/s"
1296 .It Cm delay Ar ms-delay
1297 Propagation delay, measured in milliseconds.
1298 The value is rounded to the next multiple of the clock tick
1299 (typically 10ms, but it is a good practice to run kernels
1301 .Cd "options HZ=1000"
1303 the granularity to 1ms or less).
1304 Default value is 0, meaning no delay.
1307 The following parameters can be configured for a queue:
1309 .Bl -tag -width indent -compact
1310 .It Cm pipe Ar pipe_nr
1311 Connects a queue to the specified pipe.
1312 Multiple queues (with the same or different weights) can be connected to
1313 the same pipe, which specifies the aggregate rate for the set of queues.
1315 .It Cm weight Ar weight
1316 Specifies the weight to be used for flows matching this queue.
1317 The weight must be in the range 1..100, and defaults to 1.
1320 Finally, the following parameters can be configured for both
1323 .Bl -tag -width XXXX -compact
1324 .It Cm buckets Ar hash-table-size
1325 Specifies the size of the hash table used for storing the
1327 Default value is 64 controlled by the
1330 .Em net.inet.ip.dummynet.hash_size ,
1331 allowed range is 16 to 65536.
1333 .It Cm mask Ar mask-specifier
1334 Packets sent to a given pipe or queue by an
1336 rule can be further classified into multiple flows, each of which is then
1340 A flow identifier is constructed by masking the IP addresses,
1341 ports and protocol types as specified with the
1343 options in the configuration of the pipe or queue.
1344 For each different flow identifier, a new pipe or queue is created
1345 with the same parameters as the original object, and matching packets
1350 are used, each flow will get the same bandwidth as defined by the pipe,
1353 are used, each flow will share the parent's pipe bandwidth evenly
1354 with other flows generated by the same queue (note that other queues
1355 with different weights might be connected to the same pipe).
1357 Available mask specifiers are a combination of one or more of the following:
1359 .Cm dst-ip Ar mask ,
1360 .Cm src-ip Ar mask ,
1361 .Cm dst-port Ar mask ,
1362 .Cm src-port Ar mask ,
1367 where the latter means all bits in all fields are significant.
1370 When a packet is dropped by a dummynet queue or pipe, the error
1371 is normally reported to the caller routine in the kernel, in the
1372 same way as it happens when a device queue fills up. Setting this
1373 option reports the packet as successfully delivered, which can be
1374 needed for some experimental setups where you want to simulate
1375 loss or congestion at a remote router.
1378 This option is always on,
1382 .It Cm plr Ar packet-loss-rate
1385 .Ar packet-loss-rate
1386 is a floating-point number between 0 and 1, with 0 meaning no
1387 loss, 1 meaning 100% loss.
1388 The loss rate is internally represented on 31 bits.
1390 .It Cm queue Brq Ar slots | size Ns Cm Kbytes
1395 Default value is 50 slots, which
1396 is the typical queue size for Ethernet devices.
1397 Note that for slow speed links you should keep the queue
1398 size short or your traffic might be affected by a significant
1400 E.g., 50 max-sized ethernet packets (1500 bytes) mean 600Kbit
1401 or 20s of queue on a 30Kbit/s pipe.
1402 Even worse effect can result if you get packets from an
1403 interface with a much larger MTU, e.g. the loopback interface
1404 with its 16KB packets.
1406 .It Cm red | gred Ar w_q Ns / Ns Ar min_th Ns / Ns Ar max_th Ns / Ns Ar max_p
1407 Make use of the RED (Random Early Detection) queue management algorithm.
1412 point numbers between 0 and 1 (0 not included), while
1416 are integer numbers specifying thresholds for queue management
1417 (thresholds are computed in bytes if the queue has been defined
1418 in bytes, in slots otherwise).
1421 also supports the gentle RED variant (gred).
1424 variables can be used to control the RED behaviour:
1425 .Bl -tag -width indent
1426 .It Em net.inet.ip.dummynet.red_lookup_depth
1427 specifies the accuracy in computing the average queue
1428 when the link is idle (defaults to 256, must be greater than zero)
1429 .It Em net.inet.ip.dummynet.red_avg_pkt_size
1430 specifies the expected average packet size (defaults to 512, must be
1432 .It Em net.inet.ip.dummynet.red_max_pkt_size
1433 specifies the expected maximum packet size, only used when queue
1434 thresholds are in bytes (defaults to 1500, must be greater than zero).
1438 Here are some important points to consider when designing your
1442 Remember that you filter both packets going
1446 Most connections need packets going in both directions.
1448 Remember to test very carefully.
1449 It is a good idea to be near the console when doing this.
1450 If you cannot be near the console,
1451 use an auto-recovery script such as the one in
1452 .Pa /usr/share/examples/ipfw/change_rules.sh .
1454 Don't forget the loopback interface.
1459 There are circumstances where fragmented datagrams are unconditionally
1461 TCP packets are dropped if they do not contain at least 20 bytes of
1462 TCP header, UDP packets are dropped if they do not contain a full 8
1463 byte UDP header, and ICMP packets are dropped if they do not contain
1464 4 bytes of ICMP header, enough to specify the ICMP type, code, and
1466 These packets are simply logged as
1468 since there may not be enough good data in the packet to produce a
1469 meaningful log entry.
1471 Another type of packet is unconditionally dropped, a TCP packet with a
1472 fragment offset of one.
1473 This is a valid packet, but it only has one use, to try
1474 to circumvent firewalls.
1475 When logging is enabled, these packets are
1476 reported as being dropped by rule -1.
1478 If you are logged in over a network, loading the
1482 is probably not as straightforward as you would think.
1483 I recommend the following command line:
1484 .Bd -literal -offset indent
1485 kldload /modules/ipfw.ko && \e
1486 ipfw add 32000 allow ip from any to any
1489 Along the same lines, doing an
1490 .Bd -literal -offset indent
1494 in similar surroundings is also a bad idea.
1498 filter list may not be modified if the system security level
1499 is set to 3 or higher
1502 for information on system security levels).
1504 .Sh PACKET DIVERSION
1507 socket bound to the specified port will receive all packets
1508 diverted to that port.
1509 If no socket is bound to the destination port, or if the kernel
1510 wasn't compiled with divert socket support, the packets are
1512 .Sh SYSCTL VARIABLES
1515 variables controls the behaviour of the firewall and
1516 associated modules (
1519 These are shown below together with their default value
1520 (but always check with the
1522 command what value is actually in use) and meaning:
1523 .Bl -tag -width indent
1524 .It Em net.inet.ip.dummynet.expire : No 1
1525 Lazily delete dynamic pipes/queue once they have no pending traffic.
1526 You can disable this by setting the variable to 0, in which case
1527 the pipes/queues will only be deleted when the threshold is reached.
1528 .It Em net.inet.ip.dummynet.hash_size : No 64
1529 Default size of the hash table used for dynamic pipes/queues.
1530 This value is used when no
1532 option is specified when configuring a pipe/queue.
1533 .It Em net.inet.ip.dummynet.max_chain_len : No 16
1534 Target value for the maximum number of pipes/queues in a hash bucket.
1536 .Cm max_chain_len*hash_size
1537 is used to determine the threshold over which empty pipes/queues
1538 will be expired even when
1539 .Cm net.inet.ip.dummynet.expire=0 .
1540 .It Em net.inet.ip.dummynet.red_lookup_depth : No 256
1541 .It Em net.inet.ip.dummynet.red_avg_pkt_size : No 512
1542 .It Em net.inet.ip.dummynet.red_max_pkt_size : No 1500
1543 Parameters used in the computations of the drop probability
1544 for the RED algorithm.
1545 .It Em net.inet.ip.fw.autoinc_step : No 100
1546 Delta between rule numbers when auto-generating them.
1547 The value must be in the range 1..1000.
1548 .It Em net.inet.ip.fw.curr_dyn_buckets : Em net.inet.ip.fw.dyn_buckets
1549 The current number of buckets in the hash table for dynamic rules
1551 .It Em net.inet.ip.fw.debug : No 1
1552 Controls debugging messages produced by
1554 .It Em net.inet.ip.fw.dyn_buckets : No 256
1555 The number of buckets in the hash table for dynamic rules.
1556 Must be a power of 2, up to 65536.
1557 It only takes effect when all dynamic rules have expired, so you
1558 are advised to use a
1560 command to make sure that the hash table is resized.
1561 .It Em net.inet.ip.fw.dyn_count : No 3
1562 Current number of dynamic rules
1564 .It Em net.inet.ip.fw.dyn_keepalive : No 1
1565 Enables generation of keepalive packets for
1567 rules on TCP sessions. A keepalive is generated to both
1568 sides of the connection every 5 seconds for the last 20
1569 seconds of the lifetime of the rule.
1570 .It Em net.inet.ip.fw.dyn_max : No 8192
1571 Maximum number of dynamic rules.
1572 When you hit this limit, no more dynamic rules can be
1573 installed until old ones expire.
1574 .It Em net.inet.ip.fw.dyn_ack_lifetime : No 300
1575 .It Em net.inet.ip.fw.dyn_syn_lifetime : No 20
1576 .It Em net.inet.ip.fw.dyn_fin_lifetime : No 1
1577 .It Em net.inet.ip.fw.dyn_rst_lifetime : No 1
1578 .It Em net.inet.ip.fw.dyn_udp_lifetime : No 5
1579 .It Em net.inet.ip.fw.dyn_short_lifetime : No 30
1580 These variables control the lifetime, in seconds, of dynamic
1582 Upon the initial SYN exchange the lifetime is kept short,
1583 then increased after both SYN have been seen, then decreased
1584 again during the final FIN exchange or when a RST is received.
1586 .Em dyn_fin_lifetime
1588 .Em dyn_rst_lifetime
1589 must be strictly lower than 5 seconds, the period of
1590 repetition of keepalives. The firewall enforces that.
1591 .It Em net.inet.ip.fw.enable : No 1
1592 Enables the firewall.
1593 Setting this variable to 0 lets you run your machine without
1594 firewall even if compiled in.
1595 .It Em net.inet.ip.fw.one_pass : No 1
1596 When set, the packet exiting from the
1598 pipe is not passed though the firewall again.
1599 Otherwise, after a pipe action, the packet is
1600 reinjected into the firewall at the next rule.
1602 Note: layer 2 packets coming out of a pipe
1603 are never reinjected in the firewall irrespective of the
1604 value of this variable.
1605 .It Em net.inet.ip.fw.verbose : No 1
1606 Enables verbose messages.
1607 .It Em net.inet.ip.fw.verbose_limit : No 0
1608 Limits the number of messages produced by a verbose firewall.
1609 .It Em net.link.ether.ipfw : No 0
1610 Controls whether layer-2 packets are passed to
1614 .Sh IPFW2 ENHANCEMENTS
1615 This Section lists the features that have been introduced in
1617 which were not present in
1619 We list them in order of the potential impact that they can
1620 have in writing your rulesets.
1621 You might want to consider using these features in order to
1622 write your rulesets in a more efficient way.
1623 .Bl -tag -width indent
1624 .It Handling of non-IPv4 packets
1626 will silently accept all non-IPv4 packets.
1628 will filter all packets (including non-IPv4 ones) according to the ruleset.
1629 To achieve the same behaviour as
1631 you can use the following as the very first rule in your ruleset:
1633 .Dl "ipfw add 1 allow layer2 not mac-type ip"
1637 option might seem redundant, but it is necessary -- packets
1638 passed to the firewall from layer3 will not have a MAC header,
1641 pattern will always fail on them, and the
1643 operator will make this rule into a pass-all.
1646 does not supports address sets (those in the form
1647 .Ar addr/masklen{num,num,...}
1650 .It Port specifications
1652 only allows one port range when specifying TCP and UDP ports, and
1653 is limited to 10 entries instead of the 15 allowed by
1657 you can only specify ports when the rule is requesting
1663 you can put port specifications in rules matching all packets,
1664 and the match will be attempted only on those packets carrying
1665 protocols which include port identifiers.
1669 allowed the first port entry to be specified as
1673 can be an arbitrary 16-bit mask.
1674 This syntax is of questionable usefulness and it is not
1675 supported anymore in
1679 does not support Or-blocks.
1682 does not generate keepalives for stateful sessions.
1683 As a consequence, it might cause idle sessions to drop because
1684 the lifetime of the dynamic rules expires.
1687 does not implement sets of rules.
1688 .It MAC header filtering and Layer-2 firewalling.
1690 does not implement filtering on MAC header fields, nor is it
1691 invoked on packets from
1694 .Fn ether_output_frame .
1696 .Em net.link.ether.ipfw
1697 has no effect there.
1699 The following options are not supported in
1702 .Cm dst-ip, dst-port, layer2, mac, mac-type, src-ip, src-port.
1704 Additionally, the following options are not supported in
1709 .Cm ipid, iplen, ipprecedence, iptos, ipttl,
1710 .Cm ipversion, tcpack, tcpseq, tcpwin .
1711 .It Dummynet options
1712 The following option for
1714 pipes/queues is not supported:
1718 There are far too many possible uses of
1720 so this Section will only give a small set of examples.
1721 .Ss BASIC PACKET FILTERING
1722 This command adds an entry which denies all tcp packets from
1723 .Em cracker.evil.org
1724 to the telnet port of
1726 from being forwarded by the host:
1728 .Dl "ipfw add deny tcp from cracker.evil.org to wolf.tambov.su telnet"
1730 This one disallows any connection from the entire cracker's
1733 .Dl "ipfw add deny ip from 123.45.67.0/24 to my.host.org"
1735 A first and efficient way to limit access (not using dynamic rules)
1736 is the use of the following rules:
1738 .Dl "ipfw add allow tcp from any to any established"
1739 .Dl "ipfw add allow tcp from net1 portlist1 to net2 portlist2 setup"
1740 .Dl "ipfw add allow tcp from net3 portlist3 to net3 portlist3 setup"
1742 .Dl "ipfw add deny tcp from any to any"
1744 The first rule will be a quick match for normal TCP packets,
1745 but it will not match the initial SYN packet, which will be
1748 rules only for selected source/destination pairs.
1749 All other SYN packets will be rejected by the final
1753 If you administer one or more subnets, you can take advantage of the
1755 syntax to specify address sets and or-blocks and write extremely
1756 compact rulesets which selectively enable services to blocks
1757 of clients, as below:
1759 .Dl "goodguys=\*q{ 10.1.2.0/24{20,35,66,18} or 10.2.3.0/28{6,3,11} }\*q"
1760 .Dl "badguys=\*q10.1.2.0/24{8,38,60}\*q"
1762 .Dl "ipfw add allow ip from ${goodguys} to any"
1763 .Dl "ipfw add deny ip from ${badguys} to any"
1764 .Dl "... normal policies ..."
1768 syntax would require a separate rule for each IP in the above
1771 In order to protect a site from flood attacks involving fake
1772 TCP packets, it is safer to use dynamic rules:
1774 .Dl "ipfw add check-state"
1775 .Dl "ipfw add deny tcp from any to any established"
1776 .Dl "ipfw add allow tcp from my-net to any setup keep-state"
1778 This will let the firewall install dynamic rules only for
1779 those connection which start with a regular SYN packet coming
1780 from the inside of our network.
1781 Dynamic rules are checked when encountering the first
1788 rule should usually be placed near the beginning of the
1789 ruleset to minimize the amount of work scanning the ruleset.
1790 Your mileage may vary.
1792 To limit the number of connections a user can open
1793 you can use the following type of rules:
1795 .Dl "ipfw add allow tcp from my-net/24 to any setup limit src-addr 10"
1796 .Dl "ipfw add allow tcp from any to me setup limit src-addr 4"
1798 The former (assuming it runs on a gateway) will allow each host
1799 on a /24 network to open at most 10 TCP connections.
1800 The latter can be placed on a server to make sure that a single
1801 client does not use more than 4 simultaneous connections.
1804 stateful rules can be subject to denial-of-service attacks
1805 by a SYN-flood which opens a huge number of dynamic rules.
1806 The effects of such attacks can be partially limited by
1809 variables which control the operation of the firewall.
1811 Here is a good usage of the
1813 command to see accounting records and timestamp information:
1817 or in short form without timestamps:
1821 which is equivalent to:
1825 Next rule diverts all incoming packets from 192.168.2.0/24
1826 to divert port 5000:
1828 .Dl ipfw divert 5000 ip from 192.168.2.0/24 to any in
1830 The following rules show some of the applications of
1834 for simulations and the like.
1836 This rule drops random incoming packets with a probability
1839 .Dl "ipfw add prob 0.05 deny ip from any to any in"
1841 A similar effect can be achieved making use of dummynet pipes:
1843 .Dl "ipfw add pipe 10 ip from any to any"
1844 .Dl "ipfw pipe 10 config plr 0.05"
1846 We can use pipes to artificially limit bandwidth, e.g. on a
1847 machine acting as a router, if we want to limit traffic from
1848 local clients on 192.168.2.0/24 we do:
1850 .Dl "ipfw add pipe 1 ip from 192.168.2.0/24 to any out"
1851 .Dl "ipfw pipe 1 config bw 300Kbit/s queue 50KBytes"
1853 note that we use the
1855 modifier so that the rule is not used twice.
1856 Remember in fact that
1858 rules are checked both on incoming and outgoing packets.
1860 Should we want to simulate a bidirectional link with bandwidth
1861 limitations, the correct way is the following:
1863 .Dl "ipfw add pipe 1 ip from any to any out"
1864 .Dl "ipfw add pipe 2 ip from any to any in"
1865 .Dl "ipfw pipe 1 config bw 64Kbit/s queue 10Kbytes"
1866 .Dl "ipfw pipe 2 config bw 64Kbit/s queue 10Kbytes"
1868 The above can be very useful, e.g. if you want to see how
1869 your fancy Web page will look for a residential user who
1870 is connected only through a slow link.
1871 You should not use only one pipe for both directions, unless
1872 you want to simulate a half-duplex medium (e.g. AppleTalk,
1874 It is not necessary that both pipes have the same configuration,
1875 so we can also simulate asymmetric links.
1877 Should we want to verify network performance with the RED queue
1878 management algorithm:
1880 .Dl "ipfw add pipe 1 ip from any to any"
1881 .Dl "ipfw pipe 1 config bw 500Kbit/s queue 100 red 0.002/30/80/0.1"
1883 Another typical application of the traffic shaper is to
1884 introduce some delay in the communication.
1885 This can significantly affect applications which do a lot of Remote
1886 Procedure Calls, and where the round-trip-time of the
1887 connection often becomes a limiting factor much more than
1890 .Dl "ipfw add pipe 1 ip from any to any out"
1891 .Dl "ipfw add pipe 2 ip from any to any in"
1892 .Dl "ipfw pipe 1 config delay 250ms bw 1Mbit/s"
1893 .Dl "ipfw pipe 2 config delay 250ms bw 1Mbit/s"
1895 Per-flow queueing can be useful for a variety of purposes.
1896 A very simple one is counting traffic:
1898 .Dl "ipfw add pipe 1 tcp from any to any"
1899 .Dl "ipfw add pipe 1 udp from any to any"
1900 .Dl "ipfw add pipe 1 ip from any to any"
1901 .Dl "ipfw pipe 1 config mask all"
1903 The above set of rules will create queues (and collect
1904 statistics) for all traffic.
1905 Because the pipes have no limitations, the only effect is
1906 collecting statistics.
1907 Note that we need 3 rules, not just the last one, because
1910 tries to match IP packets it will not consider ports, so we
1911 would not see connections on separate ports as different
1914 A more sophisticated example is limiting the outbound traffic
1915 on a net with per-host limits, rather than per-network limits:
1917 .Dl "ipfw add pipe 1 ip from 192.168.2.0/24 to any out"
1918 .Dl "ipfw add pipe 2 ip from any to 192.168.2.0/24 in"
1919 .Dl "ipfw pipe 1 config mask src-ip 0x000000ff bw 200Kbit/s queue 20Kbytes"
1920 .Dl "ipfw pipe 2 config mask dst-ip 0x000000ff bw 200Kbit/s queue 20Kbytes"
1922 To add a set of rules atomically, e.g. set 18:
1924 .Dl "ipfw disable set 18"
1925 .Dl "ipfw add NN set 18 ... # repeat as needed"
1926 .Dl "ipfw enable set 18"
1928 To delete a set of rules atomically the command is simply:
1930 .Dl "ipfw delete set 18"
1932 To test a ruleset and disable it and regain control if something goes wrong:
1934 .Dl "ipfw disable set 18"
1935 .Dl "ipfw add NN set 18 ... # repeat as needed"
1936 .Dl "ipfw enable set 18 ; echo done; sleep 30 && ipfw disable set 18"
1938 Here if everything goes well, you press control-C before the "sleep"
1939 terminates, and your ruleset will be left active. Otherwise, e.g. if
1940 you cannot access your box, the ruleset will be disabled after
1941 the sleep terminates thus restoring the previous situation.
1959 utility first appeared in
1964 Stateful extensions were introduced in
1967 was introduced in Summer 2002.
1969 .An Ugen J. S. Antsilevich ,
1970 .An Poul-Henning Kamp ,
1976 API based upon code written by
1982 traffic shaper supported by Akamba Corp.
1984 The syntax has grown over the years and sometimes it might be confusing.
1985 Unfortunately, backward compatibility prevents cleaning up mistakes
1986 made in the definition of the syntax.
1990 Misconfiguring the firewall can put your computer in an unusable state,
1991 possibly shutting down network services and requiring console access to
1992 regain control of it.
1994 Incoming packet fragments diverted by
1998 are reassembled before delivery to the socket.
1999 The action used on those packet is the one from the
2000 rule which matches the first fragment of the packet.
2002 Packets that match a
2004 rule should not be immediately accepted, but should continue
2005 going through the rule list.
2006 This may be fixed in a later version.
2008 Packets diverted to userland, and then reinserted by a userland process
2011 will lose various packet attributes, including their source interface.
2012 If a packet is reinserted in this manner, later rules may be incorrectly
2013 applied, making the order of
2015 rules in the rule sequence very important.