{"id":4610,"date":"2022-12-20T18:09:16","date_gmt":"2022-12-20T21:09:16","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/shorewallmangle-man5\/"},"modified":"2022-12-20T18:09:16","modified_gmt":"2022-12-20T21:09:16","slug":"shorewallmangle-man5","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/shorewallmangle-man5\/","title":{"rendered":"SHOREWALL&minus;MANGLE (man5)"},"content":{"rendered":"<h1 align=\"center\">SHOREWALL\u2212MANGLE<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#EXAMPLE\">EXAMPLE<\/a><br \/> <a href=\"#FILES\">FILES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">mangle \u2212 Shorewall Packet marking\/mangling rules file<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"37%\">\n<p style=\"margin-top: 1em\"><b>\/etc\/shorewall[6]\/mangle<\/b><\/p>\n<\/td>\n<td width=\"52%\"> <\/td>\n<\/tr>\n<\/table>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This file was introduced in Shorewall 4.6.0 and replaces <b><font color=\"#0000FF\">shorewall\u2212tcrules(5)<\/font><\/b> <small><font color=\"#000000\">[1]<\/font><\/small> <font color=\"#000000\">. This file is only processed by the compiler if:<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">Entries in this file cause packets to be marked as a means of classifying them for traffic control or policy routing.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b><big>Important<\/big><\/b> <br \/> Unlike rules in the<\/font> <b><font color=\"#0000FF\">shorewall\u2212rules<\/font><\/b> <small><font color=\"#000000\">[2]<\/font><\/small> <font color=\"#000000\">(5) file, evaluation of rules in this file will continue after a match. So the final mark for each packet will be the one assigned by the LAST tcrule that matches.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">If you use multiple internet providers with the &#8216;track&#8217; option, in \/etc\/shorewall\/providers be sure to read the restrictions at<\/font> <b><font color=\"#0000FF\">https:\/\/shorewall.org\/MultiISP.html<\/font><\/b> <small><font color=\"#000000\">[3]<\/font><\/small> <font color=\"#000000\">.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">The columns in the file are as follows (where the column name is followed by a different name in parentheses, the different name is used in the alternate specification syntax).<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><b>ACTION<\/b> \u2212 <i>command<\/i>[(<i>parameters<\/i>)][:<i>chain\u2212designator<\/i>]<\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\">The <i>chain\u2212designator<\/i> indicates the Netfilter chain that the entry applies to and may be one of the following:<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">P<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">PREROUTING chain.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">F<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">FORWARD chain.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">T<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">POSTROUTING chain.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">I<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">INPUT chain.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">NP<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">PREROUTING chain in the nat table.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">NI<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">INPUT chain in the nat table.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">NO<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">OUTPUT chain in the nat table.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">NT<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">POSTROUTING chain in the nat table.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">The nat table designators were added in Shorewall 5.2.1. When a nat table designator is given, only the CONNMARK, MARK, SAVE and RESTORE commands may be used.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">Unless otherwise specified for the particular <i>command<\/i>, the default chain is PREROUTING when MARK_IN_FORWARD_CHAIN=No in<\/font> <b><font color=\"#0000FF\">shorewall.conf(5)<\/font><\/b> <small><font color=\"#000000\">[4]<\/font><\/small> <font color=\"#000000\">, and FORWARD when MARK_IN_FORWARD_CHAIN=Yes.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">A <i>chain\u2212designator<\/i> may not be specified if the SOURCE or DEST columns begin with &#8216;$FW&#8217;. When the SOURCE is $FW, the generated rule is always placed in the OUTPUT chain. If DEST is &#8216;$FW&#8217;, then the rule is placed in the INPUT chain. Additionally, a <i>chain\u2212designator<\/i> may not be specified in an action body.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">Where a command takes parameters, those parameters are enclosed in parentheses (&#8220;(&#8230;.)&#8221;) and separated by commas.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">The <i>command<\/i> may be one of the following.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><i>action<\/i><b>[([<\/b><i>param<\/i><b>[,&#8230;])]<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Added in Shorewall 5.0.7. <i>action<\/i> must be an action declared with the <b>mangle<\/b> option in<\/font> <b><font color=\"#0000FF\">shorewall\u2212actions(5)<\/font><\/b> <small><font color=\"#000000\">[5]<\/font><\/small> <font color=\"#000000\">. If the action accepts parameters, they are specified as a comma\u2212separated list within parentheses following the <i>action<\/i> name.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>ADD(<\/b><i>ipset<\/i><b>:<\/b><i>flags<\/i><b>)<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Added in Shorewall 4.6.7. Causes addresses and\/or port numbers to be added to the named <i>ipset<\/i>. The <i>flags<\/i> specify the address or tuple to be added to the set and must match the type of ipset involved. For example, for an iphash ipset, either the SOURCE or DESTINATION address can be added using <i>flags<\/i> <b>src<\/b> or <b>dst<\/b> respectively (see the \u2212A command in ipset (8)).<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">ADD is non\u2212terminating. Even if a packet matches the rule, it is passed on to the next rule.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>CHECKSUM<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Compute and fill in the checksum in a packet that lacks a checksum. This is particularly useful if you need to work around old applications, such as dhcp clients, that do not work well with checksum offloads, but you don&#8217;t want to disable checksum offload in your device.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">Requires &#8216;Checksum Target&#8217; support in your kernel and iptables.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>CLASSIFY(<\/b><i>classid<\/i><b>)<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">A classification Id (classid) is of the form <i>major<\/i>:<i>minor<\/i> where <i>major<\/i> and <i>minor<\/i> are integers. Corresponds to the &#8216;class&#8217; specification in these traffic shaping modules:<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\">atm <br \/> cbq <br \/> dsmark <br \/> pfifo_fast <br \/> htb <br \/> prio<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">Classification occurs in the POSTROUTING chain except when the <b>SOURCE<\/b> is <b>$FW<\/b>[:<i>address<\/i>] in which case classification occurs in the OUTPUT chain.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">When using Shorewall&#8217;s built\u2212in traffic shaping tool, the <i>major<\/i> class is the device number (the first device in<\/font> <b><font color=\"#0000FF\">shorewall\u2212tcdevices<\/font><\/b> <small><font color=\"#000000\">[6]<\/font><\/small> <font color=\"#000000\">(5) is major class 1, the second device is major class 2, and so on) and the <i>minor<\/i> class is the class&#8217;s MARK value in<\/font> <b><font color=\"#0000FF\">shorewall\u2212tcclasses<\/font><\/b> <small><font color=\"#000000\">[7]<\/font><\/small> <font color=\"#000000\">(5) preceded by the number 1 (MARK 1 corresponds to minor class 11, MARK 5 corresponds to minor class 15, MARK 22 corresponds to minor class 122, etc.).<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>?COMMENT<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">The rest of the line will be attached as a comment to the Netfilter rule(s) generated by the following entries. The comment will appear delimited by &#8220;\/* &#8230; *\/&#8221; in the output of <b>shorewall show mangle<\/b><\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">To stop the comment from being attached to further rules, simply include ?COMMENT on a line by itself.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>CONMARK({mark|range})<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Identical to MARK with the exception that the mark is assigned to connection to which the packet belongs is marked rather than to the packet itself.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>CONTINUE<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Don&#8217;t process any more marking rules in the table.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">Currently, CONTINUE may not be used with <i>exclusion<\/i> (see the SOURCE and DEST columns below); that restriction will be removed when iptables\/Netfilter provides the necessary support.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>DEL(<\/b><i>ipset<\/i><b>:<\/b><i>flags<\/i><b>)<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Added in Shorewall 4.6.7. Causes an entry to be deleted from the named <i>ipset<\/i>. The <i>flags<\/i> specify the address or tuple to be deleted from the set and must match the type of ipset involved. For example, for an iphash ipset, either the SOURCE or DESTINATION address can be deleted using <i>flags<\/i> <b>src<\/b> or <b>dst<\/b> respectively (see the \u2212D command in ipset (8)).<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">DEL is non\u2212terminating. Even if a packet matches the rule, it is passed on to the next rule.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>DIVERT<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Two DIVERT rule should precede the TPROXY rule and should select DEST PORT tcp 80 and SOURCE PORT tcp 80 respectively (assuming that tcp port 80 is being proxied). DIVERT avoids sending packets to the TPROXY target once a socket connection to Squid3 has been established by TPROXY. DIVERT marks the packet with a unique mark and exempts it from any rules that follow.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>DIVERTHA<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Added in Shorewall 5.0.4. To setup the HAProxy configuration described at<\/font> <b><font color=\"#0000FF\">http:\/\/www.loadbalancer.org\/blog\/setting\u2212up\u2212haproxy\u2212with\u2212transparent\u2212mode\u2212on\u2212centos\u22126\u2212x<\/font><\/b><font color=\"#000000\">, place this entry in<\/font> <b><font color=\"#0000FF\">shorewall\u2212providers(5)<\/font><\/b> <small><font color=\"#000000\">[8]<\/font><\/small> <font color=\"#000000\">:<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\">#NAME NUMBER MARK DUPLICATE INTERFACE GATEWAY OPTIONS COPY <br \/> TProxy 1 \u2212 \u2212 lo \u2212 tproxy<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">and use this DIVERTHA entry:<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\">#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST LENGTH TOS CONNBYTES HELPER PROBABILITY DSCP <br \/> DIVERTHA \u2212 \u2212 tcp<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>DROP<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Causes matching packets to be discarded.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>DSCP<\/b>(<i>dscp<\/i>)<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Sets the Differentiated Services Code Point field in the IP header. The <i>dscp<\/i> value may be given as an even number (hex or decimal) or as the name of a DSCP class. Valid class names and their associated hex numeric values are:<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\">CS0 => 0x00 <br \/> CS1 => 0x08 <br \/> CS2 => 0x10 <br \/> CS3 => 0x18 <br \/> CS4 => 0x20 <br \/> CS5 => 0x28 <br \/> CS6 => 0x30 <br \/> CS7 => 0x38 <br \/> BE => 0x00 <br \/> AF11 => 0x0a <br \/> AF12 => 0x0c <br \/> AF13 => 0x0e <br \/> AF21 => 0x12 <br \/> AF22 => 0x14 <br \/> AF23 => 0x16 <br \/> AF31 => 0x1a <br \/> AF32 => 0x1c <br \/> AF33 => 0x1e <br \/> AF41 => 0x22 <br \/> AF42 => 0x24 <br \/> AF43 => 0x26 <br \/> EF => 0x2e<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">To indicate more than one class, add their hex values together and specify the result. By default, DSCP rules are placed in the POSTROUTING chain.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>ECN<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Added in Shorewall 5.0.6 as an alternative to entries in<\/font> <b><font color=\"#0000FF\">shorewall\u2212ecn(5)<\/font><\/b> <small><font color=\"#000000\">[9]<\/font><\/small> <font color=\"#000000\">. If a PROTO is specified, it must be &#8216;tcp&#8217; (6). If no PROTO is supplied, TCP is assumed. This action causes all ECN bits in the TCP header to be cleared.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>IMQ<\/b>(<i>number<\/i>)<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Specifies that the packet should be passed to the IMQ identified by <i>number<\/i>. Requires IMQ Target support in your kernel and iptables.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>INLINE<\/b>[(<i>action<\/i>)]<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Allows you to place your own ip[6]tables matches at the end of the line following a semicolon (&#8220;;&#8221;) (deprecated) or two semicolons (&#8220;;;&#8221;) (preferred since Shoreall 5.0.0). If an <i>action<\/i> is specified, the compiler proceeds as if that <i>action<\/i> had been specified in this column. If no action is specified, then you may include your own jump (&#8220;\u2212j <i>target<\/i> [<i>option<\/i>] &#8230;&#8221;) after any matches specified at the end of the rule. If the target is not one known to Shorewall, then it must be defined as a builtin action in<\/font> <b><font color=\"#0000FF\">shorewall\u2212actions<\/font><\/b> <small><font color=\"#000000\">[10]<\/font><\/small> <font color=\"#000000\">(5).<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">The following rules are equivalent:<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\">2:P eth0 \u2212 tcp 22 <br \/> INLINE(MARK(2)):P eth0 \u2212 tcp 22 <br \/> INLINE(MARK(2)):P eth0 \u2212 ;; \u2212p tcp <br \/> INLINE eth0 \u2212 tcp 22 ;; \u2212j MARK \u2212\u2212set\u2212mark 2 <br \/> INLINE eth0 \u2212 ;; \u2212p tcp \u2212j MARK \u2212\u2212set\u2212mark 2<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>IPMARK<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Assigns a mark to each matching packet based on the either the source or destination IP address. By default, it assigns a mark value equal to the low\u2212order 8 bits of the source address. Default values are:<\/font><\/p>\n<p style=\"margin-left:29%;\"><font color=\"#000000\">src <i><br \/> mask1<\/i> = 0xFF <i><br \/> mask2<\/i> = 0x00 <i><br \/> shift<\/i> = 0<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">&#8216;src&#8217; and &#8216;dst&#8217; specify whether the mark is to be based on the source or destination address respectively. The selected address is first shifted to the right by <i>shift<\/i> bits. The result is then LANDed with <i>mask1<\/i> then LORed with <i>mask2<\/i>.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">In a sense, the IPMARK target is more like an IPCLASSIFY target in that the mark value is later interpreted as a class ID. A packet mark is 32 bits wide; so is a class ID. The <major> class occupies the high\u2212order 16 bits and the <minor> class occupies the low\u2212order 16 bits. So the class ID 1:4ff (remember that class IDs are always in hex) is equivalent to a mark value of 0x104ff. Remember that Shorewall uses the interface number as the <major> number where the first interface in tcdevices has <major> number 1, the second has <major> number 2, and so on.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">The IPMARK target assigns a mark to each matching packet based on the either the source or destination IP address. By default, it assigns a mark value equal to the low\u2212order 8 bits of the source address. The syntax is as follows: <b>IPMARK<\/b>[([{<b>src<\/b>|<b>dst<\/b>}][,[<i>mask1<\/i>][,[<i>mask2<\/i>][,[<i>shift<\/i>]]]])] Default values are:<\/font><\/p>\n<p style=\"margin-left:29%;\"><font color=\"#000000\"><b>src<\/b> <i><br \/> mask1<\/i> = 0xFF <i><br \/> mask2<\/i> = 0x00 <i><br \/> shift<\/i> = 0<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><b>src<\/b> and <b>dst<\/b> specify whether the mark is to be based on the source or destination address respectively. The selected address is first shifted right by <i>shift<\/i>, then LANDed with <i>mask1<\/i> and then LORed with <i>mask2<\/i>. The <i>shift<\/i> argument is intended to be used primarily with IPv6 addresses.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">Example: IPMARK(src,0xff,0x10100)<\/font><\/p>\n<p style=\"margin-left:29%;\"><font color=\"#000000\">Suppose that the source IP address is 192.168.4.3 <br \/> = 0xc0a80403; then <br \/> 0xc0a80403 >> 0 = 0xc0a80403 <br \/> 0xc0a80403 LAND 0xFF = 0x03 <br \/> 0x03 LOR 0x10100 = 0x10103 or class ID <br \/> 1:103<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">It is important to realize that, while class IDs are composed of a <i>major<\/i> and a <i>minor<\/i> value, the set of values must be unique. That is, the same numeric value cannot be used as both a <i>major<\/i> and a <i>minor<\/i> number for the same interface unless class nesting occurs (which is not currently possible with Shorewall). You should keep this in mind when deciding how to map IP addresses to class IDs.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">For example, suppose that your internal network is 192.168.1.0\/29 (host IP addresses 192.168.1.1 \u2212 192.168.1.6). Your first notion might be to use IPMARK(src,0xFF,0x10000) so as to produce class IDs 1:1 through 1:6. But 1:1 is an invalid class ID since the <i>major<\/i> and <i>minor<\/i> classes are equal. So you might choose instead to use IPMARK(src,0xFF,0x10100) as in the example above so that all of your <i>minor<\/i> classes will have a value > 256.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>IP6TABLES({<\/b><i>target<\/i> <b>[<\/b><i>option<\/i> <b>&#8230;])<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">IPv6 only.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">This action allows you to specify an iptables target with options (e.g., &#8216;IP6TABLES(MARK \u2212\u2212set\u2212xmark 0x01\/0xff)&#8217;. If the target is not one recognized by Shorewall, the following error message will be issued:<\/font><\/p>\n<p style=\"margin-left:29%;\"><font color=\"#000000\">ERROR: Unknown target <br \/> (<i>target<\/i>)<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">This error message may be eliminated by adding the <i>target<\/i> as a builtin action in<\/font> <b><font color=\"#0000FF\">shorewall\u2212actions(5)<\/font><\/b> <small><font color=\"#000000\">[10]<\/font><\/small> <font color=\"#000000\">.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>IPTABLES({<\/b><i>target<\/i> <b>[<\/b><i>option<\/i> <b>&#8230;])<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">IPv4 only.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">This action allows you to specify an iptables target with options (e.g., &#8216;IPTABLES(MARK \u2212\u2212set\u2212xmark 0x01\/0xff)&#8217;. If the target is not one recognized by Shorewall, the following error message will be issued:<\/font><\/p>\n<p style=\"margin-left:29%;\"><font color=\"#000000\">ERROR: Unknown target <br \/> (<i>target<\/i>)<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">This error message may be eliminated by adding the <i>target<\/i> as a builtin action in<\/font> <b><font color=\"#0000FF\">shorewall\u2212actions(5)<\/font><\/b> <small><font color=\"#000000\">[10]<\/font><\/small> <font color=\"#000000\">.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>MARK({<\/b><i>mark<\/i><b>|<\/b><i>range<\/i><b>})<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">where <i>mark<\/i> is a packet mark value.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">Normally will set the mark value. If preceded by a vertical bar (&#8220;|&#8221;), the mark value will be logically ORed with the current mark value to produce a new mark value. If preceded by an ampersand (&#8220;&#038;&#8221;), will be logically ANDed with the current mark value to produce a new mark value.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">Both &#8220;|&#8221; and &#8220;&#038;&#8221; require Extended MARK Target support in your kernel and iptables.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">The mark value may be optionally followed by &#8220;\/&#8221; and a mask value (used to determine those bits of the connection mark to actually be set). When a mask is specified, the result of logically ANDing the mark value with the mask must be the same as the mark value.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">A mark <i>range<\/i> is a pair of integers separated by a dash (&#8220;\u2212&#8221;).<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">May be optionally followed by a slash (&#8220;\/&#8221;) and a mask and requires the Statistics Match capability in iptables and kernel. Marks in the specified range are assigned to packets on a round\u2212robin fashion.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">When a mask is specified, the result of logically ANDing each mark value with the mask must be the same as the mark value. The least significant bit in the mask is used as an increment. For example, if &#8216;0x200\u22120x400\/0xff00&#8217; is specified, then the assigned mark values are 0x200, 0x300 and 0x400 in equal proportions. If no mask is specified, then ( 2 bodies manpages.csv script_extrae_body.sh script.sh usr MASK_BITS ) \u2212 1 is assumed (MASK_BITS is set in<\/font> <b><font color=\"#0000FF\">shorewall.conf<\/font><\/b> <small><font color=\"#000000\">[4]<\/font><\/small> <font color=\"#000000\">(5)).<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>NFLOG<\/b>[(<i>nflog\u2212parameters<\/i>)]<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Added in Shorewall 5.0.9. Logs matching packets using NFLOG. The <i>nflog\u2212parameters<\/i> are a comma\u2212separated list of up to 3 numbers:<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\">\u2022 The first number specifies the netlink group (0\u221265535). If omitted (e.g., NFLOG(,0,10)) then a value of 0 is assumed.<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\">\u2022 The second number specifies the maximum number of bytes to copy. If omitted, 0 (no limit) is assumed.<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\">\u2022 The third number specifies the number of log messages that should be buffered in the kernel before they are sent to user space. The default is 1.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>RESTORE<\/b>[(<i>mask<\/i>)]<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Restore the packet&#8217;s mark from the connection&#8217;s mark using the supplied mask if any. Your kernel and iptables must include CONNMARK support.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>SAME[(<\/b><i>timeout<\/i><b>)]<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Some websites run applications that require multiple connections from a client browser. Where multiple &#8216;balanced&#8217; providers are configured, this can lead to problems when some of the connections are routed through one provider and some through another. The SAME target allows you to work around that problem. SAME may be used in the PREROUTING and OUTPUT chains. When used in PREROUTING, it causes matching connections from an individual local system to all use the same provider. For example:<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\">#ACTION SOURCE DEST PROTO DPORT <br \/> SAME:P 192.168.1.0\/24 0.0.0.0\/0 tcp 80,443<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">If a host in 192.168.1.0\/24 attempts a connection on TCP port 80 or 443 and it has sent a packet on either of those ports in the last five minutes then the new connection will use the same provider as the connection over which that last packet was sent.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">When used in the OUTPUT chain, it causes all matching connections to an individual remote system to all use the same provider. For example:<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\">#ACTION SOURCE DEST PROTO DPORT <br \/> SAME $FW 0.0.0.0\/0 tcp 80,443<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">The optional <i>timeout<\/i> parameter was added in Shorewall 4.6.7 and specifies a number of seconds . When not specified, a value of 300 seconds (5 minutes) is assumed. If the firewall attempts a connection on TCP port 80 or 443 and it has sent a packet on either of those ports in the last <i>timeout<\/i> seconds to the same remote system then the new connection will use the same provider as the connection over which that last packet was sent.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>SAVE[(<\/b><i>mask)<\/i><b>]<\/b><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Save the packet&#8217;s mark to the connection&#8217;s mark using the supplied mask if any. Your kernel and iptables must include CONNMARK support.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>TCPMSS<\/b>([<i>mss<\/i>[,<i>ipsec<\/i>]])<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Added in Shorewall 5.1.9. This target only applies to TCP traffic and alters the MSS value in SYN packets. It may be used in the FORWARD and POSTROUTING chains; the default is FORWARD.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">The <i>mss<\/i> parameter may be either <b>pmtu<\/b> or an integer in the range 500:65533. The value <b>pmtu<\/b> automatically clamps the MSS value to (path_MTU \u2212 40 for IPv4; \u221260 for IPv6). This may not function as desired where asymmetric routes with differing path MTU exist \u2014 the kernel uses the path MTU which it would use to send packets from itself to the source and destination IP addresses. Prior to Linux 2.6.25, only the path MTU to the destination IP address was considered by this option; subsequent kernels also consider the path MTU to the source IP address. If an integer is given, the MSS option is set to the specified value. If the MSS of the packet is already lower than <i>mss<\/i>, it will not be increased (from Linux 2.6.25 onwards) to avoid more problems with hosts relying on a proper MSS. If <i>mss<\/i> is omitted, <b>pmtu<\/b> is assumed.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">The <i>ipsec<\/i> parameter determines whether the rule applies to IPSEC traffic (<b>ipsec<\/b> is passed), non\u2212IPSEC traffic (<b>none<\/b> is passed) or both (<b>all<\/b> is passed). If omitted, <b>all<\/b> is assumed.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>TOS<\/b>(<i>tos<\/i>[\/<i>mask<\/i>])<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Sets the Type of Service field in the IP header. The <i>tos<\/i> value may be given as an number (hex or decimal) or as the name of a TOS type. Valid type names and their associated hex numeric values are:<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\">Minimize\u2212Delay => 0x10, <br \/> Maximize\u2212Throughput => 0x08, <br \/> Maximize\u2212Reliability => 0x04, <br \/> Minimize\u2212Cost => 0x02, <br \/> Normal\u2212Service => 0x00<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">To indicate more than one class, add their hex values together and specify the result.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">When <i>tos<\/i> is given as a number, it may be optionally followed by &#8216;\/&#8217; and a <i>mask<\/i>. When no <i>mask<\/i> is given, the value 0xff is assumed. When <i>tos<\/i> is given as a type name, the <i>mask<\/i> 0x3f is assumed.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">The action performed is to zero out the bits specified by the <i>mask<\/i>, then set the bits specified by <i>tos<\/i>.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>TPROXY<\/b>([<i>port<\/i>[,<i>address<\/i>]])<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Transparently redirects a packet without altering the IP header. Requires a tproxy provider to be defined in<\/font> <b><font color=\"#0000FF\">shorewall\u2212providers<\/font><\/b> <small><font color=\"#000000\">[8]<\/font><\/small> <font color=\"#000000\">(5).<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">There are three parameters to TPROXY \u2212 neither is required:<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\">\u2022 <i>port<\/i> \u2212 the port on which the proxy server is listening. If omitted, the original destination port.<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\">\u2022 <i>address<\/i> \u2212 a local (to the firewall) IP address on which the proxy server is listening. If omitted, the IP address of the interface on which the request arrives.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><b>TTL<\/b>([<b>\u2212<\/b>|<b>+<\/b>]<i>number<\/i>)<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">If <b>+<\/b> is included, packets matching the rule will have their TTL incremented by <i>number<\/i>. Similarly, if <b>\u2212<\/b> is included, matching packets have their TTL decremented by <i>number<\/i>. If neither <b>+<\/b> nor <b>\u2212<\/b> is given, the TTL of matching packets is set to <i>number<\/i>. The valid range of values for <i>number<\/i> is 1\u2212255.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><b>SOURCE \u2212 {\u2212|<\/b><i>source\u2212spec<\/i><b>[,&#8230;]}<\/b><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\">where <i>source\u2212spec<\/i> is one of:<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">[!]<i>interface<\/i><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">where <i>interface<\/i> is the logical name of an <i>interface<\/i> defined in<\/font> <b><font color=\"#0000FF\">shorewall\u2212interfaces<\/font><\/b> <small><font color=\"#000000\">[11]<\/font><\/small> <font color=\"#000000\">(5). Matches packets entering the firewall from the named interface. May not be used in CLASSIFY rules or in rules using the :T chain qualifier.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">Beginning with Shorweall 5.2.1, the <i>interface<\/i> may be preceded with &#8216;!&#8217; which matches all interfaces except the one specified.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><i>address<\/i>[,&#8230;][<i>exclusion<\/i>]<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">where <i>address<\/i> is: A host or network IP address.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">The name of an ipset preceded by a plus sign (&#8220;+&#8221;).<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">A MAC address in Shorewall format (preceded by a tilde (&#8220;~&#8221;) and using dash (&#8220;\u2212&#8221;) as a separator (e.g., ~00\u2212A0\u2212C9\u221215\u221239\u221278). Matches traffic whose source IP address matches one of the listed addresses and that does not match an address listed in the <i>exclusion<\/i> (see<\/font> <b><font color=\"#0000FF\">shorewall\u2212exclusion<\/font><\/b> <small><font color=\"#000000\">[12]<\/font><\/small> <font color=\"#000000\">(5)).<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\"><b>This form will not match traffic that originates on the firewall itself unless either <major><minor> or the :T chain qualifier is used in the ACTION column.<\/b><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">[!]<i>interface<\/i>:<i>address<\/i>,[&#8230;][<i>exclusion<\/i>]<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">This form combines the preceding two forms and matches when both the incoming interface and source IP address match.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">Beginning with Shorweall 5.2.1, the <i>interface<\/i> may be preceded with &#8216;!&#8217; which matches all interfaces except the one specified.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">[!]<i>interface<\/i>:<i>exclusion<\/i><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">This form matches packets arriving through the named <i>interface<\/i> and whose source IP address does not match any of the addresses in the <i>exclusion<\/i>.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">Beginning with Shorweall 5.2.1, the <i>interface<\/i> may be preceded with &#8216;!&#8217; which matches all interfaces except the one specified.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">$FW<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Matches packets originating on the firewall system. May not be used with a chain qualifier (:P, :F, etc.) in the ACTION column.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">$FW:<i>address<\/i>[,&#8230;][<i>exclusion<\/i>]<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">where <i>address<\/i> is as above (MAC addresses are not permitted). Matches packets originating on the firewall and whose source IP address matches one of the listed addresses and does not match any address listed in the <i>exclusion<\/i>. May not be used with a chain qualifier (:P, :F, etc.) in the ACTION column.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">$FW:<i>exclusion<\/i><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Matches traffic originating on the firewall, provided that the source IP address does not match any address listed in the <i>exclusion<\/i>.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">Beginning with Shorewall 5.1.0, multiple <i>source_spec<\/i>s, separated by commas, may be given provided that the following alternative forms are used: (<i>address<\/i>[,&#8230;][<i>exclusion<\/i>])<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><i>interface<\/i>\ud83d\ude41<i>address<\/i>[,&#8230;][<i>exclusion<\/i>])<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><i>interface<\/i>\ud83d\ude41<i>exclusion<\/i>)<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">$FW:(<i>address<\/i>[,&#8230;][<i>exclusion<\/i>])<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">$FW:(<i>exclusion<\/i>)<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><b>DEST \u2212 {\u2212|<\/b><i>dest\u2212spec<\/i><b>[,&#8230;]}<\/b><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\">where <i>dest\u2212spec<\/i> is one of:<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><i>interface<\/i><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">where <i>interface<\/i> is the logical name of an interface defined in<\/font> <b><font color=\"#0000FF\">shorewall\u2212interfaces<\/font><\/b> <small><font color=\"#000000\">[11]<\/font><\/small> <font color=\"#000000\">(5). Matches packets leaving the firewall through the named interface. May not be used in the PREROUTING chain (:P in the mark column or no chain qualifier and MARK_IN_FORWARD_CHAIN=No in<\/font> <b><font color=\"#0000FF\">shorewall.conf<\/font><\/b> <font color=\"#000000\">(5)).<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><i>address<\/i>[,&#8230;][<i>exclusion<\/i>]<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">where <i>address<\/i> is: A host or network IP address.<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">The name of an ipset preceded by a plus sign (&#8220;+&#8221;).<\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\">A MAC address in Shorewall format (preceded by a tilde (&#8220;~&#8221;) and using dash (&#8220;\u2212&#8221;) as a separator (e.g., ~00\u2212A0\u2212C9\u221215\u221239\u221278). Matches traffic whose destination IP address matches one of the listed addresses and that does not match an address listed in the <i>exclusion<\/i> (see<\/font> <b><font color=\"#0000FF\">shorewall\u2212exclusion<\/font><\/b> <small><font color=\"#000000\">[12]<\/font><\/small> <font color=\"#000000\">(5)).<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><i>interface<\/i>:<i>address<\/i>,[&#8230;][<i>exclusion<\/i>]<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">This form combines the preceding two forms and matches when both the outgoing interface and destination IP address match. May not be used in the PREROUTING chain (:P in the mark column or no chain qualifier and MARK_IN_FORWARD_CHAIN=No in<\/font> <b><font color=\"#0000FF\">shorewall.conf<\/font><\/b> <font color=\"#000000\">(5)).<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><i>interface<\/i>:<i>exclusion<\/i><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">This form matches packets leaving through the named <i>interface<\/i> and whose destination IP address does not match any of the addresses in the <i>exclusion<\/i>. May not be used in the PREROUTING chain (:P in the mark column or no chain qualifier and MARK_IN_FORWARD_CHAIN=No in<\/font> <b><font color=\"#0000FF\">shorewall.conf<\/font><\/b> <font color=\"#000000\">(5)).<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">$FW<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Matches packets originating on the firewall system. May not be used with a chain qualifier (:P, :F, etc.) in the ACTION column.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">$FW:<i>address<\/i>[,&#8230;][<i>exclusion<\/i>]<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">where <i>address<\/i> is as above (MAC addresses are not permitted). Matches packets destined for the firewall and whose destination IP address matches one of the listed addresses and does not match any address listed in the <i>exclusion<\/i>. May not be used with a chain qualifier (:P, :F, etc.) in the ACTION column.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">$FW:<i>exclusion<\/i><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">Matches traffic destined for the firewall, provided that the destination IP address does not match any address listed in the <i>exclusion<\/i>.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">Beginning with Shorewall 5.1.0, multiple <i>dest_spec<\/i>s, separated by commas, may be given provided that the following alternative forms are used: (<i>address<\/i>[,&#8230;][<i>exclusion<\/i>])<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><i>interface<\/i>\ud83d\ude41<i>address<\/i>[,&#8230;][<i>exclusion<\/i>])<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><i>interface<\/i>\ud83d\ude41<i>exclusion<\/i>)<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">$FW:(<i>address<\/i>[,&#8230;][<i>exclusion<\/i>])<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">$FW:(<i>exclusion<\/i>)<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><b>PROTO<\/b> \u2212 {<b>\u2212<\/b>|<b>{tcp:[!]syn<\/b>|<b>ipp2p<\/b>|<b>ipp2p:udp<\/b>|<b>ipp2p:all<\/b>|<i>protocol\u2212number<\/i>|<i>protocol\u2212name<\/i>|<b>all}[,&#8230;]}<\/b><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\">See<\/font> <b><font color=\"#0000FF\">shorewall\u2212rules(5)<\/font><\/b> <small><font color=\"#000000\">[2]<\/font><\/small> <font color=\"#000000\">for details.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">Beginning with Shorewall 4.5.12, this column can accept a comma\u2212separated list of protocols.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><b>DPORT<\/b>\u2212 {<b>\u2212<\/b>|<i>port\u2212name\u2212number\u2212or\u2212range<\/i>[<b>,<\/b><i>port\u2212name\u2212number\u2212or\u2212range<\/i>]&#8230;|+<i>ipset<\/i>}<\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\">Optional destination Ports. A comma\u2212separated list of Port names (from services(5)), <i>port number<\/i>s or <i>port range<\/i>s; if the protocol is <b>icmp<\/b>, this column is interpreted as the destination icmp\u2212type(s). ICMP types may be specified as a numeric type, a numeric type and code separated by a slash (e.g., 3\/4), or a typename. See<\/font> <b><font color=\"#0000FF\">https:\/\/shorewall.org\/configuration_file_basics.htm#ICMP<\/font><\/b> <small><font color=\"#000000\">[13]<\/font><\/small> <font color=\"#000000\">.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">If the protocol is <b>ipp2p<\/b>, this column is interpreted as an ipp2p option without the leading &#8220;\u2212\u2212&#8221; (example <b>bit<\/b> for bit\u2212torrent). If no PORT is given, <b>ipp2p<\/b> is assumed.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">An entry in this field requires that the PROTO column specify icmp (1), tcp (6), udp (17), sctp (132) or udplite (136). Use &#8216;\u2212&#8217; if any of the following field is supplied.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">Beginning with Shorewall 4.6.0, an <i>ipset<\/i> name can be specified in this column. This is intended to be used with bitmap:port ipsets.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">This column was formerly named DEST PORT(S).<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><b>SPORT<\/b> \u2212 {<b>\u2212<\/b>|<i>port\u2212name\u2212number\u2212or\u2212range<\/i>[<b>,<\/b><i>port\u2212name\u2212number\u2212or\u2212range<\/i>]&#8230;|+<i>ipset<\/i>}<\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\">Optional source port(s). If omitted, any source port is acceptable. Specified as a comma\u2212separated list of port names, port numbers or port ranges.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">An entry in this field requires that the PROTO column specify tcp (6), udp (17), sctp (132) or udplite (136). Use &#8216;\u2212&#8217; if any of the following fields is supplied.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">Beginning with Shorewall 4.5.15, you may place &#8216;=&#8217; in this column, provided that the DPORT column is non\u2212empty. This causes the rule to match when either the source port or the destination port in a packet matches one of the ports specified in DEST PORTS(S). Use of &#8216;=&#8217; requires multi\u2212port match in your iptables and kernel.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">Beginning with Shorewall 4.6.0, an <i>ipset<\/i> name can be specified in this column. This is intended to be used with bitmap:port ipsets.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">This column was formerly labelled SOURCE PORT(S).<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><b>USER<\/b> \u2212 [<b>!<\/b>][<i>user\u2212name\u2212or\u2212number<\/i>][<b>:<\/b><i>group\u2212name\u2212or\u2212number<\/i>][<b>+<\/b><i>program\u2212name<\/i>]<\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\">This optional column may only be non\u2212empty if the SOURCE is the firewall itself.<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">When this column is non\u2212empty, the rule applies only if the program generating the output is running under the effective <i>user<\/i> and\/or <i>group<\/i> specified (or is NOT running under that id if &#8220;!&#8221; is given).<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">Examples:<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">joe<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">program must be run by joe<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">:kids<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">program must be run by a member of the &#8216;kids&#8217; group<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">!:kids<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">program must not be run by a member of the &#8216;kids&#8217; group<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">+upnpd<\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\">#program named upnpd<\/font><\/p>\n<p style=\"margin-left:29%; margin-top: 1em\"><font color=\"#000000\"><b><big>Important<\/big><\/b> <br \/> The ability to specify a program name was removed from Netfilter in kernel version 2.6.14.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><b><big>TEST<\/big><\/b> <big>\u2212 [<b>!<\/b>]<i>value<\/i>[\/<i>mask<\/i>][<b>:C<\/b>]<\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>Optional \u2212 Defines a test on the existing packet or connection mark. The rule will match only if the test returns true.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>If you don&#8217;t want to define a test but need to specify anything in the following columns, place a &#8220;\u2212&#8221; in this field.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>!<\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>Inverts the test (not equal)<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big><i>value<\/i><\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>Value of the packet or connection mark.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big><i>mask<\/i><\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>A mask to be applied to the mark before testing.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big><b>:C<\/b><\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>Designates a connection mark. If omitted, the packet mark&#8217;s value is tested.<\/big><\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big><b>LENGTH<\/b> \u2212 [<i>length<\/i>|[<i>min<\/i>]<b>:<\/b>[<i>max<\/i>]]<\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>Optional \u2212 packet payload length. This field, if present allow you to match the length of a packet payload (Layer 4 data ) against a specific value or range of values. You must have iptables length support for this to work. A range is specified in the form <i>min<\/i>:<i>max<\/i> where either <i>min<\/i> or <i>max<\/i> (but not both) may be omitted. If <i>min<\/i> is omitted, then 0 is assumed; if <i>max<\/i> is omitted, than any packet that is <i>min<\/i> or longer will match.<\/big><\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big><b>TOS<\/b> \u2212 <i>tos<\/i><\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>Type of service. Either a standard name, or a numeric value to match.<\/big><\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\"><big><b>Minimize\u2212Delay<\/b> (16) <b><br \/> Maximize\u2212Throughput<\/b> (8) <b><br \/> Maximize\u2212Reliability<\/b> (4) <b><br \/> Minimize\u2212Cost<\/b> (2) <b><br \/> Normal\u2212Service<\/b> (0)<\/big><\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big><b>CONNBYTES<\/b> \u2212 [!]<i>min<\/i>:[<i>max<\/i>[:{<b>O<\/b>|<b>R<\/b>|<b>B<\/b>}[:{<b>B<\/b>|<b>P<\/b>|<b>A<\/b>}]]]<\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>Optional connection Bytes; defines a byte or packet range that the connection must fall within in order for the rule to match.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>A packet matches if the the packet\/byte count is within the range defined by <i>min<\/i> and <i>max<\/i> (unless ! is given in which case, a packet matches if the packet\/byte count is not within the range). <i>min<\/i> is an integer which defines the beginning of the byte\/packet range. <i>max<\/i> is an integer which defines the end of the byte\/packet range; if omitted, only the beginning of the range is checked. The first letter gives the direction which the range refers to:<b>O<\/b> \u2212 The original direction of the connection. .sp \u2212 The opposite direction from the original connection. .sp <b>B<\/b> \u2212 The total of both directions.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>If omitted, <b>B<\/b> is assumed.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>The second letter determines what the range refers to.<b>B<\/b> \u2212 Bytes .sp <b>P<\/b> \u2212 Packets .sp <b>A<\/b> \u2212 Average packet size.If omitted, <b>B<\/b> is assumed.<\/big><\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big><b>HELPER \u2212<\/b> <i>helper<\/i><\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>Names a Netfilter protocol helper module such as <b>ftp<\/b>, <b>sip<\/b>, <b>amanda<\/b>, etc. A packet will match if it was accepted by the named helper module.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>Example: Mark all FTP data connections with mark 4:<\/big><\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\"><big>#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST LENGTH TOS CONNBYTES HELPER <br \/> 4:T 0.0.0.0\/0 0.0.0.0\/0 TCP \u2212 \u2212 \u2212 \u2212 \u2212 \u2212 \u2212 ftp<\/big><\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big><b>PROBABILITY<\/b> \u2212 [<i>probability<\/i>]<\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>Added in Shorewall 4.5.0. When non\u2212empty, requires the Statistics Match capability in your kernel and ip6tables and causes the rule to match randomly but with the given <i>probability<\/i>. The <i>probability<\/i> is a number 0 < <i>probability<\/i> <= 1 and may be expressed at up to 8 decimal points of precision.<\/big><\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big><b>DSCP \u2212<\/b> [[!]<i>dscp<\/i>]<\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>Added in Shorewall 4.5.1. When non\u2212empty, match packets whose Differentiated Service Code Point field matches the supplied value (when &#8216;!&#8217; is given, the rule matches packets whose DSCP field does not match the supplied value). The <i>dscp<\/i> value may be given as an even number (hex or decimal) or as the name of a DSCP class. Valid class names and their associated hex numeric values are:<\/big><\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\"><big>CS0 => 0x00 <br \/> CS1 => 0x08 <br \/> CS2 => 0x10 <br \/> CS3 => 0x18 <br \/> CS4 => 0x20 <br \/> CS5 => 0x28 <br \/> CS6 => 0x30 <br \/> CS7 => 0x38 <br \/> BE => 0x00 <br \/> AF11 => 0x0a <br \/> AF12 => 0x0c <br \/> AF13 => 0x0e <br \/> AF21 => 0x12 <br \/> AF22 => 0x14 <br \/> AF23 => 0x16 <br \/> AF31 => 0x1a <br \/> AF32 => 0x1c <br \/> AF33 => 0x1e <br \/> AF41 => 0x22 <br \/> AF42 => 0x24 <br \/> AF43 => 0x26 <br \/> EF => 0x2e<\/big><\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big><b>STATE<\/b> \u2212\u2212 {<b>NEW<\/b>|<b>RELATED<\/b>|<b>ESTABLISHED<\/b>|<b>INVALID<\/b>} [,&#8230;]<\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>The rule will only match if the packet&#8217;s connection is in one of the listed states.<\/big><\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big><b>TIME<\/b> \u2212 <i>timeelement<\/i>[&#038;<i>timeelement<\/i>&#8230;]<\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>Added in Shorewall 4.6.2.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>May be used to limit the rule to a particular time period each day, to particular days of the week or month, or to a range defined by dates and times. Requires time match support in your kernel and ip6tables.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big><i>timeelement<\/i> may be:<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>timestart=<i>hh<\/i>:<i>mm<\/i>[:<i>ss<\/i>]<\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>Defines the starting time of day.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>timestop=<i>hh<\/i>:<i>mm<\/i>[:<i>ss<\/i>]<\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>Defines the ending time of day.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>contiguous<\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>Added in Shoreawll 5.0.12. When <b>timestop<\/b> is smaller than <b>timestart<\/b> value, match this as a single time period instead of distinct intervals.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>utc<\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>Times are expressed in Greenwich Mean Time.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>localtz<\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>Deprecated by the Netfilter team in favor of <b>kerneltz<\/b>. Times are expressed in Local Civil Time (default).<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>kerneltz<\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>Added in Shorewall 4.5.2. Times are expressed in Local Kernel Time (requires iptables 1.4.12 or later).<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>weekdays=ddd[,ddd]&#8230;<\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>where <i>ddd<\/i> is one of <b>Mon<\/b>, <b>Tue<\/b>, <b>Wed<\/b>, <b>Thu<\/b>, <b>Fri<\/b>, <b>Sat<\/b> or <b>Sun<\/b><\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>monthdays=dd[,dd],&#8230;<\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>where <i>dd<\/i> is an ordinal day of the month<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>datestart=<i>yyyy<\/i>[\u2212<i>mm<\/i>[\u2212<i>dd<\/i>[<b>T<\/b><i>hh<\/i>[:<i>mm<\/i>[:<i>ss<\/i>]]]]]<\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>Defines the starting date and time.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>datestop=<i>yyyy<\/i>[\u2212<i>mm<\/i>[\u2212<i>dd<\/i>[<b>T<\/b><i>hh<\/i>[:<i>mm<\/i>[:<i>ss<\/i>]]]]]<\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big>Defines the ending date and time.<\/big><\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big><b>SWITCH \u2212 [!]<\/b><i>switch\u2212name<\/i><b>[={0|1}]<\/b><\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>Added in Shorewall 5.1.0 and allows enabling and disabling the rule without requiring <b>shorewall reload<\/b>.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>The rule is enabled if the value stored in \/proc\/net\/nf_condition\/<i>switch\u2212name<\/i> is 1. The rule is disabled if that file contains 0 (the default). If &#8216;!&#8217; is supplied, the test is inverted such that the rule is enabled if the file contains 0.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>Within the <i>switch\u2212name<\/i>, &#8216;@0&#8217; and &#8216;@{0}&#8217; are replaced by the name of the chain to which the rule is a added. The <i>switch\u2212name<\/i> (after &#8216;@&#8230;&#8217; expansion) must begin with a letter and be composed of letters, decimal digits, underscores or hyphens. Switch names must be 30 characters or less in length.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>Switches are normally <b>off<\/b>. To turn a switch <b>on<\/b>:<\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big><b>echo 1 > <br \/> \/proc\/net\/nf_condition\/<\/b><i>switch\u2212name<\/i><\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>To turn it <b>off<\/b> again:<\/big><\/font><\/p>\n<p style=\"margin-left:23%;\"><font color=\"#000000\"><big><b>echo 0 > <br \/> \/proc\/net\/nf_condition\/<\/b><i>switch\u2212name<\/i><\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>Switch settings are retained over <b>shorewall reload<\/b>.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>When the <i>switch\u2212name<\/i> is followed by <b>=0<\/b> or <b>=1<\/b>, then the switch is initialized to off or on respectively by the <b>start<\/b> command. Other commands do not affect the switch setting.<\/big><\/font><\/p>\n<h2>EXAMPLE <a name=\"EXAMPLE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big>IPv4 Example 1:<\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>Mark all ICMP echo traffic with packet mark 1. Mark all peer to peer traffic with packet mark 4.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>This is a little more complex than otherwise expected. Since the ipp2p module is unable to determine all packets in a connection are P2P packets, we mark the entire connection as P2P if any of the packets are determined to match.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>We assume packet\/connection mark 0 means unclassified.<\/big><\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\"><big>#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST <br \/> MARK(1):T 0.0.0.0\/0 0.0.0.0\/0 icmp echo\u2212request <br \/> MARK(1):T 0.0.0.0\/0 0.0.0.0\/0 icmp echo\u2212reply <br \/> RESTORE:T 0.0.0.0\/0 0.0.0.0\/0 all \u2212 \u2212 \u2212 0 <br \/> CONTINUE:T 0.0.0.0\/0 0.0.0.0\/0 all \u2212 \u2212 \u2212 !0 <br \/> MARK(4):T 0.0.0.0\/0 0.0.0.0\/0 ipp2p:all <br \/> SAVE:T 0.0.0.0\/0 0.0.0.0\/0 all \u2212 \u2212 \u2212 !0<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>If a packet hasn&#8217;t been classified (packet mark is 0), copy the connection mark to the packet mark. If the packet mark is set, we&#8217;re done. If the packet is P2P, set the packet mark to 4. If the packet mark has been set, save it to the connection mark.<\/big><\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big>IPv4 Example 2:<\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>SNAT outgoing connections on eth0 from 192.168.1.0\/24 in round\u2212robin fashion between addresses 1.1.1.1, 1.1.1.3, and 1.1.1.9 (Shorewall 4.5.9 and later).<\/big><\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\"><big>\/etc\/shorewall\/mangle:<\/big><\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\"><big>#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST <br \/> CONNMARK(1\u22123):F 192.168.1.0\/24 eth0 ; state=NEW<\/big><\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\"><big>\/etc\/shorewall\/snat:<\/big><\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\"><big>#ACTION SOURCE DEST &#8230; <br \/> SNAT(1.1.1.1) eth0:192.168.1.0\/24 \u2212 { mark=1:C } <br \/> SNAT(1.1.1.3) eth0:192.168.1.0\/24 \u2212 { mark=2:C } <br \/> SNAT(1.1.1.4) eth0:192.168.1.0\/24 \u2212 { mark=3:C }<\/big><\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big>IPv6 Example 1:<\/big><\/font><\/p>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>Mark all ICMP echo traffic with packet mark 1. Mark all peer to peer traffic with packet mark 4.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>This is a little more complex than otherwise expected. Since the ipp2p module is unable to determine all packets in a connection are P2P packets, we mark the entire connection as P2P if any of the packets are determined to match.<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>We assume packet\/connection mark 0 means unclassified.<\/big><\/font><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><font color=\"#000000\"><big>#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST <br \/> MARK(1):T ::\/0 ::\/0 icmp echo\u2212request <br \/> MARK(1):T ::\/0 ::\/0 icmp echo\u2212reply <br \/> RESTORE:T ::\/0 ::\/0 all \u2212 \u2212 \u2212 0 <br \/> CONTINUE:T ::\/0 ::\/0 all \u2212 \u2212 \u2212 !0 <br \/> MARK(4):T ::\/0 ::\/0 ipp2p:all <br \/> SAVE:T ::\/0 ::\/0 all \u2212 \u2212 \u2212 !0<\/big><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"><big>If a packet hasn&#8217;t been classified (packet mark is 0), copy the connection mark to the packet mark. If the packet mark is set, we&#8217;re done. If the packet is P2P, set the packet mark to 4. If the packet mark has been set, save it to the connection mark.<\/big><\/font><\/p>\n<h2>FILES <a name=\"FILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big>\/etc\/shorewall\/mangle<\/big><\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big>\/etc\/shorewall6\/mangle<\/big><\/font><\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><b><font color=\"#0000FF\">https:\/\/shorewall.org\/traffic_shaping.htm<\/font><\/b><\/big> <font color=\"#000000\">[14]<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b><big><font color=\"#0000FF\">https:\/\/shorewall.org\/MultiISP.html<\/font><\/big><\/b> <font color=\"#000000\">[3]<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b><big><font color=\"#0000FF\">https:\/\/shorewall.org\/PacketMarking.html<\/font><\/big><\/b> <font color=\"#000000\">[15]<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b><big><font color=\"#0000FF\">https:\/\/shorewall.org\/configuration_file_basics.htm#Pairs<\/font><\/big><\/b> <font color=\"#000000\">[16]<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><big>shorewall(8)<\/big><\/font><\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>1.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"31%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>shorewall-tcrules(5)<\/big><\/font><\/p>\n<\/td>\n<td width=\"52%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/manpages\/shorewall-tcrules.html<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>2.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"23%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>shorewall-rules<\/big><\/font><\/p>\n<\/td>\n<td width=\"60%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/manpages\/shorewall-rules.html<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>3.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"54%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/MultiISP.html<\/big><\/font><\/p>\n<\/td>\n<td width=\"29%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/MultiISP.html<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>4.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"26%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>shorewall.conf(5)<\/big><\/font><\/p>\n<\/td>\n<td width=\"57%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/manpages\/shorewall.conf.html<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>5.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"31%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>shorewall-actions(5)<\/big><\/font><\/p>\n<\/td>\n<td width=\"52%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/manpages\/shorewall-actions.html<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>6.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"29%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>shorewall-tcdevices<\/big><\/font><\/p>\n<\/td>\n<td width=\"54%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/manpages\/shorewall-tcdevices.html<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>7.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"29%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>shorewall-tcclasses<\/big><\/font><\/p>\n<\/td>\n<td width=\"54%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/manpages\/shorewall-tcclasses.html<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>8.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"34%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>shorewall-providers(5)<\/big><\/font><\/p>\n<\/td>\n<td width=\"49%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/manpages\/shorewall-providers.html<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>9.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"25%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>shorewall-ecn(5)<\/big><\/font><\/p>\n<\/td>\n<td width=\"58%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/manpages\/shorewall-ecn.html<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>10.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"26%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>shorewall-actions<\/big><\/font><\/p>\n<\/td>\n<td width=\"57%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/manpages\/shorewall-actions.html<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>11.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"31%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>shorewall-interfaces<\/big><\/font><\/p>\n<\/td>\n<td width=\"52%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/manpages\/shorewall-interfaces.html<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>12.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"29%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>shorewall-exclusion<\/big><\/font><\/p>\n<\/td>\n<td width=\"54%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/manpages\/shorewall-exclusion.html<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>13.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/configuration_file_basics.htm#ICMP<\/big><\/font><\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/configuration_file_basics.htm#ICMP<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>14.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"63%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/traffic_shaping.htm<\/big><\/font><\/p>\n<\/td>\n<td width=\"20%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/traffic_shaping.htm<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>15.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"61%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/PacketMarking.html<\/big><\/font><\/p>\n<\/td>\n<td width=\"22%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/PacketMarking.html<\/big><\/font><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>16.<\/big><\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/configuration_file_basics.htm#Pairs<\/big><\/font><\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\"><big>https:\/\/shorewall.org\/configuration_file_basics.htm#Pairs<\/big><\/font><\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  mangle \u2212 Shorewall Packet marking\/mangling rules file <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[959],"tags":[961,1291,1556],"class_list":["post-4610","post","type-post","status-publish","format-standard","hentry","category-5-formatos-de-ficheros","tag-961","tag-man5","tag-shorewall-mangle"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4610","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=4610"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4610\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=4610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=4610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=4610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}