{"id":254,"date":"2010-12-26T03:56:23","date_gmt":"2010-12-26T01:56:23","guid":{"rendered":"http:\/\/yesybl.org\/blogcn\/?p=254"},"modified":"2010-12-26T03:56:23","modified_gmt":"2010-12-26T01:56:23","slug":"linux%e4%b8%8bvpnpptp%e5%ae%a2%e6%88%b7%e7%ab%af%e7%9a%84%e8%ae%be%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/www.yesybl.com\/?p=254","title":{"rendered":"Linux\u4e0bVPN(pptp)\u5ba2\u6237\u7aef\u7684\u8bbe\u7f6e"},"content":{"rendered":"<p>\u7531\u4e8e\u65b0\u6ce8\u518c\u4e00\u4e2aVPN\u8d26\u53f7\uff0c\u6240\u4ee5\u7279\u5730\u60f3\u8bd5\u7528\u4e00\u4e0b\uff0c\u5728Windows\u4e0b\u5f88\u7b80\u5355\uff0c\u53ea\u8981\u5728\u521b\u5efa\u8fde\u63a5\u4e2d\u6839\u636e\u63d0\u793a\uff0c\u586b\u5165\u4fe1\u606f\u4e00\u6b65\u4e00\u6b65\u4e0b\u6765\u5c31\u53ef\u4ee5\u81ea\u52a8\u8fde\u63a5\u5230VPN\u670d\u52a1\u5668\u4e0a\u3002\u4f46\u5728Linux\u4e0b\u76f8\u5bf9\u6bd4\u8f83\u9ebb\u70e6\uff0c\u82b1\u4e86\u51e0\u4e2a\u5c0f\u65f6\uff0c\u7ec8\u4e8e\u8bbe\u7f6e\u6210\u529f\u4e86\u3002<\/p>\n<p>\u9996\u5148\u4e0b\u8f7d\u5b89\u88c5\u6240\u9700\u7684PPTP\u7a0b\u5e8f\u5305\u3002<\/p>\n<pre lang=\"bash\">\nsudo apt-get install pptp-linux\n<\/pre>\n<p>\u7136\u540e\u521b\u5efa\u6216\u7f16\u8f91\u6587\u4ef6\/etc\/ppp\/options.pptp\uff0c\u5177\u4f53\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<pre lang=\"bash\">\n###############################################################################\n# $Id: options.pptp,v 1.1 2005\/02\/18 01:40:23 quozl Exp $\n#\n# Sample PPTP PPP options file \/etc\/ppp\/options.pptp\n# Options used by PPP when a connection is made by a PPTP client.\n# This file can be referred to by an \/etc\/ppp\/peers file for the tunnel.\n# Changes are effective on the next connection.  See \"man pppd\".\n#\n# You are expected to change this file to suit your system.  As\n# packaged, it requires PPP 2.4.2 or later from http:\/\/ppp.samba.org\/\n# and the kernel MPPE module available from the CVS repository also on\n# http:\/\/ppp.samba.org\/, which is packaged for DKMS as kernel_ppp_mppe.\n###############################################################################\n\n# Lock the port\nlock\n\n# Authentication\n# We don't need the tunnel server to authenticate itself\nnoauth\n\n# We won't do EAP, CHAP, or MSCHAP, but we will accept MSCHAP-V2\nrefuse-eap\nrefuse-chap\nrefuse-mschap\n\n# Compression\n# Turn off compression protocols we know won't be used\nnobsdcomp\nnodeflate\n\n# Encryption\n# (There have been multiple versions of PPP with encryption support,\n# choose with of the following sections you will use.  Note that MPPE\n# requires the use of MSCHAP-V2 during authentication)\n\n# http:\/\/ppp.samba.org\/ the PPP project version of PPP by Paul Mackarras\n# ppp-2.4.2 or later with MPPE only, kernel module ppp_mppe.o\n# {{{\n# Require MPPE 128-bit encryption\nrequire-mppe-128\n# }}}\n\n# http:\/\/polbox.com\/h\/hs001\/ fork from PPP project by Jan Dubiec\n# ppp-2.4.2 or later with MPPE and MPPC, kernel module ppp_mppe_mppc.o\n# {{{\n# Require MPPE 128-bit encryption\n#mppe required,stateless\n# }}}\n<\/pre>\n<p>\u63a5\u4e0b\u6765\u521b\u5efa\u6216\u7f16\u8f91\u7528\u6237\u540d\u53ca\u5bc6\u7801\u6587\u4ef6\/etc\/ppp\/chap-secrets\uff0c \u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<pre lang=\"bash\">\n# Secrets for authentication using CHAP\n# client\tserver\tsecret\t\t\tIP addresses\nusername \tPPTP\tpassword\t*\n<\/pre>\n<p>\u5b8c\u6210\u4e4b\u540e\uff0c\u9700\u8981\u521b\u5efa\u6587\u4ef6\/etc\/ppp\/peers\/$TUNNEL\uff0c\u6ce8\u610f\uff0c\u8fd9\u91cc\u7684$TUNNEL\u6307\u7684\u662f\u4f60\u5c06\u6765\u7528pon [\u53c2\u6570]\uff0c\u4e2d\u7684\u53c2\u6570\u540d\u3002\u6211\u4eec\u53ef\u4ee5\u628a\u5b83\u8bbe\u5b9a\u4e3avpn\uff0c \u6216\u4f60\u516c\u53f8\u7684\u540d\u5b57\u3002\u6587\u4ef6\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<pre lang=\"text\">\npty \"pptp $VPN_SERVER_URL --nolaunchpppd\" #VPN_SERVER_URL\u5e94\u8be5\u4e3a\u4f60\u7684VPN\u670d\u52a1\u5668\u5730\u5740\nname $USERNAME                                      #\u4f60\u7684VPN\u8d26\u53f7\nremotename PPTP\nrequire-mppe-128\nfile \/etc\/ppp\/options.pptp\nipparam $TUNNEL                                       #\u8fd9\u91cc\u662fvpn\uff0c\u6216\u4f60\u516c\u53f8\u7684\u540d\u5b57\n<\/pre>\n<p>\u5b8c\u6210\u4e4b\u540e\u5c31\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\uff1a<\/p>\n<pre lang=\"bash\">\npon $TUNNEL  #\u4f60\u81ea\u5df1\u8bbe\u5b9a\u7684\u540d\u79f0\n<\/pre>\n<p>\u6765\u542f\u52a8\u62e8\u53f7\u8fde\u63a5\u3002\u6709\u4e9b\u65f6\u5019\u53ef\u80fd\u4f1a\u6709\u95ee\u9898\uff0c\u5982\u679c\u6743\u9650\u4e0d\u591f\uff0c\u8bf7\u7528root\u6765\u542f\u52a8\u3002\u63d0\u4f9b\u4e86\u4e00\u79cd\u6392\u9519\u7684\u542f\u52a8\u65b9\u5f0f\uff0c\u53ef\u4ee5\u7528\u4e00\u4e0b\u547d\u4ee4\u542f\u52a8\u8fde\u63a5\uff0c\u67e5\u770b\u95ee\u9898\u539f\u56e0\uff1a<\/p>\n<pre lang=\"bash\">\npon $TUNNEL debug dump logfd 2 nodetach\n<\/pre>\n<p>\u8fde\u63a5\u6210\u529f\u4e86\uff0c\u53ef\u662f\u53d1\u73b0\u6211\u4e0a\u7f51\u7684\u6570\u636e\u5e76\u6ca1\u6709\u901a\u8fc7VPN\u670d\u52a1\u5668\uff0c\u80af\u5b9a\u662f\u8def\u7531\u8868\u7684\u95ee\u9898\u4e86\uff0c\u63a5\u4e0b\u6765\u9700\u8981\u8bbe\u5b9a\u5185\u6838\u8def\u7531\u8868\u3002<br \/>\n\u9996\u5148\u4fdd\u8bc1\u8fde\u63a5\u5230VPN\u670d\u52a1\u5668\u7684\u8def\u7531\u6b63\u5e38\uff0c\u6570\u636e\u5305\u5fc5\u987b\u4ece\u539f\u7f51\u7edc\u9002\u914d\u5668\u51fa\u53d1\uff0c\u8d70ISP\u7684\u7f51\u5173\u3002\u6bd4\u5982\u6211\u7528\u7684\u662f3G\u65e0\u7ebf\u4e0a\u7f51\uff0c\u6240\u4ee5\u6211\u9ed8\u8ba4\u7684\u7f51\u7edc\u63a5\u53e3\u4e3appp0, \u65b0\u7684VPN\u8fde\u63a5\u7684\u7f51\u7edc\u63a5\u53e3\u88ab\u5206\u914d\u4e3appp1. \u901a\u8fc7route\u547d\u4ee4\u6dfb\u52a0\u4e00\u6761\u8def\u7531\uff1a<\/p>\n<pre lang=\"bash\">\nsudo route add -host vpn.server.com dev ppp0\n<\/pre>\n<p>\u8fd9\u6837\u5c31\u4fdd\u8bc1\u4e86\u4ece\u672c\u673a\u5230VPN\u670d\u52a1\u5668\u94fe\u8def\u7684\u6b63\u5e38\uff0c\u6ca1\u6709\u8fd9\u6761\u8def\u7531\uff0c\u4f1a\u5bfc\u81f4\u6570\u636e\u5305\u5728PPP1\u7f51\u7edc\u63a5\u53e3\u4e0a\u7684\u6b7b\u5faa\u73af\u3002<br \/>\n\u7136\u540e\u5220\u9664\u5c31\u7684default\u8def\u7531\u4fe1\u606f\u548c\u52a0\u5165\u65b0\u7684default\u8def\u7531\uff1a<\/p>\n<pre lang=\"bash\">\nsudo route del default dev ppp0\nsudo route add default dev ppp1\n<\/pre>\n<p>\u597d\u4e86\uff0c\u8fd9\u6837\u5c31\u5b8c\u6210\u4e86\u8def\u7531\u7684\u8f6c\u6362\uff0c\u4ee5\u540e\u6240\u6709\u4e0a\u7f51\u7684\u6570\u636e\u5305\u90fd\u56de\u901a\u8fc7VPN\u670d\u52a1\u5668\u4e86\u3002\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u5374\u53d1\u73b0\u4ec0\u4e48\u7f51\u4e5f\u4e0a\u4e0d\u4e86\uff0c\u7528Ping\u8fdb\u884c\u6d4b\u8bd5\uff0c\u63d0\u793aUnknow server, \u5475\u5475\uff0c\u80af\u5b9a\u662fDNS\u53c8\u8fde\u63a5\u4e0d\u4e0a\u4e86\uff0c\u4e00\u5b9a\u662fISP\u9650\u5b9a\u4e86\u53ea\u6709\u4ece\u5185\u7f51\u51fa\u53d1\u7684\u673a\u5668\u624d\u80fd\u8bbf\u95ee\u8be5DNS\u670d\u52a1\u5668\u3002\u4e8e\u662f\u7528<\/p>\n<pre lang=\"bash\">\nmore \/etc\/resov.conf\n<\/pre>\n<p>\u67e5\u51faDNS\u670d\u52a1\u5668\u5730\u5740\u4e3a<\/p>\n<pre lang=\"text\">\nnameserver 79.170.225.139\nnameserver 79.170.224.1\n<\/pre>\n<p>\u5e76\u7528route\u67e5\u51faISP\u5185\u7f51\u4e2d\u6211\u7684\u7f51\u5173\u5730\u5740\u4e3a10.87.249.85\u3002route\u547d\u4ee4\u6267\u884c\u540e\u7684\u663e\u793a\u4e3a\uff1a<\/p>\n<pre lang=\"text\">\nKernel IP routing table\nDestination     Gateway         Genmask         Flags Metric Ref    Use Iface\n10.64.64.64     *               255.255.255.255 UH    0      0        0 ppp0\n10.89.234.1     *               255.255.255.255 UH    0      0        0 ppp1\n10.87.249.85    *               255.255.255.255 UH    0      0        0 ppp0\ndefault         *               0.0.0.0         U     0      0        0 ppp1\n<\/pre>\n<p>\u4ece\u4ee5\u4e0a\u7684\u8def\u7531\u8868\u4e5f\u53ef\u4ee5\u770b\u51fa\uff0cVPN\u670d\u52a1\u5668\u7684\u5185\u7f51\u7f51\u5173\u5730\u5740\u4e3a10.89.234.1\u3002\u63a5\u4e0b\u6765\u6dfb\u52a0\u5230\u8fbeDNS\u670d\u52a1\u5668\u7684\u8def\u7531\uff1a<\/p>\n<pre lang=\"bash\">\nsudo route add -host 79.170.225.139 gw 10.87.249.85\nsudo route add -host 79.170.224.1 gw 10.87.249.85\n<\/pre>\n<p>\u518d\u6b21\u7528Ping\u6d4b\u8bd5\uff0c\u4e00\u5207\u6b63\u5e38\u4e86\uff0c\u6d4f\u89c8\u5668\u4e5f\u80fd\u987a\u5229\u7684\u6253\u5f00\u7f51\u9875\uff0c\u8fdb\u5165IP\u67e5\u8be2\u7f51\u7ad9\u548c\u6c34\u6728\uff0c\u5747\u663e\u793aIP\u4e0d\u662f\u6211\u7684\u771f\u5b9eIP\uff0c\u5ba3\u544a\u914d\u7f6e\u6210\u529f\u3002<br \/>\n\u53c2\u8003\u6587\u732e:<br \/>\nhttp:\/\/pptpclient.sourceforge.net\/howto-debian.phtml#install<\/p>\n","protected":false},"excerpt":{"rendered":"<a href=\"https:\/\/www.yesybl.com\/?p=254\" rel=\"bookmark\" title=\"Permalink to Linux\u4e0bVPN(pptp)\u5ba2\u6237\u7aef\u7684\u8bbe\u7f6e\"><p>\u7531\u4e8e\u65b0\u6ce8\u518c\u4e00\u4e2aVPN\u8d26\u53f7\uff0c\u6240\u4ee5\u7279\u5730\u60f3\u8bd5\u7528\u4e00\u4e0b\uff0c\u5728Windows\u4e0b\u5f88\u7b80\u5355\uff0c\u53ea\u8981\u5728\u521b\u5efa\u8fde\u63a5\u4e2d\u6839\u636e\u63d0\u793a\uff0c\u586b\u5165\u4fe1\u606f\u4e00\u6b65\u4e00\u6b65\u4e0b\u6765\u5c31\u53ef\u4ee5\u81ea\u52a8\u8fde\u63a5\u5230VPN\u670d\u52a1\u5668\u4e0a\u3002\u4f46\u5728Linux\u4e0b\u76f8\u5bf9\u6bd4\u8f83\u9ebb\u70e6\uff0c\u82b1\u4e86\u51e0\u4e2a\u5c0f\u65f6\uff0c\u7ec8\u4e8e\u8bbe\u7f6e\u6210\u529f\u4e86\u3002 \u9996\u5148\u4e0b\u8f7d\u5b89\u88c5\u6240\u9700\u7684PPTP\u7a0b\u5e8f\u5305\u3002 sudo apt-get install pptp-linux \u7136\u540e\u521b\u5efa\u6216\u7f16\u8f91\u6587\u4ef6\/etc\/ppp\/options.pptp\uff0c\u5177\u4f53\u5185\u5bb9\u5982\u4e0b\uff1a ############################################################################### # $Id: options.pptp,v 1.1 2005\/02\/18 01:40:23 quozl Exp $ # # Sample PPTP PPP options file \/etc\/ppp\/options.pptp # Options used by PPP when a connection is made by a PPTP client. # This file can be referred to by an \/etc\/ppp\/peers file for the tunnel. # Changes [&hellip;]<\/p>\n<\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pa4z28-46","_links":{"self":[{"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/posts\/254"}],"collection":[{"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=254"}],"version-history":[{"count":0,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/posts\/254\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yesybl.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}