{"id":577,"date":"2010-10-21T12:41:51","date_gmt":"2010-10-21T09:41:51","guid":{"rendered":"http:\/\/skeletor.org.ua\/?p=577"},"modified":"2017-04-14T09:48:39","modified_gmt":"2017-04-14T06:48:39","slug":"ipfw-kernel-nat-squid","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=577","title":{"rendered":"ipfw, kernel nat, squid"},"content":{"rendered":"<p>\u041d\u0443 \u0432\u043e\u0442, \u043d\u0430 \u0441\u043c\u0435\u043d\u0443 \u0441\u0442\u0430\u0440\u043e\u043c\u0443 <strong>natd<\/strong> \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043d\u043e\u0432\u044b\u0439 <strong>kernel NAT<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u0430\u043a \u0437\u0430\u044f\u0432\u043b\u044f\u044e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0448\u0443\u0441\u0442\u0440\u0435\u0435, \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440, \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0434\u0430 \u0438 \u043c\u043d\u043e\u0433\u043e \u0435\u0449\u0451 \u0447\u0435\u0433\u043e. \u041d\u0438\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0448\u043b\u044e\u0437.<br \/>\n\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e <strong>natd<\/strong>, \u0442\u0430\u043a \u0447\u0442\u043e \u0432 \u043d\u0435\u0439 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u0448\u0435\u0441\u0442\u0432\u0430. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0435\u0440\u043f\u043d\u0443\u0442\u044c \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e <strong>natd<\/strong>.<\/p>\n<p><!--more--><\/p>\n<p><em><strong><span style=\"color: #ff6600;\">\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/span><\/strong><\/em><\/p>\n<p>1) \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>2) \u0412 <strong>src\/UPDATING<\/strong> (<strong>RELENG-9<\/strong>) \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0437\u0430\u043f\u0438\u0441\u044c, \u0438\u043d\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u043e\u0431 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u043e\u043f\u0446\u0438\u0438 <strong>IPFIREWALL_FORWARD<\/strong>. \u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 &#8220;\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438&#8221;, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u044f\u0434\u0440\u0430 <strong>ipfw.ko<\/strong>. \u0412 <strong>stable\/9<\/strong> \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c, \u043d\u043e \u0432 \u0440\u0435\u043b\u0438\u0437 \u043e\u043d\u043e \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0451\u0442. \u0418 \u0442\u0430\u043a, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 <strong>9.1<\/strong> \u0443\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u044f\u0434\u0440\u043e \u0434\u043b\u044f <strong>ipfw fwd<\/strong>. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043a\u0435 \u0441 \u044d\u0442\u043e\u0439 \u043e\u043f\u0446\u0438\u0435\u0439 <strong>make<\/strong> \u0431\u0443\u0434\u0435\u0442 \u0440\u0443\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u043e\u043f\u0446\u0438\u0438. \u0422\u0430\u043a \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u0448\u043b\u0430 \u0440\u0443\u0433\u0430\u043d\u044c &#8211; \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u044d\u0442\u0443 \u043e\u043f\u0446\u0438\u044e<\/p>\n<p>3) \u00a0\u0412 <strong>9.2-Stable<\/strong> \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 <strong>net.inet.ip.forwarding<\/strong> \u0432 <strong>0<\/strong>. \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 <strong>gateway_enable=&#8221;YES&#8221;<\/strong> \u0432 <strong>rc.conf<\/strong><\/p>\n<p><strong><span style=\"color: #ff0000;\">1) \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 IPFW+kernel NAT<\/span><\/strong><\/p>\n<p>\u041f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u044f\u0434\u0440\u043e \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u043e\u043f\u0446\u0438\u044f\u043c\u0438<\/p>\n<p><code>options\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 IPFIREWALL<br \/>\noptions\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 IPFIREWALL_NAT<br \/>\noptions\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 IPFIREWALL_FORWARD<br \/>\noptions\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 IPFIREWALL_DEFAULT_TO_ACCEPT<br \/>\noptions\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 IPFIREWALL_VERBOSE<br \/>\noptions\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 LIBALIAS<br \/>\noptions\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DUMMYNET<\/code><\/p>\n<p><strong><span style=\"color: #ff0000;\">2) \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c squid<\/span><\/strong><\/p>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0440\u0442\u044b \u0438 \u0441\u0442\u0430\u0432\u0438\u043c &#8220;\u043a\u0430\u043b\u044c\u043c\u0430\u0440\u0430&#8221;. \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e 3.0, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0438\u043d\u0435\u0442\u0435 \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0440\u0435\u0448\u0430\u0435\u043c\u044b.<br \/>\n\u041a\u043e\u043d\u0444\u0438\u0433 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 2.6, \u043f\u0440\u0430\u0432\u0434\u0430 \u043a\u043e\u0435-\u043a\u0430\u043a\u0438\u0435 \u043e\u043f\u0446\u0438\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c, \u0431\u0443\u0434\u044c\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b.<\/p>\n<p><strong><span style=\"color: #ff0000;\">3) \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0444\u0430\u0439\u0435\u0440\u0432\u043e\u043b\u0430 \u0438 NAT&#8217;a<\/span><\/strong><\/p>\n<p>\u0414\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 (\u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u0436\u0435 \u0432\u043a\u043e\u043c\u043f\u0438\u043b\u043b\u0435\u043d\u044b \u0432 \u044f\u0434\u0440\u043e) \u0432 <strong>\/etc\/rc.conf<\/strong>:<\/p>\n<p><code>gateway_enable=\"YES\"<br \/>\nfirewall_script=\/etc\/fire.wall<br \/>\n<\/code><br \/>\n\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0432\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u0430\u0432\u0438\u043b (\u0444\u0430\u0439\u043b <strong>\/etc\/fire.wall<\/strong>)<\/p>\n<p><code>#!\/bin\/sh<\/code><\/p>\n<p><code>FwCMD=\"\/sbin\/ipfw \"<br \/>\nExtIF=\"le1\"<br \/>\nExtIP=\"1.1.1.1\"<br \/>\nLocalNet=\"10.10.10.0\/24\"<\/code><\/p>\n<p><code>${FwCMD} -f flush<\/code><\/p>\n<p><code># deny flood traffic<br \/>\n${FwCMD} add 101 allow all from any to any via lo0<br \/>\n${FwCMD} add 102 deny all from any to 127.0.0.0\/8<br \/>\n${FwCMD} add 103 deny all from 127.0.0.0\/8 to any<\/code><\/p>\n<p><code>${FwCMD} add 110 deny icmp from any to any frag<\/code><\/p>\n<p><code># squid<br \/>\n${FwCMD} add 301 allow all from ${LocalNet} to me 3128<br \/>\n${FwCMD} add 302 fwd 127.0.0.1,3128 tcp from ${LocalNet} to any dst-port 80<\/code><\/p>\n<p><code># NAT<br \/>\n${FwCMD} nat 1 config if ${ExtIF} log \\<br \/>\nredirect_port tcp 10.10.10.55:22 4444 \\<br \/>\nredirect_port tcp 10.10.10.66:80 6666<br \/>\n${FwCMD} add 501 nat 1 ip from ${LocalNet} to any via ${ExtIF}<br \/>\n${FwCMD} add 502 nat 1 ip from any to ${ExtIP} via ${ExtIF}<\/code><\/p>\n<p><code>#${FwCMD} add 500 nat 1 ip from any to any via ${ExtIF}<\/code><\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u043c\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u0438\u043b\u0438 2 \u043f\u043e\u0440\u0442\u0430 \u043d\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043c\u0430\u0448\u0438\u043d\u044b, \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044f \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438 \u0441\u0438\u0441\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u0430 \u043f\u043e\u0440\u0442\u0430.<\/p>\n<p><strong><em><span style=\"color: #ff6600;\">\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/span><\/em><\/strong><\/p>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 <strong>NAT&#8217;a<\/strong> \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0448\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u0448\u0435 \u043f\u0440\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043d\u0430\u0440\u0443\u0436\u0443. \u0412\u043e\u0442 \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0430 \u0438\u0437 <strong>lissyara.su<\/strong>:<\/p>\n<blockquote><p><span style=\"color: #993366;\">\u041e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e DIVERT \u0432 MAN-\u0435 \u043f\u043e IPFW \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u043a\u0430\u044f \u0434\u0432\u0443\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e MAN-\u0443 \u0434\u043b\u044f \u043f\u0430\u043a\u0435\u0442\u0430 \u043f\u043e\u043f\u0430\u0432\u0448\u0435\u0433\u043e \u043f\u043e\u0434 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0441 DIVERT \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0439 \u043f\u043e\u0438\u0441\u043a \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f, \u0430 \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u0441\u0430\u043c\u0438\u043c \u043f\u0430\u043a\u0435\u0442\u043e\u043c &#8211; \u043d\u0435\u044f\u0441\u043d\u043e.\u00a0<\/span><br \/>\n<span style=\"color: #993366;\">\u042d\u043a\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438 \u0430\u0434\u0440\u0435\u0441\u043e\u0432, \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 DIVERT-\u0441\u043e\u043a\u0435\u0442, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u043f\u0443\u0442\u044c \u043f\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c IPFW \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441 DIVERT, \u0438\u043c\u0435\u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043d\u044b\u0439 (\u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439) IP \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435.<\/span><\/p><\/blockquote>\n<p><strong><em><span style=\"color: #ff6600;\">\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u04352.<\/span><\/em><\/strong><\/p>\n<p>\u0412\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 <strong>kernel nat<\/strong> \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0442\u044c <strong>TSO<\/strong> \u043d\u0430 \u0432\u0441\u0435\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445. \u0412\u043e\u0442, \u0447\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u0441\u044f \u0432 <strong>man&#8217;e<\/strong><\/p>\n<blockquote><p><span style=\"color: #993366;\">$man ipfw | tail | head -4<br \/>\nDue to the architecture of libalias(3), ipfw nat is not compatible with the TCP segmentation offloading (TSO). Thus, to reliably nat your network traffic, please disable TSO on your NICs using ifconfig(8). <\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #ff0000;\">4) \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438.<\/span><\/strong><\/p>\n<p>\u0414\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b<strong> ipfw+kernel nat<\/strong> \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u043c\u0438 \u0431\u043e\u043b\u0435\u0435 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u0438 <strong>rediretc&#8217;\u043e\u0432<\/strong>, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 (\u0434\u043b\u044f 9.0 \u0438 \u0432\u044b\u0448\u0435 \u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435 \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0442\u0430\u043c \u044d\u0442\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u043d\u044f\u0442\u044b):<\/p>\n<p><em><span style=\"color: #ff6600;\">&#8211; \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \/usr\/src\/sys\/netinet\/ip_fw.h<br \/>\n&#8211; \u0438\u0449\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443<\/span><\/em><\/p>\n<p><code>#define NAT_BUF_LEN\u00a0\u00a0\u00a0\u00a0 1024<\/code><\/p>\n<p><em><span style=\"color: #ff6600;\">&#8211; \u043c\u0435\u043d\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441 <strong>1024<\/strong> \u043d\u0430 <strong>11264<\/strong><\/span><\/em><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c <strong>ipfw<\/strong>:<\/p>\n<p><code>#cd \/usr\/src\/sbin\/ipfw &amp;&amp; make &amp;&amp; make install &amp;&amp; make clean<\/code><\/p>\n<p><strong><span style=\"color: #ff0000;\">5) \u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0442\u0430\u0431\u043b\u0438\u0446\u044b NAT&#8217;a<\/span><\/strong><\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u041d\u0410\u0422\u0430 \u0438 \u0432 <strong>kernel nat<\/strong> (\u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430, \u0430 \u043d\u0435 \u0441\u0430\u043c\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430). \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p><code>#ipfw nat show<br \/>\nnat 1: icmp=106, udp=34388, tcp=115736, pptp=0, proto=0, frag_id=14 frag_ptr=0 \/ tot=150244<\/code><\/p>\n<p><strong><span style=\"color: #ff0000;\">6) \u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435.<\/span><\/strong><\/p>\n<p><strong>kernel nat<\/strong> \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 <strong>7.0<\/strong>, \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <strong>natd<\/strong>. \u041d\u043e \u043f\u043e\u0441\u043b\u0435 <strong>7-\u043a\u0438<\/strong>, <strong>natd<\/strong> \u043d\u0435 \u0438\u0441\u0447\u0435\u0437, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043c\u0443 \u043d\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439, \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c (\u043d\u043e \u044f \u0431\u044b \u043d\u0435 \u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b \ud83d\ude42 ). \u041f\u043e \u0441\u0443\u0442\u0438 <strong>kernel nat<\/strong> &#8211; \u044d\u0442\u043e \u0432\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435 <strong>natd<\/strong>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043e\u0442 <strong>natd<\/strong>. \u0410 \u0435\u0441\u043b\u0438 \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0441\u043e\u043c\u043d\u0435\u0432\u0430\u0435\u0442\u0435\u0441\u044c, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0437\u0430\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u0432 <strong>man<\/strong>.<\/p>\n<p>\u041e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u0440\u043e <strong>NAT<\/strong> \u0438 2-\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0437\u0434\u0435\u0441\u044c\u00a0<a href=\"http:\/\/birdofluck.livejournal.com\/8778.html\" rel=\"nofollow\">http:\/\/birdofluck.livejournal.com\/8778.html<\/a><\/p>\n<p><em><span style=\"color: #993300;\">\u041e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043e \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0436\u0443\u0440\u043d\u0430\u043b\u0430 root.ua<\/span><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041d\u0443 \u0432\u043e\u0442, \u043d\u0430 \u0441\u043c\u0435\u043d\u0443 \u0441\u0442\u0430\u0440\u043e\u043c\u0443 natd \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043d\u043e\u0432\u044b\u0439 kernel NAT, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u0430\u043a \u0437\u0430\u044f\u0432\u043b\u044f\u044e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0448\u0443\u0441\u0442\u0440\u0435\u0435, \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440, \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0434\u0430 \u0438 \u043c\u043d\u043e\u0433\u043e \u0435\u0449\u0451 \u0447\u0435\u0433\u043e. \u041d\u0438\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0448\u043b\u044e\u0437. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e natd, \u0442\u0430\u043a \u0447\u0442\u043e \u0432 \u043d\u0435\u0439 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u0448\u0435\u0441\u0442\u0432\u0430. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0435\u0440\u043f\u043d\u0443\u0442\u044c \u0438\u0437 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-577","post","type-post","status-publish","format-standard","hentry","category-routers"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/577","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=577"}],"version-history":[{"count":14,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/577\/revisions"}],"predecessor-version":[{"id":5204,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/577\/revisions\/5204"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}