{"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:\/\/ybzx.vip\/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<\/p>\n<p>\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******* \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<\/p>\n<p>\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--><\/p>\n<p><span style=\"font-size: 18px;\">1. \u5148\u5b89\u88c5openswan<\/span><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">yum install -y ppp iptables make gcc gmp-devel xmlto bison flex xmlto libpcap-devel lsof\r\nwget http:\/\/download.openswan.org\/openswan\/openswan-2.6.38.tar.gz\r\ntar zxvf openswan-2.6.38.tar.gz\r\ncd openswan-2.6.38\r\nmake programs install\r\n<\/pre>\n<p><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<\/p>\n<p><span style=\"font-size: 18px;\">2. \u5b89\u88c5xl2tpd<\/span><\/p>\n<p>\u5728centos 6\u5b98\u65b9\u7684yum\u6e90\u4e2d\uff0c\u6ca1\u6709\u8fd9\u4e2a\u8f6f\u4ef6\u5305\u3002\u9700\u8981\u5b89\u88c5fedora\u7684epel\u6e90\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">rpm -Uvh http:\/\/mirrors.ustc.edu.cn\/fedora\/epel\/6\/x86_64\/epel-release-6-7.noarch.rpm\r\n#CentOS 5\u7528\u8fd9\u4e2a\u5730\u5740\uff1a&nbsp;&nbsp;rpm -Uvh http:\/\/mirrors.ustc.edu.cn\/fedora\/epel\/5\/i386\/epel-release-5-4.noarch.rpm\r\nyum install xl2tpd -y<\/pre>\n<p>\u5982\u679c\u4e0a\u9762\u8fd9\u4e2a\u5b89\u88c5\u5730\u5740\u5982\u679c\u4e0d\u5bf9\u4e86\u3002\u53c2\u7167\u8fd9\u4e2afedora epel\u7684faq\u9875\uff08https:\/\/fedoraproject.org\/wiki\/EPEL\/FAQ\/zh-cn#How_can_I_install_the_packages_from_the_EPEL_software_repository.3F\uff09<\/p>\n<p>\u5b89\u88c5\u5176\u4ed6\u4e00\u4e9blinux\u8f6f\u4ef6\u6e90\uff0c\u53c2\u7167\u8fd9\u9875\uff1ahttp:\/\/dingxuan.info\/blog\/post\/repo-sources.php<\/p>\n<p>\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<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# \/etc\/ipsec.conf - Openswan IPsec configuration file\r\n\r\n# This file:&nbsp;&nbsp;\/usr\/local\/share\/doc\/openswan\/ipsec.conf-sample\r\n#\r\n# Manual:&nbsp;&nbsp;&nbsp;&nbsp; ipsec.conf.5\r\n\r\n\r\nversion 2.0&nbsp;&nbsp;&nbsp;&nbsp; # conforms to second version of ipsec.conf specification\r\n\r\n# basic configuration\r\nconfig setup\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Do not set debug options to debug configuration issues!\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# plutodebug \/ klipsdebug = \"all\", \"none\" or a combation from below:\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# \"raw crypt parsing emitting control klips pfkey natt x509 dpd private\"\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# eg:\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# plutodebug=\"control parsing\"\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Again: only enable plutodebug or klipsdebug when asked by a developer\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# enable to get logs per-peer\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# plutoopts=\"--perpeerlog\"\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#\r\n\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Enable core dumps (might require system changes, like ulimit -C)\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# This is required for abrtd to work properly\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Note: incorrect SElinux policies might prevent pluto writing the core\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dumpdir=\/var\/run\/pluto\/\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# NAT-TRAVERSAL support, see README.NAT-Traversal\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nat_traversal=yes\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# exclude networks used on server side by adding %v4:!a.b.c.0\/24\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# It seems that T-Mobile in the US and Rogers\/Fido in Canada are\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# using 25\/8 as \"private\" address space on their 3G network.\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# This range has not been announced via BGP (at least upto 2010-12-21)\r\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\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# OE is now off by default. Uncomment and change to on, to enable.\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oe=off\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# which IPsec stack to use. auto will try netkey, then klips then mast\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;protostack=netkey\r\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\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Use this to log to a file, or disable logging on embedded systems (like openwrt)\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#plutostderrlog=\/dev\/null\r\n\r\n# Add connections here\r\n\r\n# sample VPN connection\r\n# for more examples, see \/etc\/ipsec.d\/examples\/\r\n#conn sample\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Left security gateway, subnet behind it, nexthop toward right.\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; left=10.0.0.1\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; leftsubnet=172.16.0.0\/24\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; leftnexthop=10.22.33.44\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Right security gateway, subnet behind it, nexthop toward left.\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; right=10.12.12.1\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rightsubnet=192.168.0.0\/24\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rightnexthop=10.101.102.103\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # To authorize this connection, but not actually start it,\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # at startup, uncomment this.\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #auto=add\r\n\r\nconn L2TP-PSK-NAT\r\n&nbsp;&nbsp;&nbsp;&nbsp;rightsubnet=vhost:%priv\r\n&nbsp;&nbsp;&nbsp;&nbsp;also=L2TP-PSK-noNAT\r\n\r\nconn L2TP-PSK-noNAT\r\n&nbsp;&nbsp;&nbsp;&nbsp;authby=secret\r\n&nbsp;&nbsp;&nbsp;&nbsp;pfs=no\r\n&nbsp;&nbsp;&nbsp;&nbsp;auto=add\r\n&nbsp;&nbsp;&nbsp;&nbsp;keyingtries=3\r\n&nbsp;&nbsp;&nbsp;&nbsp;rekey=no\r\n&nbsp;&nbsp;&nbsp;&nbsp;ikelifetime=8h\r\n&nbsp;&nbsp;&nbsp;&nbsp;keylife=1h\r\n&nbsp;&nbsp;&nbsp;&nbsp;type=transport\r\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\r\n&nbsp;&nbsp;&nbsp;&nbsp;leftid=$esojourn.org\r\n&nbsp;&nbsp;&nbsp;&nbsp;leftprotoport=17\/1701\r\n&nbsp;&nbsp;&nbsp;&nbsp;right=%any\r\n<\/pre>\n<p>\u4fee\u6539ipsec\u5bc6\u94a5<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">vi&nbsp;&nbsp;\/etc\/ipsec.secrets\r\n\r\nwww.esojourn.org %any: PSK \"myps\"\r\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\u3002http:\/\/www.oray.com\/peanuthull\/\r\n#myps\u6539\u6210\u5bc6\u7801\r\n<\/pre>\n<p><span style=\"font-size: 18px;\">3. \u4fee\u6539\/etc\/sysctl.conf\uff0c\u5f00\u542f\u8def\u7531\u529f\u80fd<\/span><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">vi \/etc\/sysctl.conf<\/pre>\n<p><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<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">net.ipv4.ip_forward = 0\r\nnet.ipv4.conf.default.rp_filter = 1<\/pre>\n<p>\u6539\u4e3a\uff1a<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">net.ipv4.ip_forward = 1\r\nnet.ipv4.conf.default.rp_filter = 0<\/pre>\n<p>\u4e4b\u540e\u5148\u8ba9\u4fee\u6539\u540e\u7684\u914d\u7f6e\u751f\u6548\uff0c\u518d\u6d4b\u8bd5\u4e00\u4e0b\uff0c<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">sysctl -p\r\nservice ipsec start\r\nipsec verify<\/pre>\n<p>\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<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n#added for xl2tpd\r\nnet.ipv4.ip_forward = 1\r\nnet.ipv4.conf.default.rp_filter = 0\r\nnet.ipv4.conf.all.send_redirects = 0\r\nnet.ipv4.conf.default.send_redirects = 0\r\nnet.ipv4.conf.all.log_martians = 0\r\nnet.ipv4.conf.default.log_martians = 0\r\nnet.ipv4.conf.default.accept_source_route = 0\r\nnet.ipv4.conf.all.accept_redirects = 0\r\nnet.ipv4.conf.default.accept_redirects = 0\r\nnet.ipv4.icmp_ignore_bogus_error_responses = 1<\/pre>\n<p>\u5982\u679cipsec verify\u8fd4\u56de\u8fd9\u6837\uff0c\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nChecking your system to see if IPsec got installed and started correctly:\r\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]\r\nLinux Openswan U2.6.24\/K2.6.32.16-linode28 (netkey)\r\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]\r\nNETKEY detected, testing for disabled ICMP send_redirects&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#x5B;OK]\r\nNETKEY detected, testing for disabled ICMP accept_redirects&nbsp;&nbsp;&nbsp;&nbsp; &#x5B;OK]\r\nChecking for RSA private key (\/etc\/ipsec.secrets)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#x5B;OK]\r\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]\r\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]\r\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]\r\nTwo or more interfaces found, checking IP forwarding&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;OK]\r\nChecking NAT and MASQUERADEing\r\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]\r\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]\r\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<p>\u6211\u7684\u7ecf\u9a8c\u4e2d\uff0c\u8fd9\u91cc\u53ef\u80fd\u4f1a\u51fa\u8fd9\u4e48\u51e0\u4e2a\u6545\u969c\uff1a<br \/>\u7b2c\u4e00\uff1a<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">SAref kernel support                                           &#x5B;N\/A]<\/pre>\n<p>\u8fd9\u6837\u7684\u8bdd\uff0c \/etc\/xl2tpd\/xl2tpd.conf\u8fd9\u4e2a\u6587\u4ef6\u91cc<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&#x5B;global]\r\nipsec saref = no<\/pre>\n<p>\u7b2c\u4e8c\uff1a<\/p>\n<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]\r\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]\r\n<\/pre>\n<p>ip\u8f6c\u53d1\u68c0\u67e5\u5931\u8d25\u3002<\/p>\n<p><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<\/p>\n<p>\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<\/p>\n<p>[ 2012-7-6 ]<br \/>\u7b2c\u56db\uff1a\u66f4\u65b0\u52a0\u5165\u4e00\u4e2a\u65b0\u7684\u60c5\u51b5<\/p>\n<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]\r\n SAref 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]\r\n NETKEY:&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]\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;OK]\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5B;FAILED]\r\n\r\n&nbsp;&nbsp;Please enable \/proc\/sys\/net\/core\/xfrm_larval_drop\r\n&nbsp;&nbsp;or NETKEY will cause non-POSIX compliant long time-outs\r\n\r\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]\r\n<\/pre>\n<p>\u51fa\u8fd9\u6bdb\u75c5\uff0c\u7167\u7740\u8bf4\u660e\uff0c<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">echo 1 &gt; \/proc\/sys\/net\/core\/xfrm_larval_drop\r\nvi \/etc\/bashrc\r\n<\/pre>\n<p>\u7136\u540e\u628a\u201cecho 1 > \/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<\/p>\n<p><span style=\"font-size: 18px;\">4. \u7f16\u8f91 \/etc\/xl2tpd\/xl2tpd.conf<\/span><br \/>vi \/etc\/xl2tpd\/xl2tpd.conf<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n; This is a minimal sample xl2tpd configuration file for use\r\n; with L2TP over IPsec.\r\n;\r\n; The idea is to provide an L2TP daemon to which remote Windows L2TP\/IPsec\r\n; clients connect. In this example, the internal (protected) network\r\n; is 192.168.1.0\/24.&nbsp;&nbsp;A special IP range within this network is reserved\r\n; for the remote clients: 192.168.1.128\/25\r\n; (i.e. 192.168.1.128 ... 192.168.1.254)\r\n;\r\n; The listen-addr parameter can be used if you want to bind the L2TP daemon\r\n; to a specific IP address instead of to all interfaces. For instance,\r\n; you could bind it to the interface of the internal LAN (e.g. 192.168.1.98\r\n; in the example below). Yet another IP address (local ip, e.g. 192.168.1.99)\r\n; will be used by xl2tpd as its address on pppX interfaces.\r\n\r\n&#x5B;global]\r\nlisten-addr = esojourn.org&nbsp;&nbsp;\r\n;\u8fd9\u91cc\u5199\u5185\u7f51IP\u3002\u6216\u8005\u52a0;\u6ce8\u91ca\u6389\u4e5f\u95ee\u9898\u4e0d\u5927\u3002\r\n;\r\n; requires openswan-2.5.18 or higher - Also does not yet work in combination\r\n; with kernel mode l2tp as present in linux 2.6.23+\r\n; ipsec saref = yes\r\nipsec saref = no\r\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\r\n\r\n\r\n; Use refinfo of 22 if using an SAref kernel patch based on openswan 2.6.35 or\r\n;&nbsp;&nbsp;when using any of the SAref kernel patches for kernels up to 2.6.35.\r\n; ipsec refinfo = 30\r\n;\r\n; forceuserspace = yes\r\n;\r\n; debug tunnel = yes\r\n\r\n&#x5B;lns default]\r\nip range = 192.168.7.128-192.168.7.254\r\n;\u8fd9\u91cc\u5199vpn client\u7684ip\u6bb5\r\nlocal ip = 192.168.7.1\r\n\r\nrequire chap = yes\r\nrefuse pap = yes\r\nrequire authentication = yes\r\nname = LinuxVPNserver\r\nppp debug = yes\r\npppoptfile = \/etc\/ppp\/options.xl2tpd\r\nlength bit = yes\r\n<\/pre>\n<p><span style=\"font-size: 18px;\">5. \u4fee\u6539 \/etc\/ppp\/options.xl2tpd<\/span><\/p>\n<p>vi \/etc\/ppp\/options.xl2tpd<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">require-mschap-v2\r\nipcp-accept-local\r\nipcp-accept-remote\r\nms-dns&nbsp;&nbsp;8.8.4.4\r\nms-dns&nbsp;&nbsp;8.8.8.8\r\nnoccp\r\nauth\r\ncrtscts\r\nidle 1800\r\nmtu 1410\r\nmru 1410\r\nnodefaultroute\r\ndebug\r\nlock\r\nproxyarp\r\nconnect-delay 5000\r\n<\/pre>\n<p>vi \/etc\/ppp\/chap-secrets<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">#\u6587\u4ef6\u683c\u5f0f\r\n# user server password ip\r\nusername * userpass * #\u6539\u6210\u4f60\u7684\u7528\u6237\u540d \u5bc6\u7801<\/pre>\n<p><span style=\"font-size: 18px;\">6. \u6700\u5173\u952e\u7684iptables\u914d\u7f6e<\/span><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<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">iptables -t nat -A POSTROUTING -s 192.168.7.0\/24 -o eth0 -j MASQUERADE\r\niptables -I FORWARD -s 192.168.7.0\/24 -j ACCEPT\r\niptables -I FORWARD -d 192.168.7.0\/24 -j ACCEPT\r\niptables-save\r\nservice iptables restart<\/pre>\n<p>192.168.7.0\/24\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u66ff\u6362\u3002<\/p>\n<p>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<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n#\u4e0b\u9762\u89c4\u5219\u505a\u53c2\u8003\u554a\uff0c\u65b0\u624b\u522b\u5b8c\u5168\u7167\u6284\u3002\r\n*nat\r\n:PREROUTING ACCEPT &#x5B;39:3503]\r\n:POSTROUTING ACCEPT &#x5B;0:0]\r\n:OUTPUT ACCEPT &#x5B;0:0]\r\n-A POSTROUTING -s 192.168.7.0\/24 -o eth0 -j MASQUERADE\r\nCOMMIT\r\n# Completed on Thu Jun 28 15:50:40 2012\r\n# Generated by iptables-save v1.4.7 on Thu Jun 28 15:50:40 2012\r\n*filter\r\n:INPUT ACCEPT &#x5B;0:0]\r\n:FORWARD ACCEPT &#x5B;0:0]\r\n:OUTPUT ACCEPT &#x5B;121:13264]\r\n-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT\r\n-A INPUT -p icmp -j ACCEPT\r\n-A INPUT -i lo -j ACCEPT\r\n-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT\r\n-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT\r\n-A INPUT -p tcp -m state --state NEW -m tcp --dport 53 -j ACCEPT\r\n-A INPUT -p udp -m state --state NEW -m udp --dport 53 -j ACCEPT\r\n-A INPUT -p tcp -m state --state NEW -m tcp --dport 1194 -j ACCEPT\r\n-A INPUT -p udp -m state --state NEW -m udp --dport 1701 -j ACCEPT\r\n-A INPUT -p udp -m state --state NEW -m udp --dport 500 -j ACCEPT\r\n-A INPUT -p udp -m state --state NEW -m udp --dport 4500 -j ACCEPT\r\n\r\n-A INPUT -j REJECT --reject-with icmp-host-prohibited\r\n-A FORWARD -d 192.168.7.0\/24 -j ACCEPT\r\n-A FORWARD -s 192.168.7.0\/24 -j ACCEPT\r\n-A FORWARD -j REJECT --reject-with icmp-host-prohibited\r\nCOMMIT\r\n# Completed on Thu Jun 28 15:50:40 2012\r\n<\/pre>\n<p>\u6700\u540e<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">service xl2tpd restart\r\nservice iptables restart\r\nchkconfig xl2tpd on\r\nchkconfig iptables on\r\nchkconfig ipsec on<\/pre>\n","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:\/\/ybzx.vip\/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>\n","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:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/posts\/404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=404"}],"version-history":[{"count":0,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/posts\/404\/revisions"}],"wp:attachment":[{"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}