{"id":404,"date":"2012-06-29T14:59:24","date_gmt":"2012-06-29T14:59:24","guid":{"rendered":""},"modified":"2013-02-07T12:10:29","modified_gmt":"2013-02-07T04:10:29","slug":"%e5%85%ad%e6%ad%a5%e6%90%9e%e5%ae%9acentos-6%e4%b8%8bl2tp-%2b-ipsec-vpn%e6%9c%8d%e5%8a%a1%e5%99%a8%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/dingxuan.info\/wp\/?p=404","title":{"rendered":"\u516d\u6b65\u641e\u5b9acentos 6\u4e0bl2tp + ipsec VPN\u670d\u52a1\u5668\u914d\u7f6e"},"content":{"rendered":"<p>\u8fd1\u5e74\u6765\u6700\u7d2f\u7684\u4e00\u6b21\u6298\u817e\u3002\u6709\u5fc5\u8981\u597d\u597d\u8bb0\u5f55\u4e00\u4e0b\u3002\u8ddf\u4e86\u7f51\u4e0aN\u4e2a\u6559\u7a0b\uff0c\u6709\u597d\u51e0\u4e2a\u90fd\u8d70\u4e0d\u901a\u3002\u6700\u540e\u81ea\u5df1\u5f7b\u5e95\u6574\u7406\u4e86\u4e00\u6b21\u3002\u628a\u81ea\u5df1\u7684\u7ecf\u9a8c\u548c\u914d\u7f6e\u5206\u4eab\u51fa\u6765\u3002<br \/><br \/>\u9996\u5148\u9686\u91cd\u611f\u8c22\u4e00\u4e0b\u81f3\u4eca\u7d20\u672a\u8c0b\u9762\u7684\u8001\u718a\uff0c\u771f\u662f\u597d\u4eba\u554a\u300206\u5e74\u7684\u65f6\u5019\u5c31\u5728plesk\u670d\u52a1\u5668\u6362ip\u7684\u4e8b\u4e0a\uff0c\u5e2e\u4e86\u6211\u597d\u5927\u7684\u5fd9\u3002\u6ca1\u60f3\u5230\u8fd9\u6b21\u5728\u6211\u5361\u5728\u7b2c6\u6b65\uff0c\u6700\u7edd\u671b\u7684\u65f6\u5019\uff0c\u8fd9\u53ea\u718a\u7684\u5a40\u5a1c\u8eab\u5f71\u518d\u4e00\u6b21\u51fa\u73b0\u5728\u4e86\u6211\u7684\u751f\u6d3b\u4e2d\u3002\u8fd8\u5728\u6f06\u9ed1\u7684\u6df1\u591c\u4e2d\u966a\u4f34\u5728\u6211\u7684\u8eab\u8fb9\u3002\u4ee5\u4e0b\u9686\u91cd\u516c\u5e03\u4e00\u4e0b\u4ed6\u7684QQ\uff0c\u9020\u798f\u5e7f\u5927\u7f51\u53cb\uff01QQ: 499*<strong>**<\/strong> \uff08\u540e\u51e0\u4f4d\u53f7\u7801\uff0c\u4e3a\u7b26\u5408\u5f53\u5730\u83ab\u540d\u5176\u5999\u7684\u201c\u76f8\u5173\u6cd5\u89c4\u201d\uff0c\u88ab\u7cfb\u7edf\u81ea\u52a8\u5c4f\u853d\u3002\u3002\u3002\uff09<br \/><br \/>\u5176\u6b21\u8981\u611f\u8c22\u8001\u718a\u7684\u540c\u4e8b\uff0c\u767e\u5fd9\u4e2d\u5199\u597d\u7684\u9632\u706b\u5899\u89c4\u5219\uff0c\u8ba9\u621110\u5206\u949f\u4e4b\u5185\uff0c\u5c31\u88ab\u5174\u594b\u5f97\u660f\u4e86\u5934\u7684\u6211\uff0c\u7ed9\u65e0\u60c5\u8986\u76d6\u4e86\u3002\u4ee5\u81f3\u4e8e\u4e0b\u6b21\u4eba\u5bb6\u91cd\u5199\u4e4b\u540e\uff0c\u5f88\u81ea\u89c9\u7684\u5728\/root\u4e0b\u7ed9\u7559\u4e86\u4e2a\u5907\u4efd\u3002[emot]zan[\/emot]<!--more--><br \/><br \/><br \/><span style=\"font-size: 18px\">1. \u5148\u5b89\u88c5openswan<\/span>\n<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">yum install -y ppp iptables make gcc gmp-devel xmlto bison flex xmlto libpcap-devel lsof\nwget <a href=\"http:\/\/download.openswan.org\/openswan\/openswan-2.6.38.tar.gz\">http:\/\/download.openswan.org\/openswan\/openswan-2.6.38.tar.gz<\/a>\ntar zxvf openswan-2.6.38.tar.gz\ncd openswan-2.6.38\nmake programs install\n<\/pre>\n<br \/><br \/><a href=\"http:\/\/b.gkp.cc\/2010\/06\/19\/setup-ipsec-l2tp-on-centos-55\/\" target=\"_blank\">gkp\u8bf4<\/a>\u201c\u5b89\u88c5 openswan\uff0c\u8bb0\u5f97\u522b\u75282.6.26\uff0c\u5b81\u53ef\u75282.6.24\u3002\u4ed6\u548cxl2tpd\u5b58\u5728\u4e25\u91cd\u517c\u5bb9\u6027bug\u201d<br \/><br \/><br \/><span style=\"font-size: 18px\">2. \u5b89\u88c5xl2tpd<\/span>\n<br \/><br \/>\u5728centos 6\u5b98\u65b9\u7684yum\u6e90\u4e2d\uff0c\u6ca1\u6709\u8fd9\u4e2a\u8f6f\u4ef6\u5305\u3002\u9700\u8981\u5b89\u88c5fedora\u7684epel\u6e90\u3002<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">rpm -Uvh <a href=\"http:\/\/mirrors.ustc.edu.cn\/fedora\/epel\/6\/x86_64\/epel-release-6-7.noarch.rpm\">http:\/\/mirrors.ustc.edu.cn\/fedora\/epel\/6\/x86_64\/epel-release-6-7.noarch.rpm<\/a>\n#CentOS 5\u7528\u8fd9\u4e2a\u5730\u5740\uff1a&nbsp;&nbsp;rpm -Uvh <a href=\"http:\/\/mirrors.ustc.edu.cn\/fedora\/epel\/5\/i386\/epel-release-5-4.noarch.rpm\">http:\/\/mirrors.ustc.edu.cn\/fedora\/epel\/5\/i386\/epel-release-5-4.noarch.rpm<\/a>\nyum install xl2tpd -y<\/pre>\n<br \/><br \/>\u5982\u679c\u4e0a\u9762\u8fd9\u4e2a\u5b89\u88c5\u5730\u5740\u5982\u679c\u4e0d\u5bf9\u4e86\u3002\u53c2\u7167\u8fd9\u4e2afedora epel\u7684faq\u9875\uff08<a href=\"https:\/\/fedoraproject.org\/wiki\/EPEL\/FAQ\/zh-cn#How_can_I_install_the_packages_from_the_EPEL_software_repository.3F\">https:\/\/fedoraproject.org\/wiki\/EPEL\/FAQ\/zh-cn#How_can_I_install_the_packages_from_the_EPEL_software_repository.3F<\/a>\uff09<br \/><br \/>\u5b89\u88c5\u5176\u4ed6\u4e00\u4e9blinux\u8f6f\u4ef6\u6e90\uff0c\u53c2\u7167\u8fd9\u9875\uff1a<a href=\"http:\/\/dingxuan.info\/blog\/post\/repo-sources.php\">http:\/\/dingxuan.info\/blog\/post\/repo-sources.php<\/a><br \/><br \/><br \/>\u7f16\u8f91 \/etc\/ipsec.conf \u6ce8\u610f$esojourn.org\u66ff\u6362\u6210\u4f60\u673a\u5668\u7684ip\u3002\u8fd9\u4e2aIP\u5e94\u8be5\u662f\u4f60\u7684\u516c\u7f51IP\uff0c\u4e0d\u662f\u672c\u673a\u5185\u7f51IP\u3002<br \/><br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\"><\/p>\n<h1 class=\"wp-block-heading\">\/etc\/ipsec.conf - Openswan IPsec configuration file<\/h1>\n<h1 class=\"wp-block-heading\">This file:&nbsp;&nbsp;\/usr\/local\/share\/doc\/openswan\/ipsec.conf-sample<\/h1>\n<p>#<\/p>\n<h1 class=\"wp-block-heading\">Manual:&nbsp;&nbsp;&nbsp;&nbsp; ipsec.conf.5<\/h1>\n<p>version 2.0&nbsp;&nbsp;&nbsp;&nbsp; # conforms to second version of ipsec.conf specification<\/p>\n<h1 class=\"wp-block-heading\">basic configuration<\/h1>\n<p>config setup\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Do not set debug options to debug configuration issues!\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# plutodebug \/ klipsdebug = \"all\", \"none\" or a combation from below:\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# \"raw crypt parsing emitting control klips pfkey natt x509 dpd private\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# eg:\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# plutodebug=\"control parsing\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Again: only enable plutodebug or klipsdebug when asked by a developer\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# enable to get logs per-peer\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# plutoopts=\"--perpeerlog\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Enable core dumps (might require system changes, like ulimit -C)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# This is required for abrtd to work properly\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Note: incorrect SElinux policies might prevent pluto writing the core\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dumpdir=\/var\/run\/pluto\/\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# NAT-TRAVERSAL support, see README.NAT-Traversal\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nat_traversal=yes\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# exclude networks used on server side by adding %v4:!a.b.c.0\/24\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# It seems that T-Mobile in the US and Rogers\/Fido in Canada are\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# using 25\/8 as \"private\" address space on their 3G network.\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# This range has not been announced via BGP (at least upto 2010-12-21)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;virtual_private=%v4:10.0.0.0\/8,%v4:192.168.0.0\/16,%v4:172.16.0.0\/12,%v4:25.0.0.0\/8,%v6:fd00::\/8,%v6:fe80::\/10\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# OE is now off by default. Uncomment and change to on, to enable.\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oe=off\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# which IPsec stack to use. auto will try netkey, then klips then mast<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;protostack=netkey\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#\u8fd9\u91cc\u6ce8\u91ca\u8bf4\u53ef\u4ee5\u7528auto\uff0c\u4f46\u5b9e\u9645\u4e0a\u4e0d\u884c\u3002\u8fd8\u5f97\u8001\u8001\u5b9e\u5b9e\u5199netkey<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Use this to log to a file, or disable logging on embedded systems (like openwrt)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#plutostderrlog=\/dev\/null<\/p>\n<h1 class=\"wp-block-heading\">Add connections here<\/h1>\n<h1 class=\"wp-block-heading\">sample VPN connection<\/h1>\n<h1 class=\"wp-block-heading\">for more examples, see \/etc\/ipsec.d\/examples\/<\/h1>\n<p>#conn sample\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Left security gateway, subnet behind it, nexthop toward right.\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; left=10.0.0.1\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; leftsubnet=172.16.0.0\/24\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; leftnexthop=10.22.33.44\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Right security gateway, subnet behind it, nexthop toward left.\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; right=10.12.12.1\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rightsubnet=192.168.0.0\/24\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rightnexthop=10.101.102.103\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # To authorize this connection, but not actually start it,\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # at startup, uncomment this.\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #auto=add<\/p>\n<p>conn L2TP-PSK-NAT\n&nbsp;&nbsp;&nbsp;&nbsp;rightsubnet=vhost:%priv\n&nbsp;&nbsp;&nbsp;&nbsp;also=L2TP-PSK-noNAT<\/p>\n<p>conn L2TP-PSK-noNAT\n&nbsp;&nbsp;&nbsp;&nbsp;authby=secret\n&nbsp;&nbsp;&nbsp;&nbsp;pfs=no\n&nbsp;&nbsp;&nbsp;&nbsp;auto=add\n&nbsp;&nbsp;&nbsp;&nbsp;keyingtries=3\n&nbsp;&nbsp;&nbsp;&nbsp;rekey=no\n&nbsp;&nbsp;&nbsp;&nbsp;ikelifetime=8h\n&nbsp;&nbsp;&nbsp;&nbsp;keylife=1h\n&nbsp;&nbsp;&nbsp;&nbsp;type=transport\n&nbsp;&nbsp;&nbsp;&nbsp;left=$esojourn.org&nbsp;&nbsp;#\u8fd9\u91cc\u5199\u516c\u7f51IP\uff0c\u6ca1\u56fa\u5b9aIP\u7684\u5c31\u5230\u82b1\u751f\u58f3\u5f04\u4e2a\u52a8\u6001\u57df\u540d\u89e3\u6790\u3002\n&nbsp;&nbsp;&nbsp;&nbsp;leftid=$esojourn.org\n&nbsp;&nbsp;&nbsp;&nbsp;leftprotoport=17\/1701\n&nbsp;&nbsp;&nbsp;&nbsp;right=%any\n<\/pre>\n<br \/>\u4fee\u6539ipsec\u5bc6\u94a5<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">vi&nbsp;&nbsp;\/etc\/ipsec.secrets<\/p>\n<p>www.esojourn.org %any: PSK \"myps\"\n#www.esojourn.org\u6539\u6210\u516c\u7f51ip\uff0c\u6ca1\u56fa\u5b9aIP\u7684\uff0c\u5c31\u5230\u82b1\u751f\u58f3\u5f04\u4e2a\u52a8\u6001\u57df\u540d\u89e3\u6790\u3002<a href=\"http:\/\/www.oray.com\/peanuthull\/\">http:\/\/www.oray.com\/peanuthull\/<\/a>\n#myps\u6539\u6210\u5bc6\u7801\n<\/pre>\n<br \/><br \/><span style=\"font-size: 18px\">3. \u4fee\u6539\/etc\/sysctl.conf\uff0c\u5f00\u542f\u8def\u7531\u529f\u80fd<\/span>\n<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">vi \/etc\/sysctl.conf<\/pre>\n<br \/><a href=\"http:\/\/hi.baidu.com\/guolibo\/blog\/item\/e54d8101d014d6f6267fb575.html\" target=\"_blank\">\u661f\u4e91\u8bf4<\/a>\uff1a<br \/>\u5c06\u4e0b\u9762\u4e24\u9879\u627e\u5230\uff1a<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">net.ipv4.ip_forward = 0\nnet.ipv4.conf.default.rp_filter = 1<\/pre>\n<br \/>\u6539\u4e3a\uff1a<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">net.ipv4.ip_forward = 1\nnet.ipv4.conf.default.rp_filter = 0<\/pre>\n<br \/>\u4e4b\u540e\u5148\u8ba9\u4fee\u6539\u540e\u7684\u914d\u7f6e\u751f\u6548\uff0c\u518d\u6d4b\u8bd5\u4e00\u4e0b\uff0c<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">sysctl -p\nservice ipsec start\nipsec verify<\/pre>\n<br \/><br \/>\u5982\u679c\u884c\u4e86\u5c31\u8fd9\u6837\u4e86\uff0c\u4f46\u5b9e\u9645\u4e0a\uff0c\u6211\u53cd\u590d\u6d4b\u8bd5\u4e4b\u540e\uff0c\u5e72\u8106\u5728sysctl.conf\u6700\u4e0b\u9762\uff0c\u52a0\u4e86\u8fd9\u4e00\u6bb5\u3002\u52a0\u597d\u540e\u522b\u5fd8\u4e86\u518dsysctl -p\u4e00\u4e0b\u3002<br \/><br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n#added for xl2tpd\nnet.ipv4.ip_forward = 1\nnet.ipv4.conf.default.rp_filter = 0\nnet.ipv4.conf.all.send_redirects = 0\nnet.ipv4.conf.default.send_redirects = 0\nnet.ipv4.conf.all.log_martians = 0\nnet.ipv4.conf.default.log_martians = 0\nnet.ipv4.conf.default.accept_source_route = 0\nnet.ipv4.conf.all.accept_redirects = 0\nnet.ipv4.conf.default.accept_redirects = 0\nnet.ipv4.icmp_ignore_bogus_error_responses = 1<\/pre>\n<br \/><br \/>\u5982\u679cipsec verify\u8fd4\u56de\u8fd9\u6837\uff0c\u5c31\u53ef\u4ee5\u4e86\u3002<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nChecking your system to see if IPsec got installed and started correctly:\nVersion check and ipsec on-path&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#x5B;OK]\nLinux Openswan U2.6.24\/K2.6.32.16-linode28 (netkey)\nChecking for IPsec support in kernel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;OK]\nNETKEY detected, testing for disabled ICMP send_redirects&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#x5B;OK]\nNETKEY detected, testing for disabled ICMP accept_redirects&nbsp;&nbsp;&nbsp;&nbsp; &#x5B;OK]\nChecking for RSA private key (\/etc\/ipsec.secrets)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#x5B;OK]\nChecking that pluto is running&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;OK]\nPluto listening for IKE on udp 500&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;OK]\nPluto listening for NAT-T on udp 4500&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#x5B;OK]\nTwo or more interfaces found, checking IP forwarding&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;OK]\nChecking NAT and MASQUERADEing\nChecking for &#039;ip&#039; command&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#x5B;OK]\nChecking for &#039;iptables&#039; command&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#x5B;OK]\nOpportunistic Encryption Support&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;DISABLED]<\/pre>\n<br \/><br \/>\u6211\u7684\u7ecf\u9a8c\u4e2d\uff0c\u8fd9\u91cc\u53ef\u80fd\u4f1a\u51fa\u8fd9\u4e48\u51e0\u4e2a\u6545\u969c\uff1a<br \/>\u7b2c\u4e00\uff1a<pre class=\"brush: plain; title: ; notranslate\" title=\"\">SAref kernel support                                           &#x5B;N\/A]<\/pre>\n<br \/>\u8fd9\u6837\u7684\u8bdd\uff0c \/etc\/xl2tpd\/xl2tpd.conf\u8fd9\u4e2a\u6587\u4ef6\u91cc<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">&#x5B;global]\nipsec saref = no<\/pre>\n<br \/><br \/>\u7b2c\u4e8c\uff1a<pre class=\"brush: plain; title: ; notranslate\" title=\"\">Two or more interfaces found, checking IP forwarding&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;FAILED]\nChecking NAT and MASQUERADEing&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;OK]\n<\/pre>ip\u8f6c\u53d1\u68c0\u67e5\u5931\u8d25\u3002<br \/><br \/><a href=\"https:\/\/lists.openswan.org\/pipermail\/users\/2010-May\/018841.html\" target=\"_blank\">Paul\u548cSteve\u8bf4\uff1a<\/a>\u53ea\u8981 cat \/proc\/sys\/net\/ipv4\/ip_forward \u8fd4\u56de\u7ed3\u679c\u662f1\u5c31\u6ca1\u4e8b\u3002\u8fd9\u4e2a\u6211\u5df2\u7ecf\u8bc1\u5b9e\u4e86\u3002<br \/><br \/>\u7b2c\u4e09\uff1a\u8fd4\u56de\u7ed3\u679c\u91cc\uff0c\u5c31\u6ca1\u6709Two or more interfaces found, checking IP forwarding\u548cChecking NAT and MASQUERADEing\u8fd9\u4e24\u9879\u3002\u78b0\u4e0a\u8fd9\u4e2a\u6211\u4e5f\u6ca1\u529e\u6cd5\u4e86\u3002\u91cd\u88c5\u4e86\u7cfb\u7edf\uff0c\u53c8\u778e\u6298\u817e\u4e00\u901a\u4e4b\u540e\u5c31\u597d\u4e86\u3002<br \/><br \/>[ 2012-7-6 ]<br \/>\u7b2c\u56db\uff1a\u66f4\u65b0\u52a0\u5165\u4e00\u4e2a\u65b0\u7684\u60c5\u51b5<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">Checking for IPsec support in kernel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;OK]\nSAref kernel support&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#x5B;N\/A]\nNETKEY:&nbsp;&nbsp;Testing XFRM related proc values&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;OK]\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;OK]\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;FAILED]<\/p>\n<p>&nbsp;&nbsp;Please enable \/proc\/sys\/net\/core\/xfrm_larval_drop\n&nbsp;&nbsp;or NETKEY will cause non-POSIX compliant long time-outs<\/p>\n<p>Checking that pluto is running&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;OK]\n<\/pre>\n<br \/>\u51fa\u8fd9\u6bdb\u75c5\uff0c\u7167\u7740\u8bf4\u660e\uff0c<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">echo 1 &gt; \/proc\/sys\/net\/core\/xfrm_larval_drop\nvi \/etc\/bashrc\n<\/pre>\n<br \/>\u7136\u540e\u628a\u201cecho 1 &gt; \/proc\/sys\/net\/core\/xfrm_larval_drop\u201d\u8fd9\u53e5\u52a0\u8fdb\u53bb\u3002\u4ee5\u540e\u6bcf\u6b21\u5f00\u673a\u81ea\u52a8\u6267\u884c\u4e00\u4e0b\u3002<br \/><br \/><span style=\"font-size: 18px\">4. \u7f16\u8f91 \/etc\/xl2tpd\/xl2tpd.conf<\/span>\n<br \/>vi \/etc\/xl2tpd\/xl2tpd.conf<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n; This is a minimal sample xl2tpd configuration file for use\n; with L2TP over IPsec.\n;\n; The idea is to provide an L2TP daemon to which remote Windows L2TP\/IPsec\n; clients connect. In this example, the internal (protected) network\n; is 192.168.1.0\/24.&nbsp;&nbsp;A special IP range within this network is reserved\n; for the remote clients: 192.168.1.128\/25\n; (i.e. 192.168.1.128 ... 192.168.1.254)\n;\n; The listen-addr parameter can be used if you want to bind the L2TP daemon\n; to a specific IP address instead of to all interfaces. For instance,\n; you could bind it to the interface of the internal LAN (e.g. 192.168.1.98\n; in the example below). Yet another IP address (local ip, e.g. 192.168.1.99)\n; will be used by xl2tpd as its address on pppX interfaces.<\/p>\n<p>&#x5B;global]\nlisten-addr = esojourn.org&nbsp;&nbsp;\n;\u8fd9\u91cc\u5199\u5185\u7f51IP\u3002\u6216\u8005\u52a0;\u6ce8\u91ca\u6389\u4e5f\u95ee\u9898\u4e0d\u5927\u3002\n;\n; requires openswan-2.5.18 or higher - Also does not yet work in combination\n; with kernel mode l2tp as present in linux 2.6.23+\n; ipsec saref = yes\nipsec saref = no\n;\u8fd9\u91cc\u4e00\u822c\u90fd\u8ba9\u5199yes\uff0c\u4f46\u5982\u679c\u521a\u624d\u4f60\u7684ipsec verify\u4e2d\uff0c\u6709\u62a5SAref kernel support&#x5B;N\/A]\u7684\u8bdd\uff0c\u8fd9\u91cc\u5c31\u5199no\u3002<\/p>\n<p>; Use refinfo of 22 if using an SAref kernel patch based on openswan 2.6.35 or\n;&nbsp;&nbsp;when using any of the SAref kernel patches for kernels up to 2.6.35.\n; ipsec refinfo = 30\n;\n; forceuserspace = yes\n;\n; debug tunnel = yes<\/p>\n<p>&#x5B;lns default]\nip range = 192.168.7.128-192.168.7.254\n;\u8fd9\u91cc\u5199vpn client\u7684ip\u6bb5\nlocal ip = 192.168.7.1<\/p>\n<p>require chap = yes\nrefuse pap = yes\nrequire authentication = yes\nname = LinuxVPNserver\nppp debug = yes\npppoptfile = \/etc\/ppp\/options.xl2tpd\nlength bit = yes\n<\/pre>\n<br \/><br \/><span style=\"font-size: 18px\">5. \u4fee\u6539 \/etc\/ppp\/options.xl2tpd<\/span>\n<br \/><br \/>vi \/etc\/ppp\/options.xl2tpd<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">require-mschap-v2\nipcp-accept-local\nipcp-accept-remote\nms-dns&nbsp;&nbsp;8.8.4.4\nms-dns&nbsp;&nbsp;8.8.8.8\nnoccp\nauth\ncrtscts\nidle 1800\nmtu 1410\nmru 1410\nnodefaultroute\ndebug\nlock\nproxyarp\nconnect-delay 5000\n<\/pre>\n<br \/><br \/>vi \/etc\/ppp\/chap-secrets<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">#\u6587\u4ef6\u683c\u5f0f<\/p>\n<h1 class=\"wp-block-heading\">user server password ip<\/h1>\n<dl>\n<dt>username <em> userpass <\/em> #\u6539\u6210\u4f60\u7684\u7528\u6237\u540d \u5bc6\u7801<\/pre><\/dt>\n<dt><br \/><br \/><span style=\"font-size: 18px\">6. \u6700\u5173\u952e\u7684iptables\u914d\u7f6e<\/span><\/dt>\n<dt><br \/>\u505a\u5b8c\u4e0a\u9762\u8fd9\u5806\u6b65\u9aa4\u4e4b\u540e\uff0c\u5ba2\u6237\u7aef\u5efa\u4e2a\u8fde\u63a5\u5c31\u53ef\u4ee5\u9a8c\u8bc1\u8fdb\u5165vpn\u4e3b\u673a\u4e86\u3002\u4f46\u662f\u65e0\u6cd5\u8bbf\u95ee\u5185\u5916\u7f51\u3002\u6211\u5c31\u662f\u5728\u8fd9\u91cc\u5361\u4e86\u4e00\u4e2a\u591a\u661f\u671f\u3002\u7f51\u4e0a\u7684\u8d44\u6599\uff0c\u6709\u7684\u6ca1\u8bf4\u8fd9\u4e00\u6b65\u3002\u6709\u7684\u8bf4\u4e86\u4e5f\u6ca1\u8bf4\u5168\u3002\u6211\u53d1\u4e2a\u6743\u5a01\u7684\u5427\u3002<br \/><br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">iptables -t nat -A POSTROUTING -s 192.168.7.0\/24 -o eth0 -j MASQUERADE<\/dt>\n<dt>iptables -I FORWARD -s 192.168.7.0\/24 -j ACCEPT<\/dt>\n<dt>iptables -I FORWARD -d 192.168.7.0\/24 -j ACCEPT<\/dt>\n<dt>iptables-save<\/dt>\n<dt>service iptables restart<\/pre><\/dt>\n<dt><br \/>192.168.7.0\/24\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u66ff\u6362\u3002<br \/><br \/>vi \/etc\/sysconfig\/iptables \u770b\u5230\u7684\u5e94\u8be5\u662f\u7c7b\u4f3c\u8fd9\u6837\u3002<br \/>\u6700\u4e0a\u9762\u5148\u662fnat\u89c4\u5219\uff0c\u4e0b\u9762\u662ffilter\u89c4\u5219\u3002<br \/>\u4e0b\u9762filter\u8868\u91cc\uff0c\u5148\u628aVPN\u8981\u7528\u5230\u7684udp\u7aef\u53e31701\uff0c500\uff0c4500\u90fd\u6253\u5f00\u3002\u8981\u7528openvp\u7684\u8bdd\uff0c\u8fd8\u8981\u5f001194\u3002<br \/>\u53e6\u5916filter\u8868\u91cc\uff0c\u4e00\u5b9a\u8981\u6709FORWARD\u89c4\u5219\u3002\u8fd9\u70b9\u5728\u7f51\u4e0a\u597d\u51e0\u4e2a\u6559\u7a0b\u91cc\u90fd\u6ca1\u8bf4\uff01\u5751\u6b7b\u4eba\u3002<br \/><br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\"><\/dt>\n<dt>#\u4e0b\u9762\u89c4\u5219\u505a\u53c2\u8003\u554a\uff0c\u65b0\u624b\u522b\u5b8c\u5168\u7167\u6284\u3002<\/dt>\n<dt>*nat<\/dt>\n<dd>PREROUTING ACCEPT &#x5B;39:3503]<\/dd>\n<dd>POSTROUTING ACCEPT &#x5B;0:0]<\/dd>\n<dd>OUTPUT ACCEPT &#x5B;0:0]\n-A POSTROUTING -s 192.168.7.0\/24 -o eth0 -j MASQUERADE\nCOMMIT\n# Completed on Thu Jun 28 15:50:40 2012\n# Generated by iptables-save v1.4.7 on Thu Jun 28 15:50:40 2012\n*filter<\/dd>\n<dd>INPUT ACCEPT &#x5B;0:0]<\/dd>\n<dd>FORWARD ACCEPT &#x5B;0:0]<\/dd>\n<dd>OUTPUT ACCEPT &#x5B;121:13264]\n-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT\n-A INPUT -p icmp -j ACCEPT\n-A INPUT -i lo -j ACCEPT\n-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT\n-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT\n-A INPUT -p tcp -m state --state NEW -m tcp --dport 53 -j ACCEPT\n-A INPUT -p udp -m state --state NEW -m udp --dport 53 -j ACCEPT\n-A INPUT -p tcp -m state --state NEW -m tcp --dport 1194 -j ACCEPT\n-A INPUT -p udp -m state --state NEW -m udp --dport 1701 -j ACCEPT\n-A INPUT -p udp -m state --state NEW -m udp --dport 500 -j ACCEPT\n-A INPUT -p udp -m state --state NEW -m udp --dport 4500 -j ACCEPT<\/dd>\n<\/dl>\n<p>-A INPUT -j REJECT --reject-with icmp-host-prohibited\n-A FORWARD -d 192.168.7.0\/24 -j ACCEPT\n-A FORWARD -s 192.168.7.0\/24 -j ACCEPT\n-A FORWARD -j REJECT --reject-with icmp-host-prohibited\nCOMMIT<\/p>\n<h1 class=\"wp-block-heading\">Completed on Thu Jun 28 15:50:40 2012<\/h1>\n<p><\/pre>\n<br \/><br \/>\u6700\u540e<br \/><pre class=\"brush: plain; title: ; notranslate\" title=\"\">service xl2tpd restart\nservice iptables restart\nchkconfig xl2tpd on\nchkconfig iptables on\nchkconfig ipsec on<\/pre><\/p>","protected":false},"excerpt":{"rendered":"<p>\u8fd1\u5e74\u6765\u6700\u7d2f\u7684\u4e00\u6b21\u6298\u817e\u3002\u6709\u5fc5\u8981\u597d\u597d\u8bb0\u5f55\u4e00\u4e0b\u3002\u8ddf\u4e86\u7f51\u4e0aN\u4e2a\u6559\u7a0b\uff0c\u6709\u597d\u51e0\u4e2a\u90fd\u8d70\u4e0d\u901a\u3002\u6700\u540e\u81ea\u5df1\u5f7b\u5e95\u6574\u7406\u4e86\u4e00\u6b21\u3002\u628a\u81ea\u5df1\u7684 &hellip; <a href=\"https:\/\/dingxuan.info\/wp\/?p=404\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u516d\u6b65\u641e\u5b9acentos 6\u4e0bl2tp + ipsec VPN\u670d\u52a1\u5668\u914d\u7f6e<\/span><\/a><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117],"tags":[79,78,110],"class_list":["post-404","post","type-post","status-publish","format-standard","hentry","category-network","tag-centos","tag-linux","tag-vpn"],"_links":{"self":[{"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/posts\/404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=404"}],"version-history":[{"count":0,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/posts\/404\/revisions"}],"wp:attachment":[{"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}