{"id":320328,"date":"2021-03-26T15:01:09","date_gmt":"2021-03-26T15:01:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=320328"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=320328","title":{"rendered":"FreeBSD. \u0422\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438, \u0442\u044d\u0433\u0438 \u0438 \u044f\u043a\u043e\u0440\u044f \u0432 PF"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<ol>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ics\/blog\/546720\/\">\u0424\u0430\u0439\u0440\u0432\u043e\u043b PF \u0432 \u041e\u0421 FreeBSD<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ics\/blog\/547916\/\">FreeBSD. \u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u0444\u0438\u043a\u0430 PF<\/a><\/li>\n<li>FreeBSD. \u0422\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438, \u0442\u044d\u0433\u0438 \u0438 \u044f\u043a\u043e\u0440\u044f \u0432 PF &lt;- \u0412\u044b \u0437\u0434\u0435\u0441\u044c<\/li>\n<\/ol>\n<p>  <\/p>\n<h2 id=\"vvedenie\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 PF \u0432\u043e\u043e\u0431\u0449\u0435, \u043e\u0431\u0449\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b. \u0423\u0437\u043d\u0430\u043b\u0438 \u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 PF. \u0418 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 NAT \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f\u043c\u0438 \u0438 \u0442\u044d\u0433\u0430\u043c\u0438 (tags). \u0415\u0449\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u043f\u043e \u044f\u043a\u043e\u0440\u044f\u043c (anchors), \u0438\u0445 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0435\u0449\u0435 \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/x8\/ok\/-a\/x8ok-aycgbajv5ea6ewk6rc6j3k.png\"><\/p>\n<p>  <\/p>\n<p>\u0414\u0443\u043c\u0430\u044e, \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <strong>NAT \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438<\/strong> \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442. PF \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u0440\u0438 \u0432\u0438\u0434\u0430 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0439.<\/p>\n<p>  <\/p>\n<p><strong>Anchors<\/strong> \u2014 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0431\u043e\u0440\u044b \u043f\u0440\u0430\u0432\u0438\u043b PF, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438, \u043f\u043e\u0434\u043e\u0431\u043d\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c, \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<p>  <\/p>\n<p><strong>Tag<\/strong> \u2014 \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0435. \u0423\u0434\u043e\u0431\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u0435\u0442\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b, \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0440\u043e\u0441, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u0438\u0445 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0441\u043a\u043e\u043f\u043e\u043c \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0435.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"zadacha\">\u0417\u0430\u0434\u0430\u0447\u0430<\/h2>\n<p>  <\/p>\n<p><em>\u0421\u0440\u0430\u0437\u0443 \u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0432\u043f\u043e\u043b\u043d\u0435 \u0440\u0430\u0431\u043e\u0447\u0430\u044f, \u043d\u043e, \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f, \u0432\u0435\u0437\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f &quot;\u0441\u0435\u0440\u044b\u0435&quot; \u0441\u0435\u0442\u0438.<\/em><\/p>\n<p>  <\/p>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0444\u0438\u0441. \u041e\u0431\u044b\u0447\u043d\u044b\u0439 \u043e\u0444\u0438\u0441, 2 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0442\u0438.<br \/>  \u0412 \u0441\u0435\u0442\u0438 172.16.2.0\/24 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u044f. \u041d\u0443 \u0438 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440, \u043e\u0441\u043e\u0431\u043e\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 172.16.2.2.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0435\u0442\u0438 \u2014 172.16.3.0\/24 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440 (172.16.3.1), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0434\u043e \u0441\u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 1 \u0432 1. \u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430, \u043e\u0441\u043e\u0431\u043e\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043f\u043b\u044e\u0441 \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u043f\u043e\u0440\u0442\u0430 \u0434\u043b\u044f \u0442\u043e\u0440\u0440\u0435\u043d\u0442\u043e\u0432 (59715 TCP \u0438 UDP). \u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0430, \u043e\u0441\u043e\u0431\u043e\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u044b \u0441\u043e\u0446\u0438\u0430\u043b\u043e\u0447\u0435\u043a, \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043c\u0435\u043d\u043e\u0432 \u0432\u0440\u043e\u0434\u0435 vk.com \u0438 facebook.com, \u0434\u043b\u044f \u0432\u0441\u0435\u0445, \u043a\u0440\u043e\u043c\u0435 \u0438\u0437\u0431\u0440\u0430\u043d\u043d\u044b\u0445. \u0418 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043b\u044f \u0448\u0442\u0440\u0430\u0444\u043d\u0438\u043a\u043e\u0432 \u0437\u0430\u043f\u0440\u0435\u0442 \u0432\u0445\u043e\u0434\u0430 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442, \u043a\u0440\u043e\u043c\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0430\u0439\u0442\u043e\u0432, \u043f\u0443\u0441\u0442\u044c \u0431\u0443\u0434\u0443\u0442 google.com \u0438 yandex.ru, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u0445\u043e\u0434\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442, 172.16.1.2. \u041f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u043d\u0430\u043c \u0434\u0430\u0451\u0442 \u0441\u0435\u0442\u044c 172.16.1.1\/24 \u0441\u043e \u0448\u043b\u044e\u0437\u043e\u043c 172.16.1.254 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 IP \u0434\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 172.16.1.5.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kx\/7v\/cm\/kx7vcmirk7cjzf9asogcdftzo9i.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0441\u0435\u0442\u0438 \u043e\u0444\u0438\u0441\u0430\"><\/p>\n<p>  <\/p>\n<h2 id=\"podgotovka\">\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u043d\u0430\u0448 \u0440\u043e\u0443\u0442\u0435\u0440. \u041f\u0443\u0441\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \/etc\/rc.conf \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">gateway_enable=&quot;yes&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u0430\u0448\u0438\u043d\u0443.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0451, \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0443\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432, \u0442\u0430\u0431\u043b\u0438\u0446, \u0441\u043a\u0440\u0430\u0431, \u043e\u043f\u0446\u0438\u0438, \u043e\u0447\u0435\u0440\u0435\u0434\u0438 (\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u0442)<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">#macros section ExtIf=&quot;re0&quot; # \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IntIf1=&quot;em0&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 0, \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u044f IntIf2=&quot;em1&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 1, \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435.  ExtIfIp1=&quot;172.16.1.1&quot; # \u0412\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0430\u0434\u0440\u0435\u0441 ExtIfIp2=&quot;172.16.1.5&quot; # \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u043e\u0442 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430  IntIf1Ip=&quot;172.16.2.254&quot; # IP \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e 0 IntIf1Net=&quot;172.16.2.0\/24&quot;  IntIf2Ip=&quot;172.16.3.254&quot; # IP \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e 1 IntIf2Net=&quot;172.16.3.0\/24&quot;  IntSrv=&quot;172.16.3.1&quot; ExtSrv=&quot;172.16.1.2&quot;  torrent_port=&quot;59715&quot;  permit_tcp_ports=&quot;22,53&quot; permit_udp_ports=&quot;53,123&quot; web_ports = &quot;http,https&quot;  permit_corp_ports =&quot;http,https&quot; permit_add_tcp_ports = &quot;8080,8443&quot;  #table section table &lt;privileged_If1&gt; { 172.16.2.2 } # \u0433\u043b\u0430\u0432\u0431\u0443\u0445 \u0438 \u0438\u0437\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u0438 table &lt;privileged_If2&gt; { 172.16.3.15, 172.16.3.125 } # \u0438\u0437\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043e\u0431\u0449\u0435\u0439 \u0441\u0435\u0442\u0438 table &lt;bad_users&gt; persist # \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0430 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f  table &lt;block_list&gt;  file &quot;\/etc\/pf.blocklist.conf&quot; # \u0445\u043e\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043d\u0440\u0430\u0432\u044f\u0442\u0441\u044f, \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0442\u0443\u0442  table &lt;corp_res&gt; file &quot;\/etc\/pf.corpres.conf&quot;# \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u043e hppt(s) table &lt;sites_for_all&gt; file &quot;\/etc\/pf.sitesforall.conf&quot; # \u0441\u0430\u0439\u0442\u044b, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432\u0441\u0435\u043c table &lt;bad_sites&gt; file &quot;\/etc\/pf.badsites.conf&quot;  table &lt;block_ssh&gt; persist # \u0411\u0440\u0443\u0442\u0444\u043e\u0440\u0441\u0435\u0440\u044b ssh. \u0435\u0441\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u0443\u0441\u0442\u0430\u044f, PF \u0435\u0451 \u0443\u0434\u0430\u043b\u0438\u0442. \u0414\u043b\u044f \u043e\u0442\u043c\u0435\u043d\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e persist table &lt;block_web&gt; persist # \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u0434\u043e \u0432\u0435\u0431 \u0434\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430  #options section set block-policy return # \u0440\u0430\u0437\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u043e\u0442\u0432\u0435\u0442\u043e\u043c, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0440\u043e\u043f\u0430\u0435\u043c \u043f\u0430\u043a\u0435\u0442\u044b set skip on lo0 # \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0442\u043b\u0435, \u0442\u0430\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u0430  #scrub section scrub in all # \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430  #Queueing section # \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0443\u0441\u0442\u0430\u044f<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h2 id=\"translyacii\">\u0422\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438<\/h2>\n<p>  <\/p>\n<p>\u0412\u0440\u0435\u043c\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0439. \u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441\u0442\u0440\u043e\u044f\u0442\u0441\u044f \u043f\u043e \u043e\u0431\u0449\u0435\u043c\u0443 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0443 (\u043e\u043f\u0438\u0441\u0430\u043d \u0432\u043e \u0432\u0432\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435). \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>PF \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 3 \u0442\u0438\u043f\u0430.<\/p>\n<p>  <\/p>\n<ul>\n<li><strong>binat<\/strong> \u2014 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f, \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f, \u0438\u043b\u0438 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u043e\u0434\u0438\u043d \u0432 \u043e\u0434\u0438\u043d \u0432 \u043e\u0431\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/li>\n<li><strong>nat<\/strong> \u2014 source nat, \u043f\u043e\u0434\u043c\u0435\u043d\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430. \u0422\u043e, \u0447\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 NAT \u043f\u043e\u0447\u0442\u0438 \u0432\u0435\u0437\u0434\u0435.<\/li>\n<li><strong>rdr<\/strong> \u2014 \u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u043f\u043e\u0440\u0442\u043e\u0432, \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u0430\u0434\u0440\u0435\u0441\u0430 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, destination nat, dnat.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3 id=\"binat\">BINAT<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438. \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u044b (\u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[ &quot;no&quot; ] &quot;binat&quot; [ &quot;pass&quot; [ &quot;log&quot; [ &quot;(&quot; logopts &quot;)&quot; ] ] ]               [ &quot;on&quot; interface-name ] [ af ]               [ &quot;proto&quot; ( proto-name | proto-number ) ]               &quot;from&quot; address [ &quot;\/&quot; mask-bits ] &quot;to&quot; ipspec               [ &quot;tag&quot; string ] [ &quot;tagged&quot; string ]               [ &quot;-&gt;&quot; address [ &quot;\/&quot; mask-bits ] ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0435 \u0436\u0435, \u0447\u0442\u043e \u0438 \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438, \u043a\u0440\u043e\u043c\u0435 no \u0432 \u043d\u0430\u0447\u0430\u043b\u0435. \u042d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430\u0434 \u043f\u0440\u0430\u0432\u0438\u043b\u043e\u043c \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438, \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u0434 \u043d\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a \u0441\u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">no binat on $ExtIf from $IntSrv to 172.16.34.0\/24 binat on $ExtIf from $IntSrv to any -&gt; $ExtIfIp2<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a, \u043a\u0440\u043e\u043c\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043e\u0442 \u0445\u043e\u0441\u0442\u0430 IntSrv (172.16.3.1) \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0441\u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0430\u0434\u0440\u0435\u0441 ExtIfIp2(172.16.1.5), \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0432\u0441\u0451, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0430\u0434\u0440\u0435\u0441, \u0443\u043b\u0435\u0442\u0438\u0442 \u043d\u0430 \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440. \u0423\u0434\u043e\u0431\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043a\u0443\u0447\u0443 \u043f\u043e\u0440\u0442\u043e\u0432, \u0438 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0410\u0422\u0421. \u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043f\u043e\u0439\u0434\u0435\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">binat on $ExtIf from $IntSrv to any -&gt; $ExtIfIp2<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nat\">NAT<\/h3>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u2014 NAT \u0438\u0437 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442. \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[ &quot;no&quot; ] &quot;nat&quot; [ &quot;pass&quot; [ &quot;log&quot; [ &quot;(&quot; logopts &quot;)&quot; ] ] ]               [ &quot;on&quot; ifspec ] [ af ]               [ protospec ] hosts [ &quot;tag&quot; string ] [ &quot;tagged&quot; string ]               [ &quot;-&gt;&quot; ( redirhost | &quot;{&quot; redirhost-list &quot;}&quot; )               [ portspec ] [ pooltype ] [ &quot;static-port&quot; ] ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0441\u0442\u0440\u043e\u043a\u0430 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">nat on $ExtIf from { $IntIf1Net, $IntIf2Net } to any -&gt; $ExtIfIp1<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0441\u0451, \u0438\u0434\u0443\u0449\u0435\u0435 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u043c IP \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u0434\u043e\u0431\u043d\u043e <strong>binat<\/strong>. \u041a\u0440\u043e\u043c\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438 \u0432 \u043e\u0434\u0438\u043d \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 IP, \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b PF \u0441\u0430\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u043b \u044d\u0442\u043e\u0442 IP \u0441 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u041f\u043e\u043b\u0435\u0437\u043d\u043e, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0434\u0430\u0451\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 IP \u043f\u043e PPPoE \u0438\u043b\u0438 DHCP:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">nat on $ExtIf from { $IntIf1Net, $IntIf2Net } to any -&gt; ($ExtIf)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e IP, \u0438\u043b\u0438 \u0441\u0435\u0442\u044c \u0442\u043e \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0442\u0430\u043a \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0432\u0441\u044f \u0441\u0435\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 (\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e round-robin):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">nat on $ExtIf from { $IntIf1Net, $IntIf2Net } to any -&gt; ($ExtIf:network)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e PF \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0438 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 IP \u043f\u043e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 <strong>round-robin<\/strong>. \u042d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u044f\u0432\u043d\u043e\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0441\u0435\u0442\u0438. \u0414\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0435\u0449\u0451 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 <strong>source-hash<\/strong>, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 IP \u0438\u0437 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u043f\u0443\u043b\u0430, \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c, \u043b\u0438\u0431\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 <strong>random<\/strong>. \u041c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u0438\u043f\u0430\u043d\u0438\u0435, <strong>sticky-address<\/strong>, \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0435, \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 IP \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u0432\u043d\u0435\u0448\u043d\u0438\u043c, \u043f\u043e\u043a\u0430 \u0435\u0441\u0442\u044c \u0436\u0438\u0432\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0436\u0438\u0432\u044b\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043d\u0435\u0442, \u0442\u043e \u0430\u0434\u0440\u0435\u0441 \u043e\u0442\u043b\u0438\u043f\u0430\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">nat on $ExtIf from { $IntIf1Net, $IntIf2Net } to any -&gt; 172.16.1.0\/27 \\                                      source-hash sticky-address<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"rdr\">RDR<\/h3>\n<p>  <\/p>\n<p>\u041d\u0443 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435, \u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u043f\u043e\u0440\u0442\u043e\u0432. \u041e\u0442\u043b\u0438\u0447\u0438\u0439 \u043c\u0430\u043b\u043e.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[ &quot;no&quot; ] &quot;nat&quot; [ &quot;pass&quot; [ &quot;log&quot; [ &quot;(&quot; logopts &quot;)&quot; ] ] ]         [ &quot;on&quot; ifspec ] [ af ]         [ protospec ] hosts [ &quot;tag&quot; string ] [ &quot;tagged&quot; string ]         [ &quot;-&gt;&quot; ( redirhost | &quot;{&quot; redirhost-list &quot;}&quot; )         [ portspec ] [ pooltype ] [ &quot;static-port&quot; ] ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">rdr on $ExtIf inet proto {tcp, udp} from any to $ExtIfIp1 \\     port { $torrent_port } -&gt; 172.16.3.15 port $torrent_port<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u043e \u0437\u0430\u0432\u0435\u0440\u043d\u0435\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u043d\u0430 IP \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430. \u0418\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u2014 \u043c\u043e\u0436\u043d\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">rdr on $ExtIf inet proto {tcp, udp} from any to $ExtIfIp1 \\     port { $torrent_port } -&gt; { 172.16.3.15, 172.16.3.15 } \\      port $torrent_port round-robin<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0443 \u0438, \u043a\u0430\u043a \u0438 \u0432\u0435\u0437\u0434\u0435, \u0432\u044b\u0448\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<h2 id=\"tegi\">\u0422\u044d\u0433\u0438<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u0412 \u043e\u0434\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u0443 \u043f\u0430\u043a\u0435\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0442\u044d\u0433<\/li>\n<li>\u041f\u0440\u0430\u0432\u0438\u043b\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u044d\u0433 \u043f\u0430\u043a\u0435\u0442\u0430, \u043d\u043e \u043d\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0435\u0433\u043e<\/li>\n<li>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043e\u0442\u0431\u043e\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u043a\u043e\u043c \u043e\u0442\u0440\u0438\u0446\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c:! tagged PASS<\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>\u0422\u044d\u0433 (tag)<\/strong> \u2014 \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442, \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0439 \u043f\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0443, \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u0432 \u0447\u0435\u043c \u0432\u043e\u043b\u0448\u0435\u0431\u0441\u0442\u0432\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e PF.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430 \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e. \u0415\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u0435\u0441\u0442\u044c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043d\u0430 \u043d\u0438\u0445 \u0442\u0440\u0430\u0444\u0438\u043a, \u0435\u0441\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u0441\u0430\u043c \u0445\u043e\u0441\u0442. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043f\u0430\u043a\u0435\u0442 \u0441\u043f\u0435\u0440\u0432\u0430 \u0432\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c in, \u0432\u0440\u043e\u0434\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass in quick on $IntIf1 from $IntIf1Net to $IntIf2Net<\/code><\/pre>\n<p>  <\/p>\n<p>\u0437\u0430\u0442\u0435\u043c, \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0445\u043e\u0434\u043e\u043c \u0441 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c out:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass out quick on $IntIf2 from $IntIf1Net to $IntIf2Net<\/code><\/pre>\n<p>  <\/p>\n<p>\u0438, \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0445\u043e\u0434\u0438\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0441\u0432\u043e\u0438\u043c\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0435\u0442\u044f\u043c\u0438, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass in quick on $IntIf1 from $IntIf1Net to $IntIf2Net pass out quick on $IntIf2 from $IntIf1Net to $IntIf2Net  pass in quick on $IntIf2 from $IntIf2Net to $IntIf1Net pass out quick on $IntIf1 from $IntIf2Net to $IntIf1Net<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e. \u041f\u0435\u0440\u0432\u044b\u0439 \u2014 \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0421\u043e\u043e\u0440\u0443\u0434\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass quick from $IntIf1Net to $IntIf2Net<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u043e, \u044d\u0442\u043e \u043d\u0435 \u043d\u0430\u0448\u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 &quot;\u0441\u0442\u0440\u043e\u0433\u043e\u0441\u0442\u044c&quot; \u0444\u0430\u0439\u0440\u0432\u043e\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass in quick on $IntIf1 from $IntIf1Net to $IntIf2Net tag PASS pass in quick on $IntIf2 from $IntIf2Net to $IntIf1Net tag PASS pass out tagged PASS<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u044d\u0433, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f\u0441\u044c \u043d\u0430 \u0432\u0441\u0451\u043c \u043f\u0443\u0442\u0438 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u0430, \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432 \u043f\u043e\u043f\u0430\u0434\u0451\u0442 \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u043e pass out, \u0438 \u0442\u0440\u0430\u0444\u0438\u043a \u043f\u0440\u043e\u0439\u0434\u0451\u0442.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u0451\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b \u0438 \u0432\u044b\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u0438 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. \u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u043d\u0430 \u0447\u0430\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432.<\/p>\n<p>  <\/p>\n<p><strong>\u0410 \u0435\u0449\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 PF, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u0435\u0441\u0442\u044c \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f, \u0443\u0432\u0438\u0434\u044f\u0442 \u0443\u0436\u0435 \u0441\u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b.<\/strong><\/p>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043e\u0442\u043a\u0443\u0434\u0430 \u043f\u0440\u0438\u0448\u0435\u043b \u043f\u0430\u043a\u0435\u0442. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044e\u0449\u0435\u0435 \u0442\u043e\u0440\u0440\u0435\u043d\u0442 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430, \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435, \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 IP:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass in on $ExtIf proto { tcp, udp } from any to 172.16.3.15 \\                              port { $torrent_port } tag PASS<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0415\u0441\u043b\u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0451 \u0432 \u043a\u0443\u0447\u0443, \u0442\u043e, \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">######## macros section ######## ExtIf=&quot;re0&quot; # \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IntIf1=&quot;em0&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 0, \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u044f IntIf2=&quot;em1&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 1, \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435.  ExtIfIp1=&quot;172.16.1.1&quot; # \u0412\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0430\u0434\u0440\u0435\u0441 ExtIfIp2=&quot;172.16.1.5&quot; # \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u043e\u0442 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430  IntIf1Ip=&quot;172.16.2.254&quot; # IP \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e 0 IntIf1Net=&quot;172.16.2.0\/24&quot;  IntIf2Ip=&quot;172.16.3.254&quot; # IP \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e 1 IntIf2Net=&quot;172.16.3.0\/24&quot;  IntSrv=&quot;172.16.3.1&quot; ExtSrv=&quot;172.16.1.2&quot;  torrent_port=&quot;59715&quot;  permit_tcp_ports=&quot;22,53&quot; permit_udp_ports=&quot;53,123&quot; web_ports = &quot;http,https&quot;  permit_corp_ports =&quot;http,https&quot; permit_add_tcp_ports = &quot;8080,8443&quot;  ######## table section ######## table &lt;privileged_If1&gt; { 172.16.2.2 } # \u0433\u043b\u0430\u0432\u0431\u0443\u0445 \u0438 \u0438\u0437\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u0438 table &lt;privileged_If2&gt; { 172.16.3.15, 172.16.3.125 } # \u0438\u0437\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043e\u0431\u0449\u0435\u0439 \u0441\u0435\u0442\u0438 table &lt;bad_users&gt; persist # \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0430 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f  # \u0445\u043e\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043d\u0440\u0430\u0432\u044f\u0442\u0441\u044f, \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0442\u0443\u0442 table &lt;block_list&gt;  file &quot;\/etc\/pf.blocklist.conf&quot;   # \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u043e hppt(s) table &lt;corp_res&gt; file &quot;\/etc\/pf.corpres.conf&quot; table &lt;sites_for_all&gt; file &quot;\/etc\/pf.sitesforall.conf&quot; # \u0441\u0430\u0439\u0442\u044b, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432\u0441\u0435\u043c table &lt;bad_sites&gt; file &quot;\/etc\/pf.badsites.conf&quot;  # \u0411\u0440\u0443\u0442\u0444\u043e\u0440\u0441\u0435\u0440\u044b ssh. \u0435\u0441\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u0443\u0441\u0442\u0430\u044f, PF \u0435\u0451 \u0443\u0434\u0430\u043b\u0438\u0442. \u0414\u043b\u044f \u043e\u0442\u043c\u0435\u043d\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e persist table &lt;block_ssh&gt; persist # \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u0434\u043e \u0432\u0435\u0431 \u0434\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 table &lt;block_web&gt; persist  ######## options section ########  # \u0440\u0430\u0437\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u043e\u0442\u0432\u0435\u0442\u043e\u043c, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0440\u043e\u043f\u0430\u0435\u043c \u043f\u0430\u043a\u0435\u0442\u044b set block-policy return # \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0442\u043b\u0435, \u0442\u0430\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 set skip on lo0   #scrub section # \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430 scrub in all   #Queueing section # \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0443\u0441\u0442\u0430\u044f  ######## nat section ########  #\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 binat on $ExtIf from $IntSrv to any -&gt; $ExtIfIp2  #NAT \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 nat pass on $ExtIf from { $IntIf1Net, $IntIf2Net } to any -&gt; $ExtIfIp1  # \u043f\u0440\u043e\u043e\u0431\u0440\u043e\u0441 \u043f\u043e\u0440\u0442\u043e\u0432 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0443 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 rdr on $ExtIf inet proto {tcp, udp} from any to $ExtIfIp1 port { $torrent_port } -&gt; 172.16.3.15 port $torrent_port  rdr on $ExtIf inet proto {tcp, udp} from any to $ExtIfIp1 \\     port { $torrent_port } -&gt; { 172.16.3.15, 172.16.3.15 } port $torrent_port round-robin  ######## filtering section ######## # \u0437\u0430\u043f\u0440\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u0430. block log all  ## \u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438\u0437 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442. ##  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c ssh \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 \u0431\u0440\u0443\u0442\u0444\u043e\u0440\u0441\u0430 block in quick proto tcp from &lt;block_ssh&gt; port 22 pass in quick on $ExtIf proto tcp to { $ExtIfIp1 $IntSrv } port { 22 } \\            keep state (max-src-conn 10, max-src-conn-rate 3\/10, \\            overload &lt;block_ssh&gt; flush) tag PASS  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c Web \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 \u0431\u043e\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0447\u0435\u0433\u043e block in quick on $ExtIf from &lt;block_web&gt; pass in on $ExtIf proto tcp to $IntSrv port { $web_ports } \\            synproxy state (max-src-conn 100, max-src-conn-rate 20\/1, \\            overload &lt;block_web&gt; flush global) tag PASS  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u0442\u043e\u0440\u0440\u0435\u043d\u0442\u0430\u043c pass in on $ExtIf proto { tcp, udp } from any to 172.16.3.15 port { $torrent_port } tag PASS  ## \u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0441\u0435\u0442\u0435\u0439 ##  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0445\u043e\u0434\u0438\u0442\u044c \u0434\u043e \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 pass in quick on $IntIf2 proto tcp from $ExtIfIp2 to $ExtSrv port { $web_ports, $permit_corp_ports, $permit_add_tcp_ports } tag PASS # \u0415\u0441\u043b\u0438 \u043d\u0430\u0434\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0435\u043c\u0443 \u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442, \u0442\u043e \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c # pass in quick on $IntIf2 from $IntSrv to any tag PASS  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u043b\u043e\u043a\u0430\u043b\u043a\u0430\u043c\u0438 \u0432\u0441\u0435\u043c pass in quick on $IntIf1 from $IntIf1Net to $IntIf2Net tag PASS pass in quick on $IntIf2 from $IntIf2Net to $IntIf1Net tag PASS  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u0441\u0451 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c pass in on $IntIf1 from &lt;privileged_If1&gt; to any tag PASS pass in on $IntIf2 from &lt;privileged_If2&gt; to any tag PASS  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0414\u041d\u0421, icmp \u0432\u0441\u0435\u043c pass in quick on $IntIf1 proto tcp from ($IntIf1:network) to any port { $permit_tcp_ports } tag PASS pass in quick on $IntIf2 proto tcp from ($IntIf2:network) to any port { $permit_tcp_ports } tag PASS  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u0441\u0435\u043c \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b pass in quick on $IntIf1 proto tcp from ($IntIf1:network) to $ExtSrv port { $web_ports } tag PASS pass in quick on $IntIf2 proto tcp from ($IntIf2:network) to $ExtSrv port { $web_ports } tag PASS  pass in quick on $IntIf1 from ($IntIf1:network) to &lt;sites_for_all&gt; tag PASS pass in quick on $IntIf2 from { $IntIf2Net } to &lt;sites_for_all&gt; tag PASS block in quick from &lt;bad_users&gt; to any block in quick from { $IntIf1Net, $IntIf2Net } to &lt;bad_sites&gt; pass in quick from { $IntIf1Net,$IntIf2Net } to any tag PASS  ## \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0442\u0440\u0430\u0444\u0438\u043a ## pass out log tagged PASS  pass out on { $IntIf1,$IntIf2 }  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0441\u0430\u043c\u043e\u043c\u0443 \u0445\u043e\u0441\u0442\u0443 \u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0440\u0442\u044b pass out quick on $ExtIf proto tcp from ($ExtIf) to any port { $permit_tcp_ports } pass out quick on $ExtIf proto udp from ($ExtIf) to any port { $permit_udp_ports }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0412\u043f\u043e\u043b\u043d\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b PF, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u0451, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0435 \u043b\u0443\u0447\u0448\u0435.<\/p>\n<p>  <\/p>\n<h2 id=\"yakorya\">\u042f\u043a\u043e\u0440\u044f<\/h2>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u043a\u0430\u043a anchors. \u042d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0431\u043e\u0440\u044b \u043f\u0440\u0430\u0432\u0438\u043b PF. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u042f\u043a\u043e\u0440\u044f \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u044f\u043a\u043e\u0440\u044f, \u0432\u044b\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044f\u0441\u044c \u0432 \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443<\/li>\n<li>\u042f\u043a\u043e\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438\u0437 \u0444\u0430\u0439\u043b\u0430<\/li>\n<li>\u042f\u043a\u043e\u0440\u044f\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438. \u0423\u0434\u0430\u043b\u044f\u0442\u044c, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430, etc<\/li>\n<li>\u041c\u0430\u043a\u0440\u043e\u0441\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432 \u0442\u043e\u043c \u0436\u0435 \u0444\u0430\u0439\u043b\u0435, \u0447\u0442\u043e \u0438 \u044f\u043a\u043e\u0440\u044c<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u044f\u043a\u043e\u0440\u0435\u0439:<\/p>\n<p>  <\/p>\n<ul>\n<li>nat-anchor  \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 nat<br \/>  rdr-anchor  \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 rdr<br \/>  binat-anchor  \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 binat<br \/>  anchor  \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438<br \/>  load anchor  from  \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430\n<p>\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f anchor \u0442\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0442\u0440\u0430\u0444\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 \u043d\u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 anchor \u0441 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">anchor localnet1 load anchor localnet1 from &quot;\/etc\/pf-anchor.localnet1.conf&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430, \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c anchor \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># echo &quot;pass in quick on $IntIf1 from $IntIf1Net to $IntIf2Net tag PASS&quot; | \\ pfctl -a localnet1 -f -<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u044f\u043a\u043e\u0440\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># pfctl -a &quot;localnet1&quot; -sr<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u044b\u0432\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 pfctl -sr, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u044f\u043a\u043e\u0440\u044c.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u044f\u043a\u043e\u0440\u044c \u0438\u0437 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># pfctl -a &quot;localnet1&quot; -f \/etc\/pf-anchor.localnet1.conf<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0437 \u044f\u043a\u043e\u0440\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># pfctl -a &quot;localnet1&quot; -F rules<\/code><\/pre>\n<p>  <\/p>\n<p>Anchor \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043c\u0435\u0441\u0442\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u041a\u0430\u043a \u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c anchor \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">anchor localnet1 in on $IntIf1 from any to any<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u044f\u043a\u043e\u0440\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438 \u043f\u0440\u044f\u043c\u043e \u043f\u043e \u043c\u0435\u0441\u0442\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">anchor &quot;localnet1&quot; in on $IntIf1 {     pass in quick on $IntIf1 from $IntIf1Net to $IntIf2Net tag PASS     pass in quick on $IntIf1 proto tcp from ($IntIf1:network) to any \\                                    port { $permit_tcp_ports } tag PASS }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u044f\u043a\u043e\u0440\u044f \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u043e\u043f\u0446\u0438\u044f quick, \u0442\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u0430\u0432\u0438\u043b \u0444\u0430\u0439\u0440\u0432\u043e\u043b\u043b\u0430, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0433\u043e. \u041c\u043e\u0436\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u043f\u0446\u0438\u044e quick \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f anchor, \u0442\u043e\u0433\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430. \u041c\u0435\u0442\u043a\u0438 \u0442\u0430\u043a \u0436\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u044f\u043a\u043e\u0440\u044f \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u0438\u0434\u043d\u044b \u0432 \u044d\u0442\u043e\u043c \u0438 \u0432\u0441\u0435\u0445 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u044f\u043a\u043e\u0440\u044f\u0445.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u043c\u0443 \u0442\u0440\u0430\u0444\u0438\u043a\u0443 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 $IntIf1 \u0432 anchor, \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0439 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043c\u0430\u043a\u0440\u043e\u0441\u044b.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">###### macros section ###### IntIf1=&quot;em0&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 0, \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u044f IntIf1Ip=&quot;172.16.2.254&quot; # IP \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e IntIf1Net=&quot;172.16.2.0\/24&quot; IntIf2Net=&quot;172.16.3.0\/24&quot;  ExtSrv=&quot;172.16.1.2&quot;  permit_tcp_ports=&quot;22,53&quot; permit_udp_ports=&quot;53,123&quot; web_ports = &quot;http,https&quot;  ###### filter section ###### # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u043b\u043e\u043a\u0430\u043b\u043a\u0430\u043c\u0438 \u0432\u0441\u0435\u043c pass in quick on $IntIf1 from $IntIf1Net to $IntIf2Net tag PASS # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u0441\u0451 \u043f\u0440\u0438\u0432\u0435\u043b\u0438\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c pass in on $IntIf1 from &lt;privileged_If1&gt; to any tag PASS # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0414\u041d\u0421, icmp \u0432\u0441\u0435\u043c pass in quick on $IntIf1 proto tcp from ($IntIf1:network) to any port { $permit_tcp_ports } tag PASS # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u0441\u0435\u043c \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b pass in quick on $IntIf1 proto tcp from ($IntIf1:network) to $ExtSrv port { $web_ports } tag PASS # \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 pass in quick on $IntIf1 from ($IntIf1:network) to &lt;sites_for_all&gt; tag PASS block in quick from &lt;bad_users&gt; to any block in quick from { $IntIf1Net } to &lt;bad_sites&gt; pass in quick from { $IntIf1Net } to any tag PASS<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0437 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u0442\u043e\u043b\u044c\u043a\u043e anchor, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432 \u044f\u043a\u043e\u0440\u0435 \u043f\u043e \u043c\u0435\u0441\u0442\u0443<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">######## macros section ######## ExtIf=&quot;re0&quot; # \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IntIf1=&quot;em0&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 0, \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u044f IntIf2=&quot;em1&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 1, \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435.  ExtIfIp1=&quot;172.16.1.1&quot; # \u0412\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0430\u0434\u0440\u0435\u0441 ExtIfIp2=&quot;172.16.1.5&quot; # \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u043e\u0442 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430  IntIf1Ip=&quot;172.16.2.254&quot; # IP \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e 0 IntIf1Net=&quot;172.16.2.0\/24&quot;  IntIf2Ip=&quot;172.16.3.254&quot; # IP \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e 1 IntIf2Net=&quot;172.16.3.0\/24&quot;  IntSrv=&quot;172.16.3.1&quot; ExtSrv=&quot;172.16.1.2&quot;  torrent_port=&quot;59715&quot;  permit_tcp_ports=&quot;22,53&quot; permit_udp_ports=&quot;53,123&quot; web_ports = &quot;http,https&quot;  permit_corp_ports =&quot;http,https&quot; permit_add_tcp_ports = &quot;8080,8443&quot;  ######## table section ######## table &lt;privileged_If1&gt; { 172.16.2.2 } # \u0433\u043b\u0430\u0432\u0431\u0443\u0445 \u0438 \u0438\u0437\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u0438 table &lt;privileged_If2&gt; { 172.16.3.15, 172.16.3.125 } # \u0438\u0437\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043e\u0431\u0449\u0435\u0439 \u0441\u0435\u0442\u0438 table &lt;bad_users&gt; persist # \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0430 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f  # \u0445\u043e\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043d\u0440\u0430\u0432\u044f\u0442\u0441\u044f, \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0442\u0443\u0442 table &lt;block_list&gt;  file &quot;\/etc\/pf.blocklist.conf&quot;   # \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u043e hppt(s) table &lt;corp_res&gt; file &quot;\/etc\/pf.corpres.conf&quot; table &lt;sites_for_all&gt; file &quot;\/etc\/pf.sitesforall.conf&quot; # \u0441\u0430\u0439\u0442\u044b, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432\u0441\u0435\u043c table &lt;bad_sites&gt; file &quot;\/etc\/pf.badsites.conf&quot;  # \u0411\u0440\u0443\u0442\u0444\u043e\u0440\u0441\u0435\u0440\u044b ssh. \u0435\u0441\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u0443\u0441\u0442\u0430\u044f, PF \u0435\u0451 \u0443\u0434\u0430\u043b\u0438\u0442. \u0414\u043b\u044f \u043e\u0442\u043c\u0435\u043d\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e persist table &lt;block_ssh&gt; persist # \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u0434\u043e \u0432\u0435\u0431 \u0434\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 table &lt;block_web&gt; persist  ######## options section ########  # \u0440\u0430\u0437\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u043e\u0442\u0432\u0435\u0442\u043e\u043c, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0440\u043e\u043f\u0430\u0435\u043c \u043f\u0430\u043a\u0435\u0442\u044b set block-policy return # \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0442\u043b\u0435, \u0442\u0430\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 set skip on lo0   #scrub section # \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430 scrub in all   #Queueing section # \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0443\u0441\u0442\u0430\u044f  ######## nat section ########  #\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 binat on $ExtIf from $IntSrv to any -&gt; $ExtIfIp2  #NAT \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 nat pass on $ExtIf from { $IntIf1Net, $IntIf2Net } to any -&gt; $ExtIfIp1  # \u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u043f\u043e\u0440\u0442\u043e\u0432 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0443 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 rdr on $ExtIf inet proto {tcp, udp} from any to $ExtIfIp1 port { $torrent_port } -&gt; 172.16.3.15 port $torrent_port  rdr on $ExtIf inet proto {tcp, udp} from any to $ExtIfIp1 \\     port { $torrent_port } -&gt; { 172.16.3.15, 172.16.3.15 } port $torrent_port round-robin  ######## filtering section ######## # \u0437\u0430\u043f\u0440\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u0430. block log all  ## \u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438\u0437 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442. ##  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c ssh \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 \u0431\u0440\u0443\u0442\u0444\u043e\u0440\u0441\u0430 block in quick proto tcp from &lt;block_ssh&gt; port 22 pass in quick on $ExtIf proto tcp to { $ExtIfIp1 $IntSrv } port { 22 } \\            keep state (max-src-conn 10, max-src-conn-rate 3\/10, \\            overload &lt;block_ssh&gt; flush) tag PASS  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c Web \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 \u0431\u043e\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0447\u0435\u0433\u043e block in quick on $ExtIf from &lt;block_web&gt; pass in on $ExtIf proto tcp to $IntSrv port { $web_ports } \\            synproxy state (max-src-conn 100, max-src-conn-rate 20\/1, \\            overload &lt;block_web&gt; flush global) tag PASS  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u0442\u043e\u0440\u0440\u0435\u043d\u0442\u0430\u043c pass in on $ExtIf proto { tcp, udp } from any to 172.16.3.15 port { $torrent_port } tag PASS  ## \u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0441\u0435\u0442\u0435\u0439 ##  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0445\u043e\u0434\u0438\u0442\u044c \u0434\u043e \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 pass in quick on $IntIf2 proto tcp from $ExtIfIp2 to $ExtSrv port { $web_ports, $permit_corp_ports, $permit_add_tcp_ports } tag PASS # \u0415\u0441\u043b\u0438 \u043d\u0430\u0434\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0435\u043c\u0443 \u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442, \u0442\u043e \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c # pass in quick on $IntIf2 from $IntSrv to any tag PASS  anchor localnet1 in on $IntIf1 from any to any load anchor localnet1 from &quot;\/etc\/pf-anchor.localnet1.conf&quot;  anchor localnet2 in on $IntIf2 {     # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u043b\u043e\u043a\u0430\u043b\u043a\u0430\u043c\u0438 \u0432\u0441\u0435\u043c     pass in quick on $IntIf2 from $IntIf2Net to $IntIf1Net tag PASS      # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u0441\u0451 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c     pass in on $IntIf2 from &lt;privileged_If2&gt; to any tag PASS      # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0414\u041d\u0421, icmp \u0432\u0441\u0435\u043c     pass in quick on $IntIf2 proto tcp from ($IntIf2:network) to any port { $permit_tcp_ports } tag PASS      # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u0441\u0435\u043c \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b     pass in quick on $IntIf2 proto tcp from ($IntIf2:network) to $ExtSrv port { $web_ports } tag PASS      # \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432     pass in quick on $IntIf2 from { $IntIf2Net } to &lt;sites_for_all&gt; tag PASS     block in quick from &lt;bad_users&gt; to any     block in quick from { $IntIf2Net } to &lt;bad_sites&gt;     pass in quick from { $IntIf2Net } to any tag PASS }  ## \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0442\u0440\u0430\u0444\u0438\u043a ## pass out log tagged PASS  pass out on { $IntIf1,$IntIf2 }  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0441\u0430\u043c\u043e\u043c\u0443 \u0445\u043e\u0441\u0442\u0443 \u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0440\u0442\u044b pass out quick on $ExtIf proto tcp from ($ExtIf) to any port { $permit_tcp_ports } pass out quick on $ExtIf proto udp from ($ExtIf) to any port { $permit_udp_ports }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0442\u044c, \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e PF \u043a\u043e\u0440\u043e\u0447\u0435 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0439. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438, \u043d\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044f PF.<\/p>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0441 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f\u043c\u0438, \u0442\u044d\u0433\u0430\u043c\u0438 \u0438 \u044f\u043a\u043e\u0440\u044f\u043c\u0438. \u042d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0438\u0437 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 PF, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f \u0445\u043e\u0442\u0435\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u0446\u0438\u043a\u043b\u0435. \u0421\u043e\u0437\u0434\u0430\u043b\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0443\u044e \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0444\u0438\u0441. \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a man pf.conf, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 OpenBSD. \u041e\u0434\u043d\u0430\u043a\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u044d\u0442\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u0434\u043e\u043b\u0436\u043d\u043e \u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0437\u0430\u0434\u0430\u0447. \u0415\u0441\u043b\u0438 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0442\u0435\u043c\u0430 \u043d\u0435 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0430, \u0438\u043b\u0438 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0430 \u043d\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e, \u043f\u0438\u0448\u0438\u0442\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u043e\u0431\u0441\u0443\u0434\u0438\u043c. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0431\u043e\u0440 policy-based routing, \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e, \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u0448\u043b\u044e\u0437 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0421\u0435\u0440\u0432\u0435\u0440, \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043b\u0435\u0436\u0438\u0442 \u043e\u0431\u043e\u0436\u0430\u0435\u043c\u0430\u044f \u043d\u0430\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 FreeBSD, \u0430 \u0435\u0449\u0435 \u0435\u0441\u0442\u044c \u043a\u0443\u0447\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u0441\u0435\u0442\u0438, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u044e\u0437\u0435\u0440\u0430\u043c\u0438 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430. \u0421\u043a\u0430\u0447\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/xserver.a-real.ru\/download\/?utm_source=habr&amp;utm_medium=blog&amp;utm_content=article260321&amp;utm_term=download\">\u0442\u0443\u0442<\/a>. \u0422\u0440\u0438\u0430\u043b 35 \u0434\u043d\u0435\u0439, \u0435\u0441\u0442\u044c \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0430 9 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/ics\/blog\/549150\/\"> https:\/\/habr.com\/ru\/company\/ics\/blog\/549150\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<ol>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ics\/blog\/546720\/\">\u0424\u0430\u0439\u0440\u0432\u043e\u043b PF \u0432 \u041e\u0421 FreeBSD<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ics\/blog\/547916\/\">FreeBSD. \u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u0444\u0438\u043a\u0430 PF<\/a><\/li>\n<li>FreeBSD. \u0422\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438, \u0442\u044d\u0433\u0438 \u0438 \u044f\u043a\u043e\u0440\u044f \u0432 PF &lt;- \u0412\u044b \u0437\u0434\u0435\u0441\u044c<\/li>\n<\/ol>\n<p>  <\/p>\n<h2 id=\"vvedenie\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 PF \u0432\u043e\u043e\u0431\u0449\u0435, \u043e\u0431\u0449\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b. \u0423\u0437\u043d\u0430\u043b\u0438 \u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 PF. \u0418 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 NAT \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f\u043c\u0438 \u0438 \u0442\u044d\u0433\u0430\u043c\u0438 (tags). \u0415\u0449\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u043f\u043e \u044f\u043a\u043e\u0440\u044f\u043c (anchors), \u0438\u0445 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0435\u0449\u0435 \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/x8\/ok\/-a\/x8ok-aycgbajv5ea6ewk6rc6j3k.png\"><\/p>\n<p>  <\/p>\n<p>\u0414\u0443\u043c\u0430\u044e, \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <strong>NAT \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438<\/strong> \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442. PF \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u0440\u0438 \u0432\u0438\u0434\u0430 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0439.<\/p>\n<p>  <\/p>\n<p><strong>Anchors<\/strong> \u2014 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0431\u043e\u0440\u044b \u043f\u0440\u0430\u0432\u0438\u043b PF, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438, \u043f\u043e\u0434\u043e\u0431\u043d\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c, \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<p>  <\/p>\n<p><strong>Tag<\/strong> \u2014 \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0435. \u0423\u0434\u043e\u0431\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u0435\u0442\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b, \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0440\u043e\u0441, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u0438\u0445 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0441\u043a\u043e\u043f\u043e\u043c \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0435.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-320328","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=320328"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320328\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=320328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=320328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=320328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}