{"id":320761,"date":"2021-04-02T15:01:43","date_gmt":"2021-04-02T15:01:43","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=320761"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=320761","title":{"rendered":"FreeBSD. \u0423\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 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><a href=\"https:\/\/habr.com\/ru\/company\/ics\/blog\/549150\/\">FreeBSD. \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438, \u0442\u044d\u0433\u0438 \u0438 \u044f\u043a\u043e\u0440\u044f \u0432 PF<\/a><\/li>\n<li>FreeBSD. \u0423\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 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\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 PF. \u0421\u043e\u0437\u0434\u0430\u043b\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0438 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043e\u0444\u0438\u0441. <\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 PF \u0438 FreeBSD \u0432 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438. Policy Based Routing (PBR), Source Based Routing (SBR), \u0443\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f, \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u043e\u043b\u0438\u0442\u0438\u043a, \u0432\u0441\u0435 \u044d\u0442\u0438 \u043f\u043e\u043d\u044f\u0442\u0438\u044f, \u043f\u043e \u0441\u0443\u0442\u0438, \u0440\u0430\u0432\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b \u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043e\u0434\u043d\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c. \u0412\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b, \u043b\u0438\u0431\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0430\u0432\u0438\u043b \u0444\u0430\u0435\u0440\u0432\u043e\u043b\u0430. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/k_\/6b\/oy\/k_6boypn9hnikqd_tcsi3zgfb7q.png\">  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432, \u043b\u0438\u0431\u043e \u0443\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043c\u0435\u0436\u0434\u0443 \u0412\u041f\u041d \u043a\u0430\u043d\u0430\u043b\u0430\u043c\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0431\u0430 \u044d\u0442\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430.<\/p>\n<p>  <\/p>\n<p><em>\u0414\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u044b.<\/em><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"zadachi\">\u0417\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u044c\u043c\u0435\u043c \u043e\u0444\u0438\u0441 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0443\u0434\u0430 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430.<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u043e\u0442 \u043e\u0434\u043d\u043e\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430.<\/li>\n<li>\u0412\u0442\u043e\u0440\u0443\u044e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c \u2014 \u0447\u0435\u0440\u0435\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430.<\/li>\n<li>\u0422\u0430\u043a \u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0432\u0435\u0431-\u043f\u043e\u0440\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u043e\u0438\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043e\u0431\u0430 IP \u0430\u0434\u0440\u0435\u0441\u0430.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u0443 \u0441\u0445\u0435\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u043e\u0444\u0438\u0441, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0442\u0430\u043a \u0436\u0435 2 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430. \u041c\u0435\u0436\u0434\u0443 \u043e\u0444\u0438\u0441\u0430\u043c\u0438 \u0435\u0441\u0442\u044c 2 \u0442\u0443\u043d\u043d\u0435\u043b\u044f.<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041d\u0443\u0436\u043d\u043e \u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u0434\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u0444\u0438\u0441\u0430 \u0447\u0435\u0440\u0435\u0437 \u0412\u041f\u041d1<\/li>\n<li>\u043a\u0440\u043e\u043c\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0412\u041f\u041d2<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0420\u0435\u0448\u0438\u043c \u044d\u0442\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e PF \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u2014 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6j\/dm\/c0\/6jdmc0b8pyjwqxduuqjr-ptga4c.png\">  <\/p>\n<h2 id=\"podgotovka\">\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h2>\n<p>  <\/p>\n<p><em>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 PF \u043e\u0444\u0438\u0441\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b. \u0420\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u043a\u0430\u0441\u0430\u044e\u0442\u0441\u044f \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439. \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/em><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432, \u0442\u0430\u0431\u043b\u0438\u0446, \u043e\u043f\u0446\u0438\u0439<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\"> ######## macros section ######## ExtIf1=&quot;re0&quot; # \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ExtIf1Ip1=&quot;172.16.1.1&quot; # \u0412\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0430\u0434\u0440\u0435\u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e ExtIf1Gw=&quot;172.16.1.254&quot; # \u0448\u043b\u044e\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430  ExtIf2=&quot;re1&quot; # \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ExtIf2Ip1=&quot;172.17.1.1&quot; # \u0412\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0430\u0434\u0440\u0435\u0441 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 ExtIf2Gw=&quot;172.17.1.254&quot; # \u0448\u043b\u044e\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430  IntIf1=&quot;em0&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 1 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;  IntIf2=&quot;em1&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 2 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;  # \u0442\u0443\u043d\u043d\u0435\u043b\u0438 Tun0=&quot;gif0&quot; Tun0Ip=&quot;10.0.0.1&quot; Tun0Gw=&quot;10.0.0.2&quot;  Tun1=&quot;gif1&quot; Tun1Ip=&quot;10.0.1.1&quot; Tun1Gw=&quot;10.0.1.2&quot;  # \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0439 \u043e\u0444\u0438\u0441 RemoteExtIp1=&quot;172.16.1.2&quot; RemoteExtIp2=&quot;172.17.1.2&quot; RemoteSRV=&quot;172.17.2.1&quot;  # \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b \u0434\u043b\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 permit_tcp_ports=&quot;22,53,80,443&quot; permit_udp_ports=&quot;53,123&quot;  ######## table section ######## # \u0441\u0435\u0442\u0438 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043e\u0444\u0438\u0441\u0430 table &lt;remote_nets&gt; { 172.17.2.0\/24 }  ######## 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<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u2014 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 2 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430, nat \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">#NAT \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 nat pass on $ExtIf1 from { $IntIf1Net, $IntIf2Net } to any -&gt; $ExtIf1Ip1 nat pass on $ExtIf2 from { $IntIf1Net, $IntIf2Net } to any -&gt; $ExtIf2Ip1<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0431\u0440\u043e\u0441\u044b \u043f\u043e\u0440\u0442\u043e\u0432 \u2014 http(s) \u0438 \u043f\u043e\u0440\u0442 2022 \u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u043d\u0430 \u043f\u043e\u0440\u0442 22 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">#\u041f\u0440\u043e\u0431\u0440\u043e\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 rdr on $ExtIf1 proto tcp from any to $ExtIf1Ip1 port { http, https} tag DSTNAT -&gt; $IntSRV rdr on $ExtIf2 proto tcp from any to $ExtIf2Ip1 port { http, https} tag DSTNAT -&gt; $IntSRV rdr on $ExtIf1 proto tcp from any to $ExtIf1Ip1 port { 2022 } tag DSTNAT -&gt; $IntSRV port ssh rdr on $ExtIf2 proto tcp from any to $ExtIf2Ip1 port { 2022 } tag DSTNAT -&gt; $IntSRV port ssh<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u044f \u0442\u044d\u0433\u0438, \u044f \u043f\u0438\u0441\u0430\u043b, \u0447\u0442\u043e \u043e\u043d\u0438 \u043a\u0440\u0430\u0439\u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u044b \u043f\u0440\u0438 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f\u0445. \u0412\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u044f\u0440\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440. \u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u0442\u0435\u0433\u0430 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u044b \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0443\u0447\u0443 \u043f\u0440\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u043e\u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u044d\u0442\u0430 \u043a\u0443\u0447\u0430 \u0440\u0430\u0441\u0442\u0435\u0442 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e. \u0422\u044d\u0433 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043e\u0441\u043e\u0431\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044e\u0449\u0435\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430.<\/p>\n<p>  <\/p>\n<h2 id=\"marshrutizaciya-otvetnyh-paketov\">\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432<\/h2>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0447\u0435\u0440\u0435\u0437 \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u043d\u0430\u0448\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0448\u043b\u044e\u0437 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0412\u043e FreeBSD \u043d\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430\u0448 \u0440\u043e\u0443\u0442\u0435\u0440 \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u0442\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043a\u0443\u0434\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442. \u0422\u043e \u0435\u0441\u0442\u044c, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0430\u043a\u0435\u0442 \u043d\u0430 re1 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b\u0438 \u0441 re0 \u043e\u0442\u0432\u0435\u0442. \u0422\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. <\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e. \u0423 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 pass \u0432 PF \u0435\u0441\u0442\u044c \u043e\u043f\u0446\u0438\u044f reply-to (Interface [Gateway]), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0443\u0434\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442. \u0412\u0441\u0435 \u043e\u043f\u0446\u0438\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u0443\u0447\u0448\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442, \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0443.<\/li>\n<li>PF \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0441\u0442\u0435\u0439\u0442, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0430\u043a\u0435\u0442\u044b \u043f\u043e\u0439\u0434\u0443\u0442 \u043a\u0430\u043a \u0432 \u043e\u0434\u043d\u0443, \u0442\u0430\u043a \u0438 \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443.<\/li>\n<li>\u041f\u0430\u043a\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443. \u041d\u0430 \u043d\u0435\u0433\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043e\u0442\u0432\u0435\u0442.<\/li>\n<li>\u0418 \u0432\u043e\u0442 \u044d\u0442\u043e\u0442 \u043e\u0442\u0432\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u0443\u0434\u0430, \u043a\u0443\u0434\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043e\u043f\u0446\u0438\u0438 reply-to.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0437 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442.   <\/p>\n<pre><code class=\"plaintext\">pass in quick on $ExtIf1 proto tcp to { $ExtIf1Ip1 } port 22<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass in quick on $ExtIf2 reply-to ( $ExtIf2 $ExtIf2Gw ) proto tcp to { $ExtIf2Ip1 } port 22<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 22 \u043f\u043e\u0440\u0442\u0443 \u0441\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c icmp<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass in quick on $ExtIf1 proto icmp pass in quick on $ExtIf2 reply-to ($ExtIf2 $ExtIf2Gw ) proto icmp<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0431\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0440\u0442\u043e\u0432, \u0442\u044d\u0433 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0431\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0440\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass in quick on $ExtIf1 tagged DSTNAT pass in quick on $ExtIf2 reply-to ($ExtIf2 $ExtIf2Gw ) tagged DSTNAT<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0445\u043e\u0434\u0438\u0442\u044c \u043a \u043d\u0430\u043c \u0441\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0438\u043b\u0438\u0430\u043b\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass in quick on $ExtIf1 from $RemoteExtIp1 tag PASS pass in quick on $ExtIf2 reply-to ($ExtIf2 $ExtIf2Gw ) from $RemoteExtIp2 tag PASS<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 \u0441\u0442\u0440\u043e\u0438\u043b\u0438\u0441\u044c \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e. \u041e\u0442\u0432\u0435\u0442\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0447\u0435\u0440\u0435\u0437 \u0442\u043e\u0442 \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0441\u0435\u0441\u0441\u0438\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"marshrutizaciya-sredstvami-pf\">\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 PF<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u043e\u0442 \u043f\u0435\u0440\u0432\u043e\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430, \u0430 \u043e\u0442 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0435\u0440\u0435\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 pass \u0435\u0441\u0442\u044c \u043e\u043f\u0446\u0438\u044f route-to (Interface [Gateway]). \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0443\u0434\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a, \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0439 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u043e, \u0434\u043b\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0447\u0435\u0440\u0435\u0437 \u0432\u0442\u043e\u0440\u043e\u0439 \u0442\u0443\u043d\u043d\u0435\u043b\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass in quick on $IntIf1 route-to ( $Tun1 $Tun1Gw ) from ($IntIf1:network) to $RemoteSRV tag PASS pass in quick on $IntIf2 route-to ( $Tun1 $Tun1Gw ) from ($IntIf2:network) to $RemoteSRV tag PASS<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0435\u0442\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass in on $IntIf1 from { ($IntIf1:network) } tag PASS<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0432\u0442\u043e\u0440\u043e\u0439, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass in quick on $IntIf2 route-to ( $ExtIf2 $ExtIf2Gw ) from { $IntIf2Net}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u0448\u043b\u044e\u0437 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u043e\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass out quick on $ExtIf1 route-to ($ExtIf1 $ExtIf1SomeOtherGw) \\          proto tcp from $ExtIf1 to $SomeServer port 80 <\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 PF \u2014 \u043e\u0447\u0435\u043d\u044c \u0433\u0438\u0431\u043a\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u041e\u0434\u043d\u0430\u043a\u043e, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f: \u043a\u0443\u0434\u0430, \u0447\u0442\u043e \u0438 \u0437\u0430\u0447\u0435\u043c \u0438\u0434\u0435\u0442. \u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 &quot;\u0440\u0430\u0441\u043f\u0443\u0445\u0430\u043d\u0438\u044f&quot; \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. \u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b, \u0447\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u0444\u0430\u0435\u0440\u0432\u043e\u043b\u0430.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">######## macros section ######## ExtIf1=&quot;re0&quot; # \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ExtIf1Ip1=&quot;172.16.1.1&quot; # \u0412\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0430\u0434\u0440\u0435\u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e ExtIf1Gw=&quot;172.16.1.254&quot; # \u0448\u043b\u044e\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430  ExtIf2=&quot;re1&quot; # \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ExtIf2Ip1=&quot;172.17.1.1&quot; # \u0412\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0430\u0434\u0440\u0435\u0441 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 ExtIf2Gw=&quot;172.17.1.254&quot; # \u0448\u043b\u044e\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430  IntIf1=&quot;em0&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 1 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;  IntIf2=&quot;em1&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 2 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;  # \u0442\u0443\u043d\u043d\u0435\u043b\u0438 Tun0=&quot;gif0&quot; Tun0Ip=&quot;10.0.0.1&quot; Tun0Gw=&quot;10.0.0.2&quot;  Tun1=&quot;gif1&quot; Tun1Ip=&quot;10.0.1.1&quot; Tun1Gw=&quot;10.0.1.2&quot;  # \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0439 \u043e\u0444\u0438\u0441 RemoteExtIp1=&quot;172.16.1.2&quot; RemoteExtIp2=&quot;172.17.1.2&quot; RemoteSRV=&quot;172.17.2.1&quot;  # \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b \u0434\u043b\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 permit_tcp_ports=&quot;22,53,80,443&quot; permit_udp_ports=&quot;53,123&quot;  ######## table section ######## # \u0441\u0435\u0442\u0438 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043e\u0444\u0438\u0441\u0430 table &lt;remote_nets&gt; { 172.17.2.0\/24 }  ######## 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 ########  #NAT \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 nat pass on $ExtIf1 from { $IntIf1Net, $IntIf2Net } to any -&gt; $ExtIf1Ip1 nat pass on $ExtIf2 from { $IntIf1Net, $IntIf2Net } to any -&gt; $ExtIf2Ip1  #\u041f\u0440\u043e\u0431\u0440\u043e\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 rdr on $ExtIf1 proto tcp from any to $ExtIf1Ip1 port { http, https} tag DSTNAT -&gt; $IntSRV rdr on $ExtIf2 proto tcp from any to $ExtIf2Ip1 port { http, https} tag DSTNAT -&gt; $IntSRV rdr on $ExtIf1 proto tcp from any to $ExtIf1Ip1 port { 2022 } tag DSTNAT -&gt; $IntSRV port ssh rdr on $ExtIf2 proto tcp from any to $ExtIf2Ip1 port { 2022 } tag DSTNAT -&gt; $IntSRV port ssh  ######## 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. ##  pass in quick from 192.168.11.0\/24 tag PASS  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c ssh \u0438 icmp pass in quick on $ExtIf1 proto tcp to { $ExtIf1Ip1 } port 22 pass in quick on $ExtIf2 reply-to ( $ExtIf2 $ExtIf2Gw ) proto tcp to { $ExtIf2Ip1 } port 22   pass in quick on $ExtIf1 proto icmp pass in quick on $ExtIf2 reply-to ($ExtIf2 $ExtIf2Gw ) proto icmp  pass in quick on $ExtIf1 tagged DSTNAT pass in quick on $ExtIf2 reply-to ($ExtIf2 $ExtIf2Gw ) tagged DSTNAT  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u0441\u0451 \u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0438\u043b\u0438\u0430\u043b\u0430 pass in quick on $ExtIf1 from $RemoteExtIp1 tag PASS pass in quick on $ExtIf2 reply-to ($ExtIf2 $ExtIf2Gw ) from $RemoteExtIp2 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 ##  # \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0430\u0444\u0438\u043a \u043d\u0430 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 pass in quick on $IntIf1 route-to ( $Tun1 $Tun1Gw ) from ($IntIf1:network) to $RemoteSRV tag PASS pass in quick on $IntIf2 route-to ( $Tun1 $Tun1Gw ) from ($IntIf2:network) to $RemoteSRV tag PASS  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c pass in quick on $IntIf1 from $IntIf1Net to &lt;remote_nets&gt; tag PASS pass in quick on $IntIf2 from { $IntIf2Net }  to &lt;remote_nets&gt; tag PASS  pass in quick on $IntIf1 from { ($IntIf1:network) } tag PASS pass in quick on $IntIf2 route-to ( $ExtIf2 $ExtIf2Gw ) from { $IntIf2Net }  ## \u0418 \u0434\u043b\u044f \u0442\u0443\u043d\u043d\u0435\u043b\u0435\u0439 ## pass in quick on $Tun0 from &lt;remote_nets&gt; tag PASS pass in quick on $Tun1 reply-to ( $Tun1 $Tun1Gw) from &lt;remote_nets&gt; 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 on { $IntIf1,$IntIf2 }  pass out quick on { $ExtIf1, $ExtIf2, gif0, gif1 } proto tcp to any port { $permit_tcp_ports } pass out quick on { $ExtIf1, $ExtIf2, gif0, gif1 } proto udp to any port { $permit_udp_ports } pass out quick on { $ExtIf1, $ExtIf2, gif0, gif1 } proto icmp  pass out tagged DSTNAT pass out tagged PASS<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h2 id=\"alternativnye-tablicy-marshrutizacii\">\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b \u0444\u0430\u0435\u0440\u0432\u043e\u043b\u0430 \u0432 \u041e\u0421 FreeBSD \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c multiple routing tables. \u0414\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432 \/etc\/loader.conf \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">net.fibs=2<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440. \u042d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0442\u0430\u0431\u043b\u0438\u0446 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438. \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u2014 16.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u043f\u043e\u043b\u044c\u0437\u0443\u044f\u0441\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u043e\u0439 setfib \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u2014 \u043d\u0443\u043b\u0435\u0432\u0430\u044f<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># netstat -4 -rn # setfib 0 netstat -4 -rn<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0432\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 (\u043b\u0438\u0448\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u044b):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Routing tables  Internet: Destination        Gateway            Flags     Netif Expire default            172.16.1.254       UGS         re0 10.0.0.2           link#7             UH         gif0 10.0.1.2           link#8             UH         gif1 127.0.0.1          link#5             UH          lo0 172.16.1.0\/24      link#1             U           re0 172.16.2.0\/24      link#2             U           em0 172.16.3.0\/24      link#3             U           em1 172.17.1.0\/24      link#4             U           re1 172.17.2.0\/24      10.0.0.2           UGS        gif0<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f setfib \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u043d\u043e\u043c\u0435\u0440\u043e\u043c :<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># setfib 1 netstat -4 -rn<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Routing tables (fib: 1)  Internet: Destination        Gateway            Flags     Netif Expire default            172.17.1.254       UGS         re1 10.0.0.2           link#7             UH         gif0 10.0.1.2           link#8             UH         gif1 127.0.0.1          link#5             UH          lo0 172.16.1.0\/24      link#1             U           re0 172.16.2.0\/24      link#2             U           em0 172.16.3.0\/24      link#3             U           em1 172.17.1.0\/24      link#4             U           re1 172.17.2.0\/24      10.0.1.2           UGS        gif1<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u0430\u0440\u0448\u0440\u0443\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0447\u0435\u0440\u0435\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430, \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0434\u043e \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u0432\u0442\u043e\u0440\u043e\u0439 \u0442\u0443\u043d\u043d\u0435\u043b\u044c.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e \u043d\u0443\u0436\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0443\u0436\u043d\u043e \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u0435 PF \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0451 \u043d\u043e\u043c\u0435\u0440 \u043e\u043f\u0446\u0438\u0435\u0439 rtable:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pass in quick on $IntIf1 from ($IntIf1:network) to $RemoteSRV rtable 1 tag PASS pass in quick on $IntIf2 from ($IntIf2:network) to $RemoteSRV rtable 1 tag PASS  pass in quick on $IntIf2 from { $IntIf2Net } rtable 1 tag PASS<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">######## macros section ######## ExtIf1=&quot;re0&quot; # \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ExtIf1Ip1=&quot;172.16.1.1&quot; # \u0412\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0430\u0434\u0440\u0435\u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e ExtIf1Gw=&quot;172.16.1.254&quot; # \u0448\u043b\u044e\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430  ExtIf2=&quot;re1&quot; # \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ExtIf2Ip1=&quot;172.17.1.1&quot; # \u0412\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0430\u0434\u0440\u0435\u0441 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 ExtIf2Gw=&quot;172.17.1.254&quot; # \u0448\u043b\u044e\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430  IntIf1=&quot;em0&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 1 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;  IntIf2=&quot;em1&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 2 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;  # \u0442\u0443\u043d\u043d\u0435\u043b\u0438 Tun0=&quot;gif0&quot; Tun0Ip=&quot;10.0.0.1&quot; Tun0Gw=&quot;10.0.0.2&quot;  Tun1=&quot;gif1&quot; Tun1Ip=&quot;10.0.1.1&quot; Tun1Gw=&quot;10.0.1.2&quot;  # \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0439 \u043e\u0444\u0438\u0441 RemoteExtIp1=&quot;172.16.1.2&quot; RemoteExtIp2=&quot;172.17.1.2&quot; RemoteSRV=&quot;172.17.2.1&quot;  # \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b \u0434\u043b\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 permit_tcp_ports=&quot;22,53,80,443&quot; permit_udp_ports=&quot;53,123&quot;  ######## table section ######## # \u0441\u0435\u0442\u0438 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043e\u0444\u0438\u0441\u0430 table &lt;remote_nets&gt; { 172.17.2.0\/24 }  ######## 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 ########  #NAT \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 nat pass on $ExtIf1 from { $IntIf1Net, $IntIf2Net } to any -&gt; $ExtIf1Ip1 nat pass on $ExtIf2 from { $IntIf1Net, $IntIf2Net } to any -&gt; $ExtIf2Ip1  #\u041f\u0440\u043e\u0431\u0440\u043e\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 rdr on $ExtIf1 proto tcp from any to $ExtIf1Ip1 port { http, https} tag DSTNAT -&gt; $IntSRV rdr on $ExtIf2 proto tcp from any to $ExtIf2Ip1 port { http, https} tag DSTNAT -&gt; $IntSRV rdr on $ExtIf1 proto tcp from any to $ExtIf1Ip1 port { 2022 } tag DSTNAT -&gt; $IntSRV port ssh rdr on $ExtIf2 proto tcp from any to $ExtIf2Ip1 port { 2022 } tag DSTNAT -&gt; $IntSRV port ssh  ######## 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. ##  pass in quick from 192.168.11.0\/24 tag PASS  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c ssh \u0438 icmp pass in quick on $ExtIf1 proto tcp to { $ExtIf1Ip1 } port 22 pass in quick on $ExtIf2 reply-to ( $ExtIf2 $ExtIf2Gw ) proto tcp to { $ExtIf2Ip1 } port 22   pass in quick on $ExtIf1 proto icmp pass in quick on $ExtIf2 reply-to ($ExtIf2 $ExtIf2Gw ) proto icmp  pass in quick on $ExtIf1 tagged DSTNAT pass in quick on $ExtIf2 reply-to ($ExtIf2 $ExtIf2Gw ) tagged DSTNAT  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u0441\u0451 \u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0438\u043b\u0438\u0430\u043b\u0430 pass in quick on $ExtIf1 from $RemoteExtIp1 tag PASS pass in quick on $ExtIf2 reply-to ($ExtIf2 $ExtIf2Gw ) from $RemoteExtIp2 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 ##  # \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0430\u0444\u0438\u043a \u043d\u0430 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 pass in quick on $IntIf1 from ($IntIf1:network) to $RemoteSRV rtable 1 tag PASS pass in quick on $IntIf2 from ($IntIf2:network) to $RemoteSRV rtable 1 tag PASS  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c pass in quick on $IntIf1 from $IntIf1Net to &lt;remote_nets&gt; tag PASS pass in quick on $IntIf2 from $IntIf2Net  to &lt;remote_nets&gt; tag PASS  pass in quick on $IntIf1 from { ($IntIf1:network) } tag PASS pass in quick on $IntIf2 from { $IntIf2Net } rtable 1 tag PASS  ## \u0418 \u0434\u043b\u044f \u0442\u0443\u043d\u043d\u0435\u043b\u0435\u0439 ## pass in quick on $Tun0 from &lt;remote_nets&gt; tag PASS pass in quick on $Tun1 reply-to ( $Tun1 $Tun1Gw) from &lt;remote_nets&gt; 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 on { $IntIf1,$IntIf2 }  pass out quick on { $ExtIf1, $ExtIf2, gif0, gif1 } proto tcp to any port { $permit_tcp_ports } pass out quick on { $ExtIf1, $ExtIf2, gif0, gif1 } proto udp to any port { $permit_udp_ports } pass out quick on { $ExtIf1, $ExtIf2, gif0, gif1 } proto icmp  pass out tagged DSTNAT pass out tagged PASS <\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0438\u043b\u0438\u0430\u043b\u0430<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">######## macros section ######## ExtIf1=&quot;re0&quot; # \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ExtIf1Ip1=&quot;172.16.1.2&quot; # \u0412\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0430\u0434\u0440\u0435\u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e ExtIf1Gw=&quot;172.16.1.254&quot; # \u0448\u043b\u044e\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430  ExtIf2=&quot;re1&quot; # \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ExtIf2Ip1=&quot;172.17.1.2&quot; # \u0412\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0430\u0434\u0440\u0435\u0441 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 ExtIf2Gw=&quot;172.17.1.254&quot; # \u0448\u043b\u044e\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430  IntIf1=&quot;em0&quot; # \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 1 IntIf1Ip=&quot;172.17.2.254&quot; # ip \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e 0 IntIf1Net=&quot;172.17.2.0\/24&quot; IntSRV=&quot;172.17.2.1&quot;  # \u0442\u0443\u043d\u043d\u0435\u043b\u0438 Tun0=&quot;gif0&quot; Tun0Ip=&quot;10.0.0.2&quot; Tun0Gw=&quot;10.0.0.1&quot;  Tun1=&quot;gif1&quot; Tun1Ip=&quot;10.0.1.2&quot; Tun1Gw=&quot;10.0.1.1&quot;  # \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0439 \u043e\u0444\u0438\u0441 RemoteExtIp1=&quot;172.16.1.1&quot; RemoteExtIp2=&quot;172.17.1.1&quot; RemoteSRV=&quot;172.17.3.1&quot;  # \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442\u044b \u0434\u043b\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 permit_tcp_ports=&quot;22,53,80,443&quot; permit_udp_ports=&quot;53,123&quot;  ######## table section ######## # \u0441\u0435\u0442\u0438 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043e\u0444\u0438\u0441\u0430 table &lt;remote_nets&gt; { 172.16.2.0\/24, 172.16.3.0\/24 }  ######## 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 ########  #NAT \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 nat pass on $ExtIf1 from { $IntIf1Net } to any -&gt; $ExtIf1Ip1 nat pass on $ExtIf2 from { $IntIf1Net } to any -&gt; $ExtIf2Ip1  #\u041f\u0440\u043e\u0431\u0440\u043e\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 rdr on $ExtIf1 proto tcp from any to $ExtIf1Ip1 port { http, https} tag DSTNAT -&gt; $IntSRV rdr on $ExtIf2 proto tcp from any to $ExtIf2Ip1 port { http, https} tag DSTNAT -&gt; $IntSRV rdr on $ExtIf1 proto tcp from any to $ExtIf1Ip1 port { 2022 } tag DSTNAT -&gt; $IntSRV port ssh rdr on $ExtIf2 proto tcp from any to $ExtIf2Ip1 port { 2022 } tag DSTNAT -&gt; $IntSRV port ssh  ######## 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. ##  pass in quick from 192.168.11.0\/24 tag PASS  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c ssh \u0438 icmp pass in quick on $ExtIf1 proto tcp to { $ExtIf1Ip1 } port 22 pass in quick on $ExtIf2 reply-to ( $ExtIf2 $ExtIf2Gw ) proto tcp to { $ExtIf2Ip1 } port 22   pass in quick on $ExtIf1 proto icmp pass in quick on $ExtIf2 reply-to ($ExtIf2 $ExtIf2Gw ) proto icmp  pass in quick on $ExtIf1 tagged DSTNAT pass in quick on $ExtIf2 reply-to ($ExtIf2 $ExtIf2Gw ) tagged DSTNAT  # \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u0441\u0451 \u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0438\u043b\u0438\u0430\u043b\u0430 pass in quick on $ExtIf1 from $RemoteExtIp1 tag PASS pass in quick on $ExtIf2 reply-to ($ExtIf2 $ExtIf2Gw ) from $RemoteExtIp2 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 ##  pass in on $IntIf1 from { ($IntIf1:network) } tag PASS  ## \u0418 \u0434\u043b\u044f \u0442\u0443\u043d\u043d\u0435\u043b\u0435\u0439 ## pass in quick on $Tun0 from &lt;remote_nets&gt; tag PASS pass in quick on $Tun1 reply-to ( $Tun1 $Tun1Gw) from &lt;remote_nets&gt; 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 on { $IntIf1,$IntIf2 }  pass out quick on { $ExtIf1, $ExtIf2, gif0, gif1 } proto tcp to any port { $permit_tcp_ports } pass out quick on { $ExtIf1, $ExtIf2, gif0, gif1 } proto udp to any port { $permit_udp_ports } pass out quick on { $ExtIf1, $ExtIf2, gif0, gif1 } proto icmp  pass out tagged DSTNAT pass out tagged PASS<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438, \u043a\u0430\u043a \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0443\u044e \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432 \u0438 \u0442\u0443\u043d\u043d\u0435\u043b\u0438. Source Based Routing \u2014 \u044d\u0442\u043e \u0433\u0438\u0431\u043a\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0432 \u0440\u0443\u043a\u0430\u0445 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430, \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0449\u0438\u0439 \u0436\u0438\u0437\u043d\u044c \u0432 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445. <\/p>\n<p>  <\/p>\n<p>\u0423 \u043d\u0430\u0441 \u0432 \u0418\u041a\u0421 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 PF, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0430\u043c\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0438\u043c\u0435\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0441\u0435\u0442\u0435\u0439.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0441\u0442\u044d\u043a FreeBSD \u0438 \u0435\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0444\u0430\u0439\u0440\u0432\u043e\u043b\u0430\u043c\u0438. \u0410 \u043f\u043e\u043a\u0430 \u044f \u0431\u0443\u0434\u0443 \u0435\u0435 \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c, \u0443 \u0432\u0430\u0441 \u0445\u0432\u0430\u0442\u0438\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 <a href=\"https:\/\/xserver.a-real.ru\/download\/?utm_source=habr&amp;utm_medium=blog&amp;utm_content=article020421&amp;utm_term=download\">\u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0418\u041a\u0421<\/a> \u0432 \u0441\u0432\u043e\u0435\u0439 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u0422\u0440\u0438\u0430\u043b 35 \u0434\u043d\u0435\u0439, \u0431\u043e\u043d\u0443\u0441 \u0432 \u0432\u0438\u0434\u0435 \u0434\u043e\u0431\u0440\u043e\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0439 \u0442\u0435\u0445\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438.<\/p>\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\/550376\/\"> https:\/\/habr.com\/ru\/company\/ics\/blog\/550376\/<\/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><a href=\"https:\/\/habr.com\/ru\/company\/ics\/blog\/549150\/\">FreeBSD. \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438, \u0442\u044d\u0433\u0438 \u0438 \u044f\u043a\u043e\u0440\u044f \u0432 PF<\/a><\/li>\n<li>FreeBSD. \u0423\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 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\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 PF. \u0421\u043e\u0437\u0434\u0430\u043b\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0438 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043e\u0444\u0438\u0441. <\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 PF \u0438 FreeBSD \u0432 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438. Policy Based Routing (PBR), Source Based Routing (SBR), \u0443\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f, \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u043e\u043b\u0438\u0442\u0438\u043a, \u0432\u0441\u0435 \u044d\u0442\u0438 \u043f\u043e\u043d\u044f\u0442\u0438\u044f, \u043f\u043e \u0441\u0443\u0442\u0438, \u0440\u0430\u0432\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b \u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043e\u0434\u043d\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c. \u0412\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b, \u043b\u0438\u0431\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0430\u0432\u0438\u043b \u0444\u0430\u0435\u0440\u0432\u043e\u043b\u0430. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/k_\/6b\/oy\/k_6boypn9hnikqd_tcsi3zgfb7q.png\">  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432, \u043b\u0438\u0431\u043e \u0443\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043c\u0435\u0436\u0434\u0443 \u0412\u041f\u041d \u043a\u0430\u043d\u0430\u043b\u0430\u043c\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0431\u0430 \u044d\u0442\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430.<\/p>\n<p>  <\/p>\n<p><em>\u0414\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u044b.<\/em><\/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-320761","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320761","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=320761"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320761\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=320761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=320761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=320761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}