{"id":2880,"date":"2012-04-03T10:54:18","date_gmt":"2012-04-03T02:54:18","guid":{"rendered":"http:\/\/jpuyy.com\/?p=2880"},"modified":"2012-09-26T08:45:33","modified_gmt":"2012-09-26T00:45:33","slug":"proxy-server-and-nat-server","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=2880","title":{"rendered":"\u4ee3\u7406\u670d\u52a1\u5668\u4e0e NAT \u4e3b\u673a\u7684\u5dee\u5f02"},"content":{"rendered":"<p>\u4ee5\u4e0b\u5185\u5bb9\u6765\u81ea\u9e1f\u54e5\u7684linux\u79c1\u623f\u83dc<\/p>\n<blockquote><p>\u6216\u8bb8\u60a8\u5df2\u7ecf\u53d1\u73b0\u4e86\u4e00\u4ef6\u4e8b\uff0c\u90a3\u5c31\u662f\uff1a\u5728\u5185\u90e8\u5c40\u57df\u7f51\u7edc\u4f7f\u7528\u79c1\u6709 IP \u7684 Client \u7aef\u4e0d\u8bba\u900f\u8fc7 Proxy \u6216\u8005 NAT \u5747\u53ef\u4ee5\u76f4\u63a5\u53d6\u5f97 WWW \u8fd9\u4e2a Internet \u7684\u670d\u52a1\uff0c\u90a3\u4e48 NAT \u4e0e Proxy \u6709\u6ca1\u6709\u4ec0\u4e48\u4e0d\u540c\u7684\u5730\u65b9\u554a\uff1f\u4ed6\u4eec\u4e0d\u90fd\u662f\u53ef\u4ee5\u8ba9\u5185\u90e8\u7684 Client \u8fde\u63a5\u51fa\u53bb\u5417\uff1f\u5176\u5b9e\u8fd9\u4e24\u4e2a\u73a9\u610f\u513f\u5dee\u5f02\u6027\u662f\u300e\u76f8\u5f53\u5927\u300f\u7684\uff1a<\/p>\n<p>* NAT \u662f\u4e00\u4e2a\u5229\u7528 TCP\/IP \u7684 packet filter ( \u5c01\u5305\u8fc7\u6ee4\u673a\u5236 )\u6765\u8fdb\u884c\u5c01\u5305\u5904\u7406\u7684\u4e00\u4e2a\u673a\u5236\uff0c\u6240\u4ee5\u4ed6\u662f\u300e\u76f4\u63a5\u5206\u6790 TCP\/IP \u300f\uff0c\u6240\u4ee5\u5728\u8bbe\u5b9a\u9632\u706b\u5899\u7684\u65f6\u5019\uff0c\u4ed6\u7684\u5f39\u6027\u6bd4\u8f83\u9ad8\uff0c\u53ea\u8981\u80fd\u8fc7 NAT \u8fd9\u4e00\u5173\uff0c\u90a3\u4e48\u5927\u90e8\u5206\u7684\u7f51\u7edc\u670d\u52a1\u90fd\u53ef\u4ee5\u4f7f\u7528\uff0c\u56e0\u4e3a TCP\/IP \u662f\u6bd4\u8f83\u5e95\u5c42\u7684\u534f\u8bae\u554a\uff01\u8981\u77e5\u9053\u7684\u662f\uff0cTCP\/IP \u4e0a\u5934\u8fd8\u6709 port \u3001\u8fd8\u6709 IP \u7b49\u7b49\u7684\u4fe1\u606f\uff0c\u5355\u662f port \u5c31\u53ef\u4ee5\u8ba9\u6211\u4eec\u4f7f\u7528\u5f88\u591a\u7684\u4e0d\u540c\u7684\u534f\u8bae\u4e86\uff01\u4f8b\u5982 port 20, 21 \u662f FTP \u554a\uff0c 80 \u662f WWW \u554a\u7b49\u7b49\u7684\uff01\u6240\u4ee5 NAT \u80fd\u505a\u7684\u4e8b\u60c5\u4e8b\u5f88\u591a\u7684\uff01<\/p>\n<p>* \u81f3\u4e8e Proxy \u5c31\u4e0d\u4e00\u6837\u4e86\uff0c Proxy \u4e3b\u8981\u900f\u8fc7\u7c7b\u4f3c Squid \u8fd9\u4e00\u7c7b\u7684\u8f6f\u4ef6\u6765\u8fbe\u6210\u7684\u4e00\u4e2a\u670d\u52a1\uff0c\u57fa\u672c\u4e0a\uff0c\u4e00\u822c\u6765\u8bf4\u4ed6\u662f\u900f\u8fc7 port 3128 \u6765\u8fdb\u884c\u6570\u636e\u7684\u76d1\u542c\u4e0e\u4f20\u8f93\uff0c\u5355\u662f\u770b\u5230\u8fd9\u4e2a port 3128 \u5c31\u5e94\u8be5\u8981\u6653\u5f97\u4ed6\u4ec5\u662f\u4e00\u4e2a daemon \u800c\u5df2\u3002Proxy \u5df2\u7ecf\u662f\u5e94\u7528\u5c42\u8fd9\u4e2a\u9636\u6bb5\u7684\u7f51\u7edc\u9879\u76ee\u4e86\uff0c\u6240\u4ee5\u4ed6\u5e76\u6ca1\u6709\u53bb\u5206\u6790 TCP \u7684\u5c01\u5305\uff0c\u53ea\u8981 Client \u6765\u6e90\u5408\u4e4e\u4ed6\u7684\u9700\u6c42 (\u4f8b\u5982 IP \u662f\u88ab\u652f\u6301\u7684 ) \uff0c\u90a3\u4e48\u4ed6\u5c06\u900f\u8fc7 daemon \u7684\u529f\u80fd\u5e2e\u4f7f\u7528\u8005\u8fbe\u6210\u4f7f\u7528\u8005\u6240\u60f3\u8981\u7684\u4efb\u52a1\uff01\u6240\u4ee5\u8bf4\uff0c\u80fd\u4e0d\u80fd\u505a\u67d0\u4e9b\u4e8b\u60c5\uff0c\u4e0e Proxy \u670d\u52a1\u5668\u4e0a\u9762\u8d1f\u8d23\u7684\u90a3\u4e2a daemon \u662f\u6709\u5173\u7684\uff01\u4e07\u4e00 daemon \u65e0\u6cd5\u8fdb\u884c FTP \u6570\u636e\u7684\u53d6\u5f97\uff0c\u90a3\u4e48\u60a8\u518d\u600e\u4e48\u52aa\u529b\u7684\u5c1d\u8bd5\u4e0a\u7f51\u4e5f\u662f\u6789\u7136\u7684\u554a\uff01<br \/>\n\u8fd9\u6837\u8bf4\u6709\u6ca1\u6709\u6bd4\u8f83\u6709\u70b9\u6982\u5ff5\u4e86\u5462\uff1fNAT \u662f\u7531\u8f83\u5e95\u5c42\u7684\u7f51\u7edc\u53bb\u8fdb\u884c\u5206\u6790\u7684\u5de5\u4f5c\uff0c\u81f3\u4e8e\u901a\u8fc7 NAT \u7684\u5c01\u5305\u662f\u5e72\u561b\u7528\u7684\uff0c NAT \u4e0d\u53bb\u7ba1\u4ed6\uff01\u81f3\u4e8e proxy \u5219\u4e3b\u8981\u662f\u7531\u4e00\u4e2a daemon \u7684\u529f\u80fd\u8fbe\u6210\u7684\uff0c\u6240\u4ee5\u5fc5\u9700\u8981\u7b26\u5408\u8be5 daemon \u7684\u9700\u6c42\uff0c\u624d\u80fd\u8fbe\u5230\u67d0\u4e9b\u529f\u80fd\uff01<\/p>\n<p>\u8c08\u5b8c\u4e86\u8fd9\u4e9b\u57fa\u672c\u7684\u539f\u7406\u4e4b\u540e\uff0c\u6211\u4eec\u53ef\u5f97\u6765\u73a9\u4e00\u73a9 Proxy \u4e86\u5427\uff1f\uff01\u4e8b\u5b9e\u4e0a\uff0c\u76ee\u524d\u6709\u5f88\u591a\u7684 Proxy \u8f6f\u4ef6\uff0c\u4f8b\u5982 apache \u4e5f\u6709\u63d0\u4f9b proxy \u6a21\u5757\u7684\u529f\u80fd\u5594\uff01\u4f46\u662f\uff0c\u6700\u597d\u4e0d\u8981\u7528 Apache \u5f53\u4f5c\u60a8\u7684 Proxy server \uff0c\u56e0\u4e3a&#8230;..\u6548\u80fd\u771f\u7684\u592a\u5dee\u4e86\uff5e\u4f1a\u8ba9\u60a8\u7684\u7f51\u7edc\u505c\u987f\u7684\u66f4\u5389\u5bb3\uff5e\u76ee\u524d Proxy \u7684\u670d\u52a1\u5668\u8f6f\u4ef6\u5f53\u4e2d\uff0c\u4ee5 squid \u8fd9\u4e2a\u549a\u549a\u6700\u51fa\u540d\uff0c\u4f1a\u51fa\u540d\u7684\u539f\u56e0\u662f\u56e0\u4e3a\u4ed6\u7684\u6548\u80fd\u9ad8\uff01\u771f\u7684\u5f88\u4e0d\u9519\u7684\u4e00\u5957\u8f6f\u4ef6\uff0c\u6240\u4ee5\u5e95\u4e0b\u6211\u4eec\u5c31\u9488\u5bf9 squid \u6765\u505a\u8bf4\u660e\u5427\uff01<\/p><\/blockquote>\n<p>\u901a\u8fc7\u5b66\u4e60Linux iptables Pocket Reference\u8fd9\u672c\u4e66\uff0c\u5bf9NAT\u6709\u66f4\u8fdb\u4e00\u6b65\u4e86\u89e3\u3002<\/p>\n<p>NAT\u4e5f\u5c31\u662f\u5f53\u5305\u901a\u8fc7\u672c\u673a\u65f6\uff0c\u5305\u7684\u5730\u5740\u548c\/\u6216\u7aef\u53e3\u7684\u4fee\u6539\u3002\u8fd9\u4e2a\u4fee\u6539\u53ef\u4ee5\u662f\u5305\u7684\u6765\u6e90\u6216\u76ee\u7684\u5730\uff0c\u4e5f\u53ef\u4ee5\u662f\u4ecb\u4e8e\u4e4b\u95f4\u3002<\/p>\n<p>NAT\u9700\u8981connection tracking\uff0c\u800c\u8fd9\u53c8\u9700\u8981\u5305\u662f\u5168\u53ef\u89c1\u7684\u3002\u5982\u679c\u9632\u706b\u5899\u5305\u542b\u7740\u591a\u4e2a\u7535\u8111\uff0c\u6ce8\u610f\u4e0d\u8981\u7834\u574fconnection tracking.<\/p>\n<p>NAT\u53ef\u7528\u4e8e\u57fa\u4e8e\u5730\u5740\u548c\u7aef\u53e3\u7684\u64cd\u4f5c\u7684\u4e00\u7cfb\u5217\u529f\u80fd\uff0c\u540c\u65f6\u53ef\u4ee5\u4ee5\u7ec4\u6765\u64cd\u4f5c<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u4e0b\u5185\u5bb9\u6765\u81ea\u9e1f\u54e5\u7684linux\u79c1\u623f\u83dc \u6216\u8bb8\u60a8\u5df2\u7ecf\u53d1\u73b0\u4e86\u4e00\u4ef6\u4e8b\uff0c\u90a3\u5c31\u662f\uff1a\u5728\u5185\u90e8\u5c40\u57df\u7f51\u7edc\u4f7f\u7528\u79c1\u6709 IP \u7684 Client \u7aef\u4e0d\u8bba\u900f\u8fc7 Proxy \u6216\u8005 NAT \u5747\u53ef\u4ee5\u76f4\u63a5\u53d6\u5f97 WWW \u8fd9\u4e2a Internet \u7684\u670d\u52a1\uff0c\u90a3\u4e48 NAT \u4e0e Proxy \u6709\u6ca1\u6709\u4ec0\u4e48\u4e0d\u540c\u7684\u5730\u65b9\u554a\uff1f\u4ed6\u4eec\u4e0d\u90fd\u662f\u53ef\u4ee5\u8ba9\u5185\u90e8\u7684 Client \u8fde\u63a5\u51fa\u53bb\u5417\uff1f\u5176\u5b9e\u8fd9\u4e24\u4e2a\u73a9\u610f\u513f\u5dee\u5f02\u6027\u662f\u300e\u76f8\u5f53\u5927\u300f\u7684\uff1a * NAT \u662f\u4e00\u4e2a\u5229\u7528 TCP\/IP \u7684 packet filter ( \u5c01\u5305\u8fc7\u6ee4\u673a\u5236 )\u6765\u8fdb\u884c\u5c01\u5305\u5904\u7406\u7684\u4e00\u4e2a\u673a\u5236\uff0c\u6240\u4ee5\u4ed6\u662f\u300e\u76f4\u63a5\u5206\u6790 TCP\/IP \u300f\uff0c\u6240\u4ee5\u5728\u8bbe\u5b9a\u9632\u706b\u5899\u7684\u65f6\u5019\uff0c\u4ed6\u7684\u5f39\u6027\u6bd4\u8f83\u9ad8\uff0c\u53ea\u8981\u80fd\u8fc7 NAT \u8fd9\u4e00\u5173\uff0c\u90a3\u4e48\u5927\u90e8\u5206\u7684\u7f51\u7edc\u670d\u52a1\u90fd\u53ef\u4ee5\u4f7f\u7528\uff0c\u56e0\u4e3a TCP\/IP \u662f\u6bd4\u8f83\u5e95\u5c42\u7684\u534f\u8bae\u554a\uff01\u8981\u77e5\u9053\u7684\u662f\uff0cTCP\/IP \u4e0a\u5934\u8fd8\u6709 port \u3001\u8fd8\u6709 IP \u7b49\u7b49\u7684\u4fe1\u606f\uff0c\u5355\u662f port \u5c31\u53ef\u4ee5\u8ba9\u6211\u4eec\u4f7f\u7528\u5f88\u591a\u7684\u4e0d\u540c\u7684\u534f\u8bae\u4e86\uff01\u4f8b\u5982 port 20, 21 \u662f FTP \u554a\uff0c 80 \u662f WWW \u554a\u7b49\u7b49\u7684\uff01\u6240\u4ee5 NAT \u80fd\u505a\u7684\u4e8b\u60c5\u4e8b\u5f88\u591a\u7684\uff01 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[23],"class_list":["post-2880","post","type-post","status-publish","format-standard","hentry","category-linux","tag-summary"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/2880","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2880"}],"version-history":[{"count":6,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/2880\/revisions"}],"predecessor-version":[{"id":2882,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/2880\/revisions\/2882"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}