{"id":1258,"date":"2019-04-24T14:55:46","date_gmt":"2019-04-24T06:55:46","guid":{"rendered":"https:\/\/blog.pfchina.org\/?p=1258"},"modified":"2020-08-24T21:42:15","modified_gmt":"2020-08-24T13:42:15","slug":"%e4%bd%bf%e7%94%a8pfsense%e8%b7%af%e7%94%b1ipsec%ef%bc%88vti%ef%bc%89","status":"publish","type":"post","link":"https:\/\/blog.pfchina.org\/?p=1258","title":{"rendered":"\u4f7f\u7528pfsense\u8def\u7531IPsec\uff08VTI\uff09"},"content":{"rendered":"<p style=\"text-align: justify;\">\u8fd9\u4e2a\u65b0\u529f\u80fd\u53ef\u4ecepfsense 2.4.4\u83b7\u5f97\uff0c\u5b83\u6d88\u9664\u4e86\u9636\u6bb52 IPsec\u914d\u7f6e\u4e2d\uff08\u6709\u65f6\u975e\u5e38\u591a\uff09IP\u5173\u8054\u7684\u5b9a\u4e49\u3002\u4f7f\u7528VTI\uff0c\u53ea\u5b9a\u4e49\u4e86\u4e00\u4e2a\u9636\u6bb52\uff0c\u7136\u540e\u4f7f\u7528pfsense\u8def\u7531\u8868\u5c06\u5b50\u7f51\u6216IP\u5b9a\u5411\u5230IPsec\u96a7\u9053\u3002<\/p>\n<p style=\"text-align: justify;\">\u4f60\u9700\u8981\u5b9a\u4e49\u4f20\u8f93\u7f51\u7edc\u3002\u901a\u5e38\u53ef\u4ee5\u4f7f\u7528\/ 30\uff0c\u56e0\u4e3a\u53ea\u9700\u8981\u4e24\u4e2aIP\uff08IPsec\u94fe\u8def\u7684\u6bcf\u4e00\u7aef\u90fd\u6709\u4e00\u4e2aIP\uff09\u3002\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\u6211\u4eec\u5c06\u4f7f\u7528<code>10.6.6.1\/30<\/code>\u3002<\/p>\n<h1 style=\"text-align: justify;\"><span id=\"Configuration_IPsec\" class=\"mw-headline\"><span class=\"mw-headline-number\">1<\/span> .IPsec\u914d\u7f6e<\/span><\/h1>\n<p>\u50cf\u5f80\u5e38\u4e00\u6837\u521b\u5efaIPsec\u9636\u6bb51\u6761\u76ee\uff08\u8fd9\u91cc\u4e0d\u518d\u8d58\u8ff0\uff09<\/p>\n<p style=\"text-align: justify;\">\u5728\u8282\u70b91\u4e0a\uff0c\u6309\u4ee5\u4e0b\u683c\u5f0f\u521b\u5efaIPsec\u9636\u6bb52\u6761\u76ee\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>\u6a21\u5f0f\uff1a\u8def\u7531\uff08VTI\uff09<\/li>\n<li>\u672c\u5730\u7f51\u7edc\uff1a\u5177\u6709\u8303\u56f4\u7684\u7f51\u7edc\u00a0<code>10.6.6.1\/30<\/code><\/li>\n<li>\u8fdc\u7a0b\u7f51\u7edc\uff1a\u00a0<code>10.6.6.2<\/code><\/li>\n<li>\u6839\u636e\u9700\u8981\u8bbe\u7f6e\u63d0\u6848\u90e8\u5206\u3002<\/li>\n<li>\u5355\u51fb\u4fdd\u5b58\uff0c\u7136\u540e\u5355\u51fb\u5e94\u7528\u66f4\u6539<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">\u5728\u8282\u70b92\u4e0a\uff0c\u521b\u5efa\u4e0e\u8282\u70b91\u7c7b\u4f3c\u7684IPsec\u9636\u6bb52\u6761\u76ee\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>\u6a21\u5f0f\uff1a\u8def\u7531\uff08VTI\uff09<\/li>\n<li>\u672c\u5730\u7f51\u7edc\uff1a\u5177\u6709\u8303\u56f4\u7684\u7f51\u7edc\u00a0<code>10.6.6.2\/30<\/code><\/li>\n<li>\u8fdc\u7a0b\u7f51\u7edc\uff1a\u00a0<code>10.6.6.1<\/code><\/li>\n<li>\u63d0\u6848\u90e8\u5206\u4e0e\u8282\u70b91\u76f8\u540c\u3002<\/li>\n<li>\u5355\u51fb\u4fdd\u5b58\uff0c\u7136\u540e\u5355\u51fb\u5e94\u7528\u66f4\u6539<\/li>\n<\/ul>\n<h1 style=\"text-align: justify;\"><span id=\"Attribution_d'une_interface\"><\/span><span id=\"Attribution_d.27une_interface\" class=\"mw-headline\"><span class=\"mw-headline-number\">2.<\/span>\u63a5\u53e3\u7684\u5206\u914d<\/span><\/h1>\n<p style=\"text-align: justify;\">\u5728\u8282\u70b91\u548c\u8282\u70b92\u4e0a\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>\u5bfc\u822a\u5230<strong>Interfaces &gt; Assignments\uff08\u7f51\u7edc\u63a5\u53e3&gt;\u63a5\u53e3\u7ba1\u7406\uff09<\/strong><\/li>\n<li>\u4ece\u5217\u8868\u4e2d\u9009\u62e9\u63a5\u53e3\u53ef\u7528\u7f51\u7edc\u63a5\u53e3<span style=\"color: #222222; font-family: Monaco, Consolas, Andale Mono, DejaVu Sans Mono, monospace;\"><span style=\"font-size: 13px; background-color: #e9ebec;\"><code>ipsec1000<\/code><\/span><\/span>\uff0c\u7136\u540e\u5355\u51fb\u201c\u6dfb\u52a0\u201d\u3002\u6ce8\u610f\u521b\u5efa\u7684\u63a5\u53e3\uff08<code>OPTx<\/code>\uff09\u3002<\/li>\n<li>\u5355\u51fb\u201c\u63a5\u53e3\u201d&gt;\u00a0<code>OPTx<\/code><\/li>\n<li>\u9009\u4e2d\u201c\u542f\u7528\u201d\u9009\u6846\uff0c\u5e76\u5728\u201c\u63cf\u8ff0\u201d\u5b57\u6bb5\u4e2d\u4e3a\u63a5\u53e3\u6307\u5b9a\u5408\u9002\u7684\u540d\u79f0\u3002<\/li>\n<li>\u6839\u636e\u9700\u8981\u586b\u5199\u5176\u4ed6\u5b57\u6bb5\u3002<\/li>\n<li>\u5355\u51fb\u4fdd\u5b58\uff0c\u7136\u540e\u5355\u51fb\u5e94\u7528\u66f4\u6539<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">\u5728pfsense\u7cfb\u7edf\u4eea\u8868\u4e0a\uff0c\u5e94\u8be5\u770b\u5230\u96a7\u9053IP\u5730\u5740\u7684\u63a5\u53e3\uff0c\u4ee5\u53ca\u7f51\u5173\uff08\u5bf9\u5e94\u4e8e\u8fdc\u7a0b\u8282\u70b9\u7684IP\u5730\u5740\uff09\u3002<\/p>\n<h1 style=\"text-align: justify;\"><span id=\"Routage\" class=\"mw-headline\"><span class=\"mw-headline-number\">3.<\/span>\u8def\u7531\u8bbe\u7f6e<\/span><\/h1>\n<p style=\"text-align: justify;\">\u5bfc\u822a\u5230<strong>System &gt; Routing\uff08\u7cfb\u7edf&gt;\u8def\u7531\u7ba1\u7406\uff09<\/strong>\uff0c\u7136\u540e\u5355\u51fb\u9759\u6001\u8def\u7531\u3002<\/p>\n<p style=\"text-align: justify;\">\u5728\u8282\u70b91\u4e0a\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>\u5355\u51fb\u6dfb\u52a0<\/li>\n<li>\u5728\u76ee\u6807\u7f51\u7edc\u5b57\u6bb5\u4e2d\uff0c\u8f93\u5165\u8282\u70b92\u7684 LAN\u7f51\u7edc\u7684\u8303\u56f4<\/li>\n<li>\u5728\u201c\u7f51\u5173\u201d\u5b57\u6bb5\u4e2d\uff0c\u9009\u62e9IPsec\u7f51\u5173\uff08\u5b83\u4e0e\u4f60\u521b\u5efa\u7684\u540e\u7f00\u4e3a_VTIV4\u7684\u63a5\u53e3\u540c\u540d\uff09<\/li>\n<li>\u5355\u51fb\u4fdd\u5b58\uff0c\u7136\u540e\u5355\u51fb\u5e94\u7528<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">\u5728\u8282\u70b92\u4e0a\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>\u5355\u51fb\u6dfb\u52a0<\/li>\n<li>\u5728\u76ee\u6807\u7f51\u7edc\u5b57\u6bb5\u4e2d\uff0c\u8f93\u5165\u8282\u70b91\u7684LAN\u7f51\u7edc\u8303\u56f4<\/li>\n<li>\u5728\u201c\u7f51\u5173\u201d\u5b57\u6bb5\u4e2d\uff0c\u9009\u62e9IPsec\u7f51\u5173\uff08\u5b83\u4e0e\u4f60\u521b\u5efa\u7684\u540e\u7f00\u4e3a_VTIV4\u7684\u63a5\u53e3\u540c\u540d\uff09<\/li>\n<li>\u5355\u51fb\u4fdd\u5b58\uff0c\u7136\u540e\u5355\u51fb\u5e94\u7528<\/li>\n<\/ul>\n<h2 style=\"text-align: justify;\"><span id=\"Redirection_de_trafic_(Policy_Routing)\"><\/span><span id=\"Redirection_de_trafic_.28Policy_Routing.29\" class=\"mw-headline\"><span class=\"mw-headline-number\">3.1<\/span>\u7b56\u7565\u8def\u7531<\/span><\/h2>\n<p style=\"text-align: justify;\">\u5f3a\u5236\u5c06\u8282\u70b91\u7684LAN IP\u7684\u5bf9\u5916\u6d41\u91cf\u901a\u8fc7\u8282\u70b92\u7684WAN IP\u51fa\u7ad9\u3002<\/p>\n<p style=\"text-align: justify;\">\u5728\u8282\u70b91\u4e0a\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>\u521b\u5efaLAN\u9632\u706b\u5899\u89c4\u5219\uff0c\u6839\u636e\u9700\u8981\u8bbe\u7f6e\u4e0d\u540c\u7684\u5b57\u6bb5<\/li>\n<li>\u5728\u9ad8\u7ea7\u9009\u9879\u7684<strong>\u7f51\u5173<\/strong>\u5b57\u6bb5\u4e0a\uff0c\u9009\u62e9IPsec\u96a7\u9053\u7f51\u5173<\/li>\n<li>\u5355\u51fb\u4fdd\u5b58\uff0c\u7136\u540e\u5355\u51fb\u5e94\u7528<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">\u8bbe\u7f6e\u540e\uff0c\u8282\u70b91\u7684LAN\u5bf9\u5916\u8bbf\u95ee\u6d41\u91cf\u5c06\u901a\u8fc7\u8282\u70b92\u7684WAN IP\u51fa\u7ad9\uff0c\u8282\u70b92\u7684\u51fa\u7ad9NAT\u5fc5\u987b\u914d\u7f6e\u4e3a\u81ea\u52a8\u6a21\u5f0f\u3002<\/p>\n<p style=\"text-align: justify;\">\u5982\u679c\u4e0d\u662f\uff0c\u8bf7\u5728\u8282\u70b92\u4e0a\u8fdb\u884c\u5982\u4e0b\u8bbe\u7f6e\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>\u5bfc\u822a\u5230<strong>Firewall &gt; NAT\uff08\u9632\u706b\u5899&gt;NAT\uff09<\/strong>\uff0c\u7136\u540e\u5355\u51fb\u51fa\u7ad9<\/li>\n<li>\u9009\u62e9\u81ea\u52a8\u51fa\u7ad9NAT\u89c4\u5219\u751f\u6210<\/li>\n<li>\u5355\u51fb\u4fdd\u5b58<\/li>\n<li>\u5728\u81ea\u52a8\u6a21\u5f0f\u4e0b\uff0cpfsense\u4e3a\u5206\u914d\u7ed9IPsec\u7f51\u5173\u7684\u6240\u6709\u8def\u7531\u81ea\u52a8\u521b\u5efa\u51fa\u7ad9NAT\u89c4\u5219<\/li>\n<\/ul>\n<h1 style=\"text-align: justify;\"><span id=\"Firewall_du_tunnel_IPsec\" class=\"mw-headline\"><span class=\"mw-headline-number\">4.<\/span>\u00a0IPsec\u96a7\u9053\u9632\u706b\u5899<\/span><\/h1>\n<p style=\"text-align: justify;\">\u6240\u6709IPsec\u96a7\u9053\u7684\u9632\u706b\u5899\u7ba1\u7406\u90fd\u5728\u9632\u706b\u5899\u7684IPsec\u63a5\u53e3\u9009\u9879\u5361\u4e2d\u5b8c\u6210\uff08\u4e0d\u5728\u4f60\u521b\u5efa\u7684\u63a5\u53e3\u9009\u9879\u5361\u4e0a\uff09\u3002<\/p>\n<p>\u539f\u6587<a href=\"http:\/\/wiki.csnu.org\/index.php\/Routed_IPsec_(VTI)_with_pfsense\">\u5730\u5740<\/a>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u4e2a\u65b0\u529f\u80fd\u53ef\u4ecepfsense 2.4.4\u83b7\u5f97\uff0c\u5b83\u6d88\u9664\u4e86\u9636\u6bb52 IPsec\u914d\u7f6e\u4e2d\uff08 &hellip; <a href=\"https:\/\/blog.pfchina.org\/?p=1258\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[159],"class_list":["post-1258","post","type-post","status-publish","format-standard","hentry","category-pfsense","tag-vti"],"_links":{"self":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/1258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1258"}],"version-history":[{"count":0,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/1258\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}