{"id":5572,"date":"2021-09-18T15:54:43","date_gmt":"2021-09-18T07:54:43","guid":{"rendered":"https:\/\/damogame.cn:15443\/wordpress\/?p=5572"},"modified":"2021-09-18T15:57:09","modified_gmt":"2021-09-18T07:57:09","slug":"%e8%af%95%e8%ae%banat%e8%bd%ac%e6%8d%a2%e6%96%b9%e5%bc%8f%e4%b8%8b%e7%9a%84src-nat%e3%80%81dst-nat%e5%92%8c%e6%98%a0%e5%b0%84%e3%80%81%e5%9b%9e%e6%b5%81%e7%9a%84%e5%85%b3%e7%b3%bb","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/5572","title":{"rendered":"\u8bd5\u8bbanat\u8f6c\u6362\u65b9\u5f0f\u4e0b\u7684src-nat\u3001dst-nat\u548c\u6620\u5c04\u3001\u56de\u6d41\u7684\u5173\u7cfb"},"content":{"rendered":"<p>src-nat\u662f\u6e90\u5730\u5740\u8f6c\u6362,\u5176\u4f5c\u7528\u662f\u5c06ip\u6570\u636e\u5305\u7684\u6e90\u5730\u5740\u8f6c\u6362\u6210\u53e6\u5916\u4e00\u4e2a\u5730\u5740,<\/p>\n<p>\u9996\u5148\u6211\u4eec\u8bf4\u4e00\u4e0bsnat\u4e2d\u51e0\u4e2a\u53c2\u6570\u7684\u542b\u4e49,<\/p>\n<p>action\uff0c\u8fd9\u662f\u8bf4\u660e\u7528\u7684\u54ea\u79cd\u8f6c\u6362\u65b9\u5f0f,\u901a\u5e38\u6211\u4eec\u7528masqurade\uff0cnat\u8fd9\u4e24\u79cd,\u5728\u7279\u6b8a\u60c5\u51b5\u4e0b\u7528accept(\u4e3b\u8981\u662f\u5185\u7f51\u4e2d\u6709\u516c\u7f51\u5730\u5740\u5b58\u5728\u7684\u60c5\u51b5)\u65b9\u6cd5\uff0c<\/p>\n<p>&nbsp;<\/p>\n<p>protocol\u8bf4\u660e\u5bf9\u54ea\u4e9b\u4f20\u8f93\u534f\u8fdb\u884c\u8f6c\u6362(\u901a\u5e38\u6709tcp,udp\u7b49),out-interface\u8bf4\u660e\u901a\u8fc7\u54ea\u4e00\u4e2a\u7f51\u5361\u8fdb\u884c\u8f6c\u6362(\u901a\u5e38\u662f\u5916\u7f51\u5361outside)\uff0cto-src-address\u662f\u5c06\u6e90\u5730\u5740\u4f2a\u88c5\u6210\u54ea\u4e9b\u5730\u5740(\u53ef\u4ee5\u662f\u4e00\u4e2a\u4e5f\u53ef\u4ee5\u662f\u5f88\u591a\u4e2a),to-src-pot\u662f\u5c06\u6e90\u7aef\u53e3\u4f2a\u88c5\u6210\u54ea\u4e9b\u7aef\u53e3(\u53ef\u4ee5\u662f\u4e00\u4e2a\u4e5f\u53ef\u4ee5\u662f\u5f88\u591a\u4e2a),dst-address\u662f\u6307\u53d1\u5411\u54ea\u4e9b\u4e3b\u673a\u7684\u6570\u636e\u5305\u8981\u8fdb\u884c\u4f2a\u88c5(\u53ef\u4ee5\u4e00\u4e2a\u53ef\u4ee5\u591a\u4e2a)\uff0cdst-port\u662f\u6307\u53d1\u5411\u54ea\u4e9b\u7aef\u53e3\u7684\u6570\u636e\u5305\u8fdb\u884c\u4f2a\u88c5(\u53ef\u4ee5\u4e00\u4e2a\u53ef\u4ee5\u591a\u4e2a)\uff0csrc-address\u662f\u6307\u5bf9\u54ea\u4e9b\u6e90\u5730\u5740\u8fdb\u884c\u4f2a\u88c5(\u53ef\u4ee5\u4e00\u4e2a\u53ef\u4ee5\u591a\u4e2a),src-port\u662f\u6307\u4ece\u54ea\u4e9b\u6e90\u7aef\u53e3\u53d1\u51fa\u7684\u6570\u636e\u5305\u8fdb\u884c\u4f2a\u88c5(\u53ef\u4ee5\u4e00\u4e2a\u53ef\u4ee5\u591a\u4e2a)<\/p>\n<p>&nbsp;<\/p>\n<p>\u4e0b\u9762\u7684\u8bba\u8ff0\u4e2d,ACTION(\u8f6c\u6362\u65b9\u5f0f)\u90fd\u662f\u4ee5NAT\u4e3a\u4f8b.<br \/>\n\u518d\u7efc\u5408\u7f51\u4e0a\u5176\u5b83\u7684\u76f8\u5173\u8d44\u6599\uff0c\u4ee5\u6211\u73b0\u6709\u7684\u7406\u89e3\uff0c\u548c\u5177\u4f53\u7684\u8bd5\u9a8c,\u518d\u4f5c\u4e9b\u8865\u5145\uff1a<br \/>\n\u8981\u505asrc-nat\uff0c\u9664\u4e86\u6307\u660e\u534f\u8bae\\\u7aef\u53e3\\\u8f6c\u6362\u6210\u4ec0\u4e48\u5730\u5740\u5916,\u8fd8\u8981\u8c08\u5230\u662f\u5728\u90a3\u5757\u7f51\u5361(\u63a5\u53e3)\u4e0a\u505a\u8fd9\u4e2a\u201c\u6e90\u5730\u5740\u5730\u5740\u8f6c\u6362\u201d\u3002<br \/>\n\u6bd4\u5982\uff0c\u8981\u8ba9\u5185\u7f51\u7684\u7535\u8111\u901a\u8fc7routeros\u8bbf\u95ee\u5916\u7f51\uff0c\u90a3\u4e48\u5c31\u7531\u4e0e\u516c\u7f51\u8fde\u63a5\u7684\u7f51\u5361\u505asnat\uff0c\u5728\u6dfb\u52a0src-nat\u89c4\u5219\u65f6\uff0cgeneral\u9875\u7684out. interface\u5c31\u5e94\u9009&#8221;\u5916\u7f51\u5361&#8221;,\u5f53\u7136,\u7528\u9ed8\u8ba4\u8bbe\u7f6e&#8221;all&#8221;\u4e5f\u5c31\u5305\u542b\u4e86&#8221;\u5916\u7f51\u5361&#8221;,\u4f46\u8fd9\u4e0d\u5229\u4e8e\u7406\u89e3src-nat<\/p>\n<p>&nbsp;<\/p>\n<p>\u7406\u89e3\u4e86src-nat ,dst-nat\u5c31\u5f88\u597d\u7406\u89e3\u4e86,src-nat\u662fRouteros\u5c06\u5185\u7f51\u7535\u8111\u53d1\u51fa\u7684\u6570\u636e\u5305\u7684\u5730\u5740\u4e2d\u7684\u6e90\u5730\u5740\u8fdb\u884c\u8f6c\u6362\u7136\u540e\u53d1\u5f80\u5916\u7f51,\u5728\u6570\u636e\u5305\u4e2d,\u88ab\u8f6c\u6362\u7684\u5730\u5740\u662f\u6e90\u5730\u5740,\u6240\u4ee5\u53eb\u6e90\u5730\u5740\u8f6c\u6362.\u800cdst-nat\u5219\u521a\u597d\u76f8\u53cd,\u5b83\u662fRouteros\u5c06\u516c\u7f51\u53d1\u6765\u7684\u6570\u636e\u5305\u7684\u5730\u5740\u4e2d\u7684\u76ee\u7684\u5730\u5740\u8fdb\u884c\u8f6c\u6362(\u5f53\u7136\u8fd9\u4e2a\u76ee\u7684\u5730\u5740\u5c31\u662frouteros\u7684\u516c\u7f51ip),\u7136\u540e\u53d1\u7ed9\u5185\u7f51\u7684\u7535\u8111,\u5728\u6570\u636e\u5305\u4e2d,\u88ab\u8f6c\u6362\u7684\u5730\u5740\u662f\u76ee\u7684\u5730\u5740,\u6240\u4ee5\u53eb\u76ee\u7684\u5730\u5740\u8f6c\u6362.<br \/>\n\u540c\u6837,dst-nat\u9664\u4e86\u6307\u5b9a\u8f6c\u6362\u540e\u7684\u5730\u5740\u5916,\u4e5f\u5c06\u6d89\u53ca\u662f\u5728\u90a3\u5757\u7f51\u5361(\u63a5\u53e3)\u4e0a\u8fdb\u884c,\u4f8b\u5982,\u8981\u5c06\u516c\u7f51\u53d1\u7ed9routeros\u7684a\u7aef\u53e3\u7684\u6570\u636e\u5305\u8f6c\u7ed9\u5185\u7f51ip\u4e3ab\u7684c\u7aef\u53e3,\u90a3\u4e48\u8bbe\u7f6e\u597da\\b\\c\u7684\u503c\u540e,\u5728dst-nat\u89c4\u5219general\u9875\u7684in.interface\u91cc,\u5e94\u9009\u62e9\u4e0eb\u5730\u5740\u7f51\u6bb5\u76f8\u8fde\u7684\u7f51\u5361(\u63a5\u53e3),\u663e\u7136\u8fd9\u662f\u4e00\u5757\u5185\u7f51\u5361,\u5f53\u7136,\u7528\u9ed8\u8ba4\u8bbe\u7f6e&#8221;all&#8221;\u4e5f\u5c31\u5305\u542b\u4e86\u8fd9\u5757&#8221;\u5185\u7f51\u5361&#8221;,\u4f46\u8fd9\u4e0d\u5229\u4e8e\u7406\u89e3DST-nat<br \/>\n.\u5230\u8fd9\u91cc\u53ef\u4ee5\u660e\u767d\u4ec0\u4e48\u662f\u7aef\u53e3\u6620\u5c04\u4e86,\u5b83\u5c31\u662fdst-nat\u4e2d\u7684\u4e00\u6761\u8f6c\u6362\u89c4\u5219.<\/p>\n<p>&nbsp;<\/p>\n<p>\u518d\u6765\u8c08&#8221;\u56de\u6d41&#8221;,\u5f15\u7528\u4e00\u6bb5\u6587\u5b57&#8211;&#8220;\u4ec0\u4e48\u53eb\u56de\u6d41\u5462\uff0c\u5c31\u662f\u5f53\u5185\u7f51\u6709\u670d\u52a1\u6620\u5c04\u5230\u7f51\u5173\u540e,\u5185\u7f51\u4e3b\u673a\u4e5f\u53ef\u4ee5\u7528\u7f51\u5173\u5916\u90e8\u5730\u5740\u8bbf\u95ee&#8221;<\/p>\n<p>\u7531\u4e0a\u9762\u7684\u5b9a\u4e49\u53ef\u4ee5\u6e05\u695a&#8221;\u56de\u6d41&#8221;\u8981\u5b8c\u6210\u7684\u64cd\u4f5c:1\\\u5185\u7f51\u7535\u8111\u5411Routeros\u53d1\u9001\u76ee\u7684\u5730\u5740\u4e3a\u516c\u7f51ip\u7684\u6570\u636e\u5305\uff08\u5f53\u7136\u8fd9\u4e2aIP\u5c31\u662fRouteros\u7684\u516c\u7f51IP\uff09. 2\\Routeros\u901a\u8fc7\u6e90\u5730\u5740\u8f6c\u6362\u89c4\u5219(SRC-NAT)\u4e2d\u9009\u5b9a\u7684A\u7f51\u5361(\u63a5\u53e3)\u5c06\u6570\u636e\u5305\u5730\u5740\u4e2d\u7684\u6e90\u5730\u5740\u8f6c\u6362\u4e3a\u516c\u7f51IP(\u76ee\u7684\u5730\u5740\u4e0d\u53d8,\u4ecd\u4e3a\u516c\u7f51IP) 3\\routeros\u901a\u8fc7\u76ee\u7684\u5730\u5740\u8f6c\u6362\u89c4\u5219(DST-NAT)\u4e2d\u9009\u5b9a\u7684B\u7f51\u5361(\u63a5\u53e3)\u5c06\u6570\u636e\u5305\u5730\u5740\u4e2d\u7684\u76ee\u7684\u5730\u5740\u8f6c\u6362\u4e3a\u5185\u7f51\u5730\u5740,\u7136\u540e\u53d1\u7ed9\u76f8\u5e94\u7684\u5185\u7f51\u7535\u8111.<\/p>\n<p>\u4f46\u662f\u95ee\u9898\u6765\u4e86,\u5982\u679cA\u7f51\u5361(\u63a5\u53e3)\u5c06\u6570\u636e\u5305\u5730\u5740\u8f6c\u6362\u540e\u5c31\u5f80\u516c\u7f51\u53d1\u9001,\u90a3\u4e48\u6570\u636e\u5305\u5c31\u65e0\u6cd5\u518d\u56de\u5230\u8def\u7531\u5668\u5e76\u8f6c\u53d1\u7ed9\u5185\u7f51\u4e86.<\/p>\n<p>\u5982\u679c\u80fd\u8ba9\u6570\u636e\u5305\u4e0d\u51fa\u8def\u7531\u5668,\u5728\u8def\u7531\u5668\u5185\u5b8c\u6210SRC-NAT\u548cDST-NAT\u8fd9\u4e24\u79cd\u5730\u5740\u8f6c\u6362,\u90a3\u4e48\u5c31\u53ef\u4ee5\u5b9e\u73b0\u56de\u6d41\u4e86.<br \/>\n\u5475\u5475,\u8ba9A=B\u5c31\u53ef\u4ee5\u5b9e\u73b0\u4e86.\u5c31\u662f\u8bf4,\u6dfb\u52a0\u4e00\u6761SRC-NAT\u548c\u4e00\u6761DST-NAT\u89c4\u5219,\u800c\u8fd9\u4e24\u6761\u89c4\u5219\u4e2d\u6240\u6307\u5b9a\u7684\u7f51\u5361\u90fd\u662f\u4e0e\u5185\u7f51\u76f8\u8fde\u7684\u540c\u4e00\u5757\u7f51\u5361.<\/p>\n<p>\u4e0a\u9762\u7684\u8bba\u8ff0\uff0c\u57281WAN2LAN,\u52a8\u6001\u62e8\u53f7\u73af\u5883\u4e0b\uff0c\u6d4b\u8bd5\u9a8c\u8bc1\uff0c\u6ca1\u6709\u51fa\u73b0\u77db\u76fe\u3002<\/p>\n<p>\u5f53\u7136\u52a8\u6001\u62e8\u53f7\u65f6,\u5916\u7f51\u5361\u5e94\u9009&#8221;PPPOE-OUT&#8221;\uff0c\u8fd8\u8981\u7f16\u5199\u76f8\u5e94\u7684\u811a\u672c\uff0c\u52a8\u6001\u66f4\u65b0to src.address,\u8fd9\u6bd4\u8f83\u9ebb\u70e6\uff0c\u6240\u4ee5\u52a8\u6001\u62e8\u53f7\u7528\u6237\u7684\u5730\u5740\u8f6c\u6362\u65b9\u5f0f\u4e00\u822c\u9009\u201cmasqurade\u201d<\/p>\n<p>&nbsp;<\/p>\n<p>\u4e0d\u8db3\u4e4b\u5904\u6b22\u8fce\u5927\u5bb6\u6307\u6b63\u3002<br \/>\n\u5e0c\u671b\u7406\u89e3masqurade\u7684\u670b\u53cb\u6765\u53d1\u4e2a\u8d34,\u5e2e\u5927\u5bb6\u91ca\u7591\u4e00\u4e0b.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>src-nat\u662f\u6e90\u5730\u5740\u8f6c\u6362,\u5176\u4f5c\u7528\u662f\u5c06i<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[],"tags":[125],"class_list":["post-5572","post","type-post","status-publish","format-standard","hentry","tag-09-"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/5572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=5572"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/5572\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=5572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=5572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=5572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}