{"id":4894,"date":"2016-01-02T22:30:41","date_gmt":"2016-01-02T20:30:41","guid":{"rendered":"http:\/\/skeletor.org.ua\/?p=4894"},"modified":"2016-01-24T21:14:43","modified_gmt":"2016-01-24T19:14:43","slug":"pf-%d0%bf%d1%80%d0%b0%d0%b2%d0%b8%d0%bb%d1%8c%d0%bd%d0%be-%d0%bd%d0%b0%d1%81%d1%82%d1%80%d0%b0%d0%b8%d0%b2%d0%b0%d0%b5%d0%bc-dup-to","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=4894","title":{"rendered":"[pf] \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c dup-to"},"content":{"rendered":"<p>\u042d\u0442\u0430 \u043e\u043f\u0446\u0438\u044f \u0432 <strong>pf<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a, \u043c\u0438\u043d\u0443\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438. \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043f\u0440\u043e\u0441\u0442:<\/p>\n<p><code>pass in|out on $ext_if dup-to\u00a0($dup_if $dup_addr) ...<\/code><\/p>\n<p>\u0433\u0434\u0435,\u00a0<strong>$ext_if<\/strong> &#8211; \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a,\u00a0<strong>dup_if<\/strong> &#8211; \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a (\u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u0442\u043e\u043c \u0436\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u0435, \u0447\u0442\u043e \u0438 <strong>ext_if<\/strong>),\u00a0<strong>dup_addr<\/strong> &#8211; IP-\u0430\u0434\u0440\u0435\u0441 \u0445\u043e\u0441\u0442\u0430, \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0440\u0430\u0444\u0438\u043a (\u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0442\u043e\u0439 \u0436\u0435 \u043f\u043e\u0434\u0441\u0435\u0442\u0438, \u0447\u0442\u043e \u0438\u00a0<strong>dup_if<\/strong>).<\/p>\n<p><!--more--><\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u043f\u0438\u0448\u0443\u0442 (\u043d\u0435 \u043d\u0430\u0448\u0451\u043b \u043d\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0430\u043d\u0443\u0430\u043b\u0435 \u0438\u0437 10-\u043a\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445) &#8211; \u0447\u0442\u043e \u0431\u044b \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e \u0431\u044b <strong>state-policy<\/strong> \u0431\u044b\u043b\u0430\u00a0<strong>if-bound<\/strong>. \u0418\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<p><code>set state-policy if-bound<\/code><\/p>\n<p>\u041d\u0438\u0436\u0435 \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0430 \u0438\u0437 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0438 \u0441 \u043a\u0440\u0430\u0442\u043a\u0438\u043c \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<blockquote><p><span style=\"color: #993366;\">I&#8217;ve looked at the state matching for a bit. It turns out that by<\/span><br \/>\n<span style=\"color: #993366;\"> default packets will match state on any interface (specifically, the<\/span><br \/>\n<span style=\"color: #993366;\"> state is saved to the &#8216;all&#8217; interface, rather than to the specific<\/span><br \/>\n<span style=\"color: #993366;\"> interface it was created on).<\/span><\/p><\/blockquote>\n<p>\u0410 \u0432\u043e\u0442 \u0447\u0430\u0441\u0442\u044c \u043c\u0430\u043d\u0443\u0430\u043b\u0430, \u0441 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435\u043c:<\/p>\n<p><code>set state-policy <i>option<\/i><\/code><\/p>\n<p>Sets PF&#8217;s behavior when it comes to keeping state. This behavior can be overridden on a per rule basis. See <a href=\"http:\/\/www.openbsd.org\/faq\/pf\/filter.html#state\">Keeping State<\/a>.<\/p>\n<ul>\n<li><span style=\"color: #ff6600;\"><strong><tt>if-bound<\/tt><\/strong><\/span> &#8211; states are bound to the interface they&#8217;re created on. If traffic matches a state table entry but is not crossing the interface recorded in that state entry, the match is rejected. The packet must then match a filter rule or will be dropped\/rejected altogether.<\/li>\n<li><span style=\"color: #ff6600;\"><strong><tt>floating<\/tt> <\/strong><\/span>&#8211; states can match packets on any interface. As long as the packet matches a state entry and is passing in the same direction as it was on the interface when the state was created, it does not matter what interface it&#8217;s crossing, it will pass.<\/li>\n<\/ul>\n<p>The default is <tt>floating<\/tt>.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u042d\u0442\u0430 \u043e\u043f\u0446\u0438\u044f \u0432 pf \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a, \u043c\u0438\u043d\u0443\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438. \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043f\u0440\u043e\u0441\u0442: pass in|out on $ext_if dup-to\u00a0($dup_if $dup_addr) &#8230; \u0433\u0434\u0435,\u00a0$ext_if &#8211; \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a,\u00a0dup_if &#8211; \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a (\u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u0442\u043e\u043c \u0436\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u0435, \u0447\u0442\u043e \u0438 ext_if),\u00a0dup_addr &#8211; IP-\u0430\u0434\u0440\u0435\u0441 \u0445\u043e\u0441\u0442\u0430, \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0440\u0430\u0444\u0438\u043a (\u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0442\u043e\u0439 \u0436\u0435 \u043f\u043e\u0434\u0441\u0435\u0442\u0438, \u0447\u0442\u043e \u0438\u00a0dup_if).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,12],"tags":[],"class_list":["post-4894","post","type-post","status-publish","format-standard","hentry","category-others","category-routers"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/4894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4894"}],"version-history":[{"count":4,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/4894\/revisions"}],"predecessor-version":[{"id":4914,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/4894\/revisions\/4914"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}