{"id":161,"date":"2010-06-18T15:53:11","date_gmt":"2010-06-18T12:53:11","guid":{"rendered":"http:\/\/skeletor.org.ua\/wordpress\/?p=161"},"modified":"2017-03-24T10:28:58","modified_gmt":"2017-03-24T08:28:58","slug":"%d1%88%d0%bb%d1%8e%d0%b7-%d0%b2-%d0%b8%d0%bd%d0%b5%d1%82-%d1%81-%d0%bf%d0%be%d0%bc%d0%be%d1%89%d1%8c%d1%8e-pf-pfnat-squid","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=161","title":{"rendered":"[pf] \u0428\u043b\u044e\u0437 \u0432 \u0438\u043d\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e pf, pfnat, squid"},"content":{"rendered":"<p><strong><em><span style=\"color: #008000;\">\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0430 7.06.2010<\/span><\/em><\/strong><\/p>\n<p><em><strong><span style=\"color: #ff6600;\">\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/span><\/strong><\/em><\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 <strong>squid<\/strong>, \u043f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u043e\u043c \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438.<\/p>\n<p><em><span style=\"color: #ff6600;\">1) \u0412 9.2-Stable \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u0431\u0430\u0433: \u043b\u044e\u0431\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432\u044b\u0440\u0443\u0431\u0430\u043b\u043e \u0444\u043e\u0440\u0432\u0430\u0440\u0434\u0438\u043d\u0433, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 net.inet.ip.forwarding \u0432 0. \u0427\u0442\u043e \u0431\u044b \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0431\u044b\u043b\u043e, \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c gateway_enable=&#8221;YES&#8221; \u0432 rc.conf<\/span><\/em><\/p>\n<p><span style=\"color: #ff6600;\"><em>2) \u0427\u0442\u043e \u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u043a\u0441\u0438, \u043d\u0443\u0436\u043d\u043e \u0434\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443 \/dev\/pf \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 (\u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 squid \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0438\u0437-\u043f\u043e\u0434 root&#8217;a):<\/em><\/span><\/p>\n<p><code># chmod o+r \/dev\/pf<\/code><\/p>\n<p>&nbsp;<\/p>\n<p><strong><span style=\"color: #ff0000;\">1) \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c pf.<\/span><\/strong><\/p>\n<p>\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e 2 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438: \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 <strong>rc.conf<\/strong> \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u044f\u0434\u0440\u043e. \u0412\u044b\u0431\u0438\u0440\u0430\u0439\u0442\u0435 \u0442\u043e\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u0435\u0435. \u042f \u0436\u0435 \u043e\u043f\u0438\u0448\u0443 \u043e\u0431\u0430.<\/p>\n<p><span style=\"color: #ff6600;\">&#8211;\u00a0<strong><em><span style=\"color: #ff6600;\">\u0427\u0435\u0440\u0435\u0437 rc.conf<\/span><\/em><\/strong><\/span><\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b<strong> \/etc\/rc.conf<\/strong>:<\/p>\n<p><code>pf_enable=\"YES\"<br \/>\npf_rules=\"\/etc\/pf.rules\"<br \/>\npflog_enable=\"YES\"<\/code><\/p>\n<p><!--more--><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0430\u043c\u00a0<strong>pf<\/strong>:<\/p>\n<p><code>#\/etc\/rc.d\/pf start<\/code><\/p>\n<p><span style=\"color: #ff6600;\">&#8211;<\/span> <span style=\"color: #ff6600;\"><strong><em><span style=\"color: #ff6600;\">\u0427\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440 \u044f\u0434\u0440<\/span><span style=\"color: #ff6600;\">\u0430<\/span><\/em><\/strong>.<\/span><\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0444\u0430\u0439\u043b \u044f\u0434\u0440\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u043f\u0446\u0438\u0438:<\/p>\n<p><code>device\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pf<br \/>\ndevice\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pflog<br \/>\noptions\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ALTQ<\/code><\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u043e\u0435 \u0432\u00a0<strong>\/etc\/rc.conf<\/strong> (\u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b):<\/p>\n<p><code>pf_rules=\"\/etc\/pf.rules\"<\/code><\/p>\n<p>\u041f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u044f\u0434\u0440\u043e, \u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u0430\u0448\u0438\u043d\u0443. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0444\u0430\u0439\u0435\u0440\u0432\u043e\u043b.<\/p>\n<p><strong><span style=\"color: #ff0000;\">2) \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 squid.<\/span><\/strong><\/p>\n<p>\u041f\u0440\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c\u00a0<a href=\"\/?p=45\" target=\"_blank\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0435\u0441\u0442\u044c, \u0442\u0430\u043a \u044d\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u00a0<strong>squid<\/strong> \u0441 \u043e\u043f\u0446\u0438\u0435\u0439\u00a0<strong>SQUID_PF<\/strong>.<\/p>\n<p><strong><span style=\"color: #ff0000;\">3) NAT<\/span><\/strong><\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<strong>pfnat<\/strong>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0430\u0432\u0438\u043b \u0441\u0442\u0440\u043e\u0447\u043a\u0443:<\/p>\n<p><code>nat on $ext_if from $local_network\/$netmask to any -&gt; ($ext_if)<\/code><\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,<\/p>\n<p><code>nat on rl0 from 192.168.0.0\/24 to any -&gt; (rl0)<\/code><\/p>\n<p><strong><em><span style=\"color: #ff6600;\">\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/span><\/em><\/strong> \u043a\u043e\u0433\u0434\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043b\u044f \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438 \u0430\u0434\u0440\u0435\u0441\u043e\u0432, \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435, \u0442\u043e\u00a0<strong>IP<\/strong> \u0430\u0434\u0440\u0435\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u00a0<strong>pf.conf<\/strong> \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0430 \u043d\u0435 \u043d\u0430 &#8220;\u043b\u0435\u0442\u0443&#8221;. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435<strong>DHCP<\/strong> \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u0430\u0448\u0438\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439. \u0415\u0441\u043b\u0438 \u0432\u0430\u0448\u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0435\u00a0<strong>IP<\/strong> \u0430\u0434\u0440\u0435\u0441\u0430 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f,\u00a0<strong>NAT<\/strong> \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0442\u0430\u0440\u044b\u0439\u00a0<strong>IP<\/strong> \u0430\u0434\u0440\u0435\u0441. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c\u00a0<strong>PF<\/strong> \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c\u044b\u0439 \u0430\u0434\u0440\u0435\u0441, \u0443\u043a\u0430\u0437\u0430\u0432 \u043a\u0440\u0443\u0433\u043b\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<p><strong><span style=\"color: #ff0000;\">4) \u0424\u043e\u0440\u0432\u0430\u0440\u0434\u0438\u043d\u0433 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0442\u0435\u0432\u0443\u0445\u0430\u043c\u0438, \u043f\u043e\u0434\u0441\u0435\u0442\u044f\u043c\u0438.<\/span><\/strong><\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u044b \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u043b \u043f\u0430\u043a\u0435\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u0434\u0441\u0435\u0442\u044f\u043c\u0438, \u043d\u0443\u0436\u043d\u043e \u0432\u00a0<strong>\/etc\/rc.conf<\/strong> \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 (\u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0430\u043a):<\/p>\n<p><code>gateway_enable=\"YES\"<\/code><\/p>\n<p><strong><span style=\"color: #ff0000;\">5) \u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0444\u0430\u0439\u0435\u0432\u0440\u043e\u043b\u0430.<\/span><\/strong><\/p>\n<p>\u0414\u043b\u044f \u0441\u0430\u043c\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430:<\/p>\n<p><code># \u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0445, \u043a\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0445\u043e\u0434\u0438\u0442\u044c \u043c\u0438\u043c\u043e \u043f\u0440\u043e\u043a\u0441\u0438<br \/>\nno rdr on $int_if inet proto {tcp,udp} from 192.168.0.33\/32 to any<\/code><\/p>\n<p><code># squid<br \/>\nrdr on $int_if inet proto tcp from 192.168.0.0\/24 to any port 80 -&gt; 127.0.0.1 port 3128<\/code><\/p>\n<p><code># \u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u043f\u043e\u0440\u0442\u0430 \u0434\u043b\u044f rdesktop<br \/>\nrdr on $ext_if inet proto tcp from any to xx.xx.xx.xx port 3389 -&gt; 192.168.0.2 port 3389<\/code><\/p>\n<p><code># nat<br \/>\nnat on $ext_if from 192.168.0.0\/24 to any -&gt; (rl0)<\/code><\/p>\n<p><code>pass all<\/code><\/p>\n<p><span style=\"color: #ff6600;\"><em><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/strong><\/em><\/span><\/p>\n<p>\u0412 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 pf&#8217;a \u0432\u043c\u0435\u0441\u0442\u043e <strong>rdr<\/strong> \u0434\u043b\u044f \u0437\u0430\u0432\u043e\u0440\u043e\u0442\u0430 \u043d\u0430 <strong>proxy<\/strong> \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>divert-to\/divert-reply<\/strong>. \u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u043d\u0435 \u0441\u043c\u043e\u0433\u0443:<\/p>\n<blockquote><p><span style=\"color: #993366;\">rdr-to is a general purpose address translation and can forward to\u00a0<\/span><br \/>\n<span style=\"color: #993366;\">either the local machine or a different machine. By a small hack\u00a0<\/span><br \/>\n<span style=\"color: #993366;\">(using the &#8220;bitmask&#8221; option) it&#8217;s also possible to rewrite destination\u00a0<\/span><br \/>\n<span style=\"color: #993366;\">ports and keep the original address. It rewrites addresses in the\u00a0<\/span><br \/>\n<span style=\"color: #993366;\">packets, so it&#8217;s more suited to &#8220;port forwarding&#8221;. It can been used\u00a0<\/span><br \/>\n<span style=\"color: #993366;\">to implement transparent proxies, but requires looking up the original\u00a0<\/span><br \/>\n<span style=\"color: #993366;\">destination address using a state table lookup (DIOCNATLOOK), but\u00a0<\/span><br \/>\n<span style=\"color: #993366;\">this is relatively complex and requires privileges to access \/dev\/pf.\u00a0<\/span><\/p>\n<p><span style=\"color: #993366;\">For transparent proxies, divert-to is simpler. It only works on the\u00a0<\/span><br \/>\n<span style=\"color: #993366;\">local machine. It preserves the original destination address in the\u00a0<\/span><br \/>\n<span style=\"color: #993366;\">packet, allowing a simple method (getsockname) for proxy software\u00a0<\/span><br \/>\n<span style=\"color: #993366;\">to retrieve it without needing any special privileges.\u00a0<\/span><\/p><\/blockquote>\n<p>\u0412\u043e\u0442 <a href=\"http:\/\/wiki.squid-cache.org\/ConfigExamples\/Intercept\/OpenBsdPf\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a> \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b <strong>squid&#8217;a<\/strong><\/p>\n<p>\u0412\u044b\u0434\u0435\u0440\u0436\u043a\u0430 \u0438\u0437 <strong>man&#8217;a pf.conf<\/strong>:<\/p>\n<pre>divert-to &lt;host&gt; port &lt;port&gt;\r\n           Used to redirect packets to a local socket bound to host and port.\r\n           The packets will not be modified, so getsockname(2) on the socket\r\n           will return the original destination address of the packet.\r\n\r\ndivert-reply\r\n           Used to receive replies for sockets that are bound to addresses\r\n           which are not local to the machine.  See setsockopt(2) for \r\n           information on how to bind these sockets.<\/pre>\n<p><strong><span style=\"color: #ff0000;\">6) \u0420\u043e\u0442\u0430\u0446\u0438\u044f \u043b\u043e\u0433\u043e\u0432 squid&#8217;a<\/span><\/strong><\/p>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u043e\u0442\u0430\u0446\u0438\u044e \u043b\u043e\u0433\u043e\u0432 \u0432 cron:<\/p>\n<p><code>59 \u00a0 23\u00a0\u00a0 *\u00a0\u00a0 *\u00a0\u00a0 *\u00a0\u00a0 root\u00a0\u00a0 \/usr\/loca\/sbin\/squid -k rotate<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0430 7.06.2010 \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u041f\u0435\u0440\u0435\u0434 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 squid, \u043f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u043e\u043c \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. 1) \u0412 9.2-Stable \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u0431\u0430\u0433: \u043b\u044e\u0431\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432\u044b\u0440\u0443\u0431\u0430\u043b\u043e \u0444\u043e\u0440\u0432\u0430\u0440\u0434\u0438\u043d\u0433, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 net.inet.ip.forwarding \u0432 0. \u0427\u0442\u043e \u0431\u044b \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0431\u044b\u043b\u043e, \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c gateway_enable=&#8221;YES&#8221; \u0432 rc.conf 2) \u0427\u0442\u043e \u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u043a\u0441\u0438, \u043d\u0443\u0436\u043d\u043e \u0434\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,12],"tags":[],"class_list":["post-161","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-routers"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=161"}],"version-history":[{"count":12,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/161\/revisions"}],"predecessor-version":[{"id":5186,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/161\/revisions\/5186"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}