{"id":181,"date":"2010-06-18T16:22:57","date_gmt":"2010-06-18T13:22:57","guid":{"rendered":"http:\/\/skeletor.org.ua\/wordpress\/?p=181"},"modified":"2017-03-20T11:40:05","modified_gmt":"2017-03-20T09:40:05","slug":"%d0%bf%d1%80%d0%be%d1%81%d1%82%d0%b5%d0%bd%d1%8c%d0%ba%d0%b8%d0%b9-%d1%88%d0%bb%d1%8e%d0%b7-%d1%81-%d0%bf%d1%80%d0%be%d0%b7%d1%80%d0%b0%d1%87%d0%bd%d1%8b%d0%bc-%d0%bf%d1%80%d0%be%d0%ba%d1%81%d0%b8","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=181","title":{"rendered":"\u041f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0448\u043b\u044e\u0437 \u0441 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u043c \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c squid"},"content":{"rendered":"<p>\u0412\u0441\u0451 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043d\u0430\u00a0<strong>gentoo linux 2.6.29<\/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><strong><span style=\"color: #ff0000;\">1) \u0424\u043e\u0440\u0432\u0430\u0440\u0434\u0438\u043d\u0433 \u043f\u0430\u043a\u0435\u0442\u043e\u0432.<\/span><\/strong><\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0440\u0435\u0437\u0440\u0435\u0448\u0438\u043c \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0443 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0442\u0435\u0432\u044b\u043c\u0438 \u043a\u0430\u0440\u0442\u0430\u043c\u0438. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437\u00a0<strong>sysclt<\/strong>:<\/p>\n<p><code>#sysctl net.ipv4.ip_forward = 1<\/code><\/p>\n<p><!--more--><\/p>\n<p>\u0427\u0442\u043e \u0431\u044b \u043f\u043e\u0441\u043b\u0435 \u0440\u0435\u0431\u0443\u0442\u0430 \u043e\u043d\u043e \u043d\u0435 \u0441\u043b\u0435\u0442\u0430\u043b\u043e, \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0435\u0433\u043e \u0432\u00a0<strong>\/etc\/sysctl.conf<\/strong><\/p>\n<p><strong><span style=\"color: #ff0000;\">2) \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0444\u0430\u0439\u0435\u0440\u0432\u043e\u043b\u0430: iptables.<\/span><\/strong><\/p>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c:<\/p>\n<p><code>#emerge net-firewall\/iptables<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044e \u0430\u0434\u0440\u0435\u0441\u043e\u0432\u00a0<strong>NAT<\/strong>:<\/p>\n<p><code>#iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE<br \/>\n#iptables --append FORWARD --in-interface eth1 -j ACCEPT<\/code><\/p>\n<p>\u0433\u0434\u0435,\u00a0<strong>eth0<\/strong> &#8211; \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0430\u00a0<strong>eth1<\/strong> &#8211; \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439.<\/p>\n<p><em><strong><span style=\"color: #ff6600;\">\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/span><\/strong><\/em><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043e\u0448\u0438\u0431\u043a\u0438, \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u0438\u00a0<strong>ip_nat, ip_conntrack<\/strong>:<\/p>\n<p><code>lsmod | grep nat<br \/>\niptable_nat 11077 1<br \/>\nip_tables 17029 3 iptable_mangle,iptable_nat,iptable_filter<br \/>\nip_nat 21101 2 iptable_nat<br \/>\nip_conntrack 53281 6 xt_connlimit,xt_state,iptable_nat,ip_nat<br \/>\nnfnetlink 10713 2 ip_nat,ip_conntrack<br \/>\nx_tables 17349 12 xt_MARK,ipt_REJECT,xt_connlimit,ipt_ULOG,xt_state,xt_multiport,xt_pkttype,iptable_nat,ip_tables,ip6t_REJECT,xt_tcpudp,ip6_tables<br \/>\n<\/code><br \/>\n\u0412 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043a\u043e\u0433\u0434\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 \u0438 \u0437\u0430\u0440\u0435\u043d\u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>SNAT<\/strong>. <strong>MASQUERADE<\/strong> \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0440\u0430\u0442\u0438\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043d\u0430 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 <strong>IP<\/strong>-\u0430\u0434\u0440\u0435\u0441\u0430 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435. \u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441 <strong>SNAT<\/strong> \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a (<strong>eth0<\/strong> \u0438\u043c\u0435\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 <strong>111.111.111.111<\/strong>):<\/p>\n<p><code>#iptables --table nat --append POSTROUTING --out-interface eth0 -j SNAT --to 111.111.111.111<br \/>\n#iptables --append FORWARD --in-interface eth1 -j ACCEPT<\/code><\/p>\n<p><strong><span style=\"color: #ff0000;\">3) \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 squid&#8217;a<\/span><\/strong><span style=\"color: #ff0000;\">.<\/span><\/p>\n<p><code>#emerge squid<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435. \u041a\u043e\u043d\u0444\u0438\u0433 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c\u00a0<a href=\"\/?p=45\" target=\"_blank\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0437\u0430\u0432\u043e\u0440\u043e\u0442\u0430 \u043d\u0430 \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u0444\u0430\u0439\u0435\u0440\u0432\u043e\u043b\u0435:<\/p>\n<p><code>iptables -t nat -A PREROUTING -s 10.10.10.0\/24 -p tcp --dport 80 -j REDIRECT --to-ports 3128<\/code><\/p>\n<p>\u0433\u0434\u0435 <strong>10.10.10.0\/24<\/strong> &#8211; \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f \u043f\u043e\u0434\u0441\u0435\u0442\u044c.<\/p>\n<p><strong><em><span style=\"color: #ff6600;\">\u041f\u0440\u043e\u0431\u0440\u043e\u0441 \u043f\u043e\u0440\u0442\u0430 \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u0441\u0435\u0442\u044c:<\/span><\/em><\/strong><\/p>\n<p><code>#iptables -t nat -A PREROUTING -p tcp -d XX.XX.XX.XX --dport 10000 -j DNAT --to-destination 10.10.10.100:80<\/code><\/p>\n<p>\u0433\u0434\u0435,<\/p>\n<p><strong>XX.XX.XX.XX<\/strong> &#8211; \u0432\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0448\u043b\u044e\u0437\u0430,<\/p>\n<p><strong>&#8211;dport<\/strong> &#8211; \u043f\u043e\u0440\u0442 \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0438\u0437\u0432\u043d\u0435<\/p>\n<p><strong>&#8211;to-destination<\/strong> &#8211; IP \u0438 \u043f\u043e\u0440\u0442 \u043c\u0430\u0448\u0438\u043d\u044b \u0432 \u043b\u043e\u043a\u0430\u043b\u043a\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0440\u0442.<\/p>\n<p>\u0412\u043e\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0430 \u0438\u0437 \u0441\u0430\u0439\u0442\u0430 <a href=\"https:\/\/habrahabr.ru\/post\/324276\/\">habrahabr.ru<\/a> \u043d\u0430\u0441\u0447\u0451\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <strong>REDIRECT<\/strong> \u0432\u043c\u0435\u0441\u0442\u043e <strong>DNAT<\/strong><\/p>\n<blockquote><p><span style=\"color: #993366;\">\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 REDIRECT \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0432\u0438\u0434\u043e\u043c DNAT, \u0441 \u0442\u043e\u0439 \u043b\u0438\u0448\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0435\u0439, \u0447\u0442\u043e \u0430\u0434\u0440\u0435\u0441 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (destination) \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 primary-\u0430\u0434\u0440\u0435\u0441 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u043f\u0430\u043a\u0435\u0442 (\u0432\u043e\u0442 \u0442\u0430\u043a \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0434\u043b\u044f\u00a0<a style=\"color: #993366;\" href=\"http:\/\/lxr.free-electrons.com\/source\/net\/netfilter\/nf_nat_redirect.c#L32\">IPv4<\/a>\u00a0\u0438 \u0434\u043b\u044f\u00a0<a style=\"color: #993366;\" href=\"http:\/\/lxr.free-electrons.com\/source\/net\/netfilter\/nf_nat_redirect.c#L85\">IPv6<\/a>). \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0436\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u043e\u0440\u0442 \u043d\u0430 \u0430\u0434\u0440\u0435\u0441\u0435 127.0.0.1. \u041e\u0442\u0441\u044e\u0434\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0434\u043d\u0430 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u2014 \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u043d\u0430 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u043e\u0440\u0442, \u043d\u043e \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0441\u043b\u0443\u0448\u0430\u0435\u0442 \u043f\u043e\u0440\u0442 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0448\u0451\u043b \u043f\u0430\u043a\u0435\u0442, \u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2014 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0438 \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f, \u043d\u043e \u0432 \u043e\u0442\u0432\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0431\u0443\u0434\u0443\u0442 \u0443\u043b\u0435\u0442\u0430\u0442\u044c tcp-reset&#8217;\u044b \u0438\u043b\u0438 icmp-port-unreachable (\u0435\u0441\u043b\u0438 \u0442\u0430\u043c UDP). \u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0438\u0437\u0432\u043d\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043b\u0443\u0448\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e 127.0.0.1. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u043d\u0435\u0442 \u0430\u0434\u0440\u0435\u0441\u0430 \u0432\u043e\u043e\u0431\u0449\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 unnumbered-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441), \u0442\u043e \u043f\u0430\u043a\u0435\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u0431\u0440\u043e\u0448\u0435\u043d\u044b. \u0418 \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u043e \u043d\u0430 \u043a\u043e\u043d\u043d\u0442\u0440\u0430\u043a\u0435, \u0442\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043e\u0447\u0438\u0449\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043a\u043e\u043d\u043d\u0442\u0440\u0430\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b; \u0430 \u0442\u0430\u043a \u0436\u0435 \u0443\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u043f\u043e\u0434 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043a\u0435\u0442\u044b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0441 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c NEW, \u0442\u043e \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0449\u0451 \u043d\u0435\u0442 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043a\u043e\u043d\u043d\u0442\u0440\u0430\u043a\u0430. \u041e\u0442\u043b\u043e\u0432\u0438\u0442\u044c \u0436\u0435 \u044d\u0442\u0438 \u043f\u0430\u043a\u0435\u0442\u044b \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0446\u0435\u043f\u043e\u0447\u043a\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e &#8220;-m conntrack &#8211;ctstate DNAT&#8221;. \u0412\u043e\u0442 \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a.<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #ff0000;\">4) \u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439.<\/span><\/strong><\/p>\n<p>&#8211; \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0430\u0432\u0438\u043b<\/p>\n<p><code>#iptables -L [chain]<\/code><\/p>\n<p>\u0422\u0430\u043a \u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443<\/p>\n<p><code>#iptables -S [chain]<\/code><\/p>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043b\u0438\u0448\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0432\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0438\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <strong>iptables-save<\/strong>.<br \/>\n\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u043f\u0440\u0430\u0432\u0438\u043b <strong>NAT<\/strong> \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<p><code>#iptables -L -t nat<\/code><\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0435 <strong>NAT<\/strong>-\u0441\u0435\u0441\u0441\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a:<\/p>\n<p><code>#netstat -M - \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u041c\u0410\u0421\u041a\u0410\u0420\u0410\u0414\u0418\u041d\u0413<br \/>\n#netstat-nat - \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 NAT<br \/>\n<\/code><br \/>\n\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0441\u0442\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p><strong><span style=\"color: #ff0000;\">5) \u041f\u0440\u0438\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430 \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438.<\/span><\/strong><\/p>\n<p><code>#!\/bin\/sh<br \/>\nIPT=\"\/sbin\/iptables\"<\/code><\/p>\n<p><code># Reset Default Policies<br \/>\n$IPT -P INPUT ACCEPT<br \/>\n$IPT -P FORWARD ACCEPT<br \/>\n$IPT -P OUTPUT ACCEPT<br \/>\n$IPT -t nat -P PREROUTING ACCEPT<br \/>\n$IPT -t nat -P POSTROUTING ACCEPT<br \/>\n$IPT -t nat -P OUTPUT ACCEPT<br \/>\n$IPT -t mangle -P PREROUTING ACCEPT<br \/>\n$IPT -t mangle -P OUTPUT ACCEPT<\/code><\/p>\n<p><code># Flush all rules<br \/>\n$IPT -F<br \/>\n$IPT -t nat -F<br \/>\n$IPT -t mangle -F<br \/>\n<\/code><\/p>\n<p><code># Erase all non-default chains<br \/>\n$IPT -X<br \/>\n$IPT -t nat -X<br \/>\n$IPT -t mangle -X<\/code><\/p>\n<p><code>iptables --table nat --append POSTROUTING --out-interface eth0 -j SNAT 111.111.111.111<br \/>\niptables --append FORWARD --in-interface eth1 -j ACCEPT<\/code><\/p>\n<p><em><span style=\"color: #993300;\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438\u00a0<a href=\"http:\/\/root.ua\/materialy\/stati\/full\/article\/prostenkii-shljuz-s-prozrachnym-proksi-serverom-squid\/280.html\" target=\"_blank\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/span><\/em><\/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 \u0440\u0435\u0434\u0430\u043a\u0446\u0438\u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u0430 RootUA \u0438 \u0433\u0430\u0437\u0435\u0442\u044b FOSS News<\/span><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412\u0441\u0451 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043d\u0430\u00a0gentoo linux 2.6.29. \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) \u0424\u043e\u0440\u0432\u0430\u0440\u0434\u0438\u043d\u0433 \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0440\u0435\u0437\u0440\u0435\u0448\u0438\u043c \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0443 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0442\u0435\u0432\u044b\u043c\u0438 \u043a\u0430\u0440\u0442\u0430\u043c\u0438. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437\u00a0sysclt: #sysctl net.ipv4.ip_forward = 1<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-181","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/181","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=181"}],"version-history":[{"count":18,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/181\/revisions"}],"predecessor-version":[{"id":5180,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/181\/revisions\/5180"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}