{"id":88,"date":"2014-07-24T22:16:49","date_gmt":"2014-07-24T14:16:49","guid":{"rendered":"http:\/\/www.codeeel.com\/?p=88"},"modified":"2014-07-24T22:17:13","modified_gmt":"2014-07-24T14:17:13","slug":"%e5%9c%a8freebsd%e4%b8%8a%e7%94%a8mpd5%e6%9e%84%e5%bb%ba-pptp-vpn-server","status":"publish","type":"post","link":"https:\/\/www.codeeel.com\/?p=88","title":{"rendered":"\u5728FreeBSD\u4e0a\u7528mpd5\u6784\u5efa PPTP VPN Server"},"content":{"rendered":"<p>1\u3001\u66f4\u65b0ports<\/p>\n<p>#portsnap fetch update<\/p>\n<p>2\u3001\u5b89\u88c5MPD5<\/p>\n<p>#cd \/usr\/ports\/net\/mpd5<\/p>\n<p>#make install clean<\/p>\n<p>3\u3001\u914d\u7f6e<\/p>\n<p>#cp \/usr\/local\/etc\/mpd5\/mpd.conf.sample mpd.conf<\/p>\n<p>#ee \/usr\/local\/etc\/mpd5\/mpd.conf<\/p>\n<pre class=\"lang:default decode:true\">startup:\r\n        # configure mpd users\r\n        set user shuqi888 loveosc ### \u8bbe\u7f6e mpd \u7684\u8bbf\u95ee\u5e10\u53f7\u53ca\u5bc6\u7801\uff0c\u901a\u8fc7 telnet \u6216 web \u8bbf\u95ee\u65f6\u9700\u8981\u6b64\u5e10\u53f7,\u6b64\u4f8b\u4e2d\u7ba1\u7406\u5458\u540dshuqi888\uff0c\u5bc6\u7801loveosc\r\n        #set user foo1 bar1\r\n        # configure the console\r\n        set console self 127.0.0.1 5005\r\n        set console open\r\n        # configure the web server\r\n        set web self 0.0.0.0 5006\r\n        set web open<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true\"># Default configuration is \"dialup\"\r\n\r\ndefault:\r\n        #load dialup   \u6ce8\u91ca\u6389dialup\r\n        load pptp_server ### \u66f4\u6539\u9ed8\u8ba4\u8c03\u7528 pptp_server \u6a21\u5757<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true\">#\r\n# Mpd as a PPTP server compatible with Microsoft Dial-Up Networking clients.\r\n#\r\n# Suppose you have a private Office LAN numbered 192.168.1.0\/24 and the\r\n# machine running mpd is at 192.168.1.1, and also has an externally visible\r\n# IP address of 1.2.3.4.\r\n#\r\n# We want to allow a client to connect to 1.2.3.4 from out on the Internet\r\n# via PPTP.  We will assign that client the address 192.168.1.50 and proxy-ARP\r\n# for that address, so the virtual PPP link will be numbered 192.168.1.1 local\r\n# and 192.168.1.50 remote.  From the client machine's perspective, it will\r\n# appear as if it is actually on the 192.168.1.0\/24 network, even though in\r\n# reality it is somewhere far away out on the Internet.\r\n#\r\n# Our DNS server is at 192.168.1.3 and our NBNS (WINS server) is at 192.168.1.4.\r\n# If you don't have an NBNS server, leave that line out.\r\n#\r\n\r\n# Define dynamic IP address pool.\r\n        set ippool add pool1 192.168.1.50 192.168.1.99 ##\u8fd9\u91cc\u53ef\u4ee5\u8bbe\u5b9a\u62e8\u5165\u540e\u7684\u79c1\u6709IP\r\n\r\n# Create clonable bundle template named B\r\n        create bundle template B\r\n        set iface enable proxy-arp\r\n        set iface idle 1800\r\n        set iface enable tcpmssfix\r\n        set ipcp yes vjcomp\r\n# Specify IP address pool for dynamic assigment.\r\n        set ipcp ranges 192.168.1.1\/32 ippool pool1\r\n        set ipcp dns 8.8.8.8  ### \u8bbe\u7f6e dns\uff0c\u6211\u559c\u6b22\u8c37\u6b4c\u7684\r\n        #set ipcp nbns 192.168.1.4 ###\u5982\u679c\u4f60\u7528\u4e0d\u5230 wins \u7684\u8bdd\uff0c\u53ef\u4ee5\u6ce8\u91ca\u6389\u8fd9\u5757\uff0c\r\n# The five lines below enable Microsoft Point-to-Point encryption\r\n# (MPPE) using the ng_mppc(8) netgraph node type.\r\n        set bundle enable compression\r\n        set ccp yes mppc\r\n        set mppc yes e40\r\n        set mppc yes e128\r\n        set mppc yes stateless\r\n# Create clonable link template named L\r\n        create link template L pptp\r\n# Set bundle template to use\r\n        set link action bundle B\r\n# Multilink adds some overhead, but gives full 1500 MTU.\r\n        set link enable multilink\r\n        set link yes acfcomp protocomp\r\n        set link no pap chap eap\r\n        set link enable chap\r\n\r\n# We can use use RADIUS authentication\/accounting by including\r\n# another config section with label 'radius'.\r\n#       load radius\r\n        set link keep-alive 10 60\r\n# We reducing link mtu to avoid GRE packet fragmentation.\r\n        set link mtu 1460\r\n# Configure PPTP\r\n        set pptp self 192.168.1.201 ###\u8bbe\u7f6e pptp \u7684\u76d1\u542c ip \u5730\u5740\uff0c\u4e5f\u5c31\u662f\u4f60\u7684\u7f51\u5361\u7684 \u771f\u5b9eIP \u5730\u5740\uff0c\u8fd9\u91cc\u4e00\u5b9a\u8981\u6ce8\u610f\uff0c\u5982\u679c\u662f\u901a\u8fc7\u8def\u7531\u5668\u7aef\u53e3\u6620\u5c04\u51fa\u53bb\u7684\u4e3b\u673a\uff0c\u8fd9\u91cc\u4e0d\u80fd\u586b\u8def\u7531\u5668\u5730\u5740\uff0c\u800c\u5e94\u8be5\u662f\u7f51\u5361\u4e0a\u914d\u7f6e\u7684\u771f\u5b9eIP\u5730\u5740\u3002\r\n# Allow to accept calls\r\n        set link enable incoming<\/pre>\n<p>\u542f\u52a8mpd5<\/p>\n<p>#\/usr\/local\/etc\/rc.d\/mpd5 start<\/p>\n<p>\u6dfb\u52a0VPN\u5e10\u53f7<\/p>\n<p>#ee \/usr\/local\/etc\/mpd5\/mpd.secret<\/p>\n<p>\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u4e00\u884c\u4e00\u4e2a\uff0c\u5982<\/p>\n<p>vpnuser1 \u00a0 \u00a0password001<\/p>\n<p>\u542f\u7528\u5305\u8f6c\u53d1\uff08\u4e0d\u505a\u8fd9\u4e00\u6b65\uff0c\u867d\u7136\u53ef\u4ee5\u8fde\u4e0aVPN\uff0c\u4f46\u53ea\u80fd\u8bbf\u95ee\u5185\u7f51\uff0c\u65e0\u6cd5\u8bbf\u95ee\u5916\u7f51\uff09<\/p>\n<p>#sysctl net.inet.ip.forwarding=1<\/p>\n<p>\u81f3\u6b64\u5b89\u88c5\u914d\u7f6e\u5b8c\u6210\uff0c\u53ef\u4ee5\u5728Windows\u4e2d\u65b0\u5efa\u4e00\u4e2aVPN\u8fde\u63a5\u4e86\u3002<\/p>\n<p>\u901a\u8fc7web\u8bbf\u95ee\u53ef\u4ee5\u770b\u5230\u5f53\u524d\u62e8\u5165\u8fde\u63a5\u7684\u72b6\u6001<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/www.codeeel.com\/wp-content\/uploads\/2014\/07\/144934_9JRo_93131.jpg\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-97\" title=\"144934_9JRo_93131\" src=\"http:\/\/www.codeeel.com\/wp-content\/uploads\/2014\/07\/144934_9JRo_93131-300x90.jpg\" alt=\"\" width=\"300\" height=\"90\" srcset=\"https:\/\/www.codeeel.com\/wp-content\/uploads\/2014\/07\/144934_9JRo_93131-300x90.jpg 300w, https:\/\/www.codeeel.com\/wp-content\/uploads\/2014\/07\/144934_9JRo_93131.jpg 906w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u66f4\u65b0ports #portsnap fetch update 2\u3001\u5b89\u88c5MPD5 #cd \/usr\/ports\/net\/mpd5 #make install clean 3\u3001\u914d\u7f6e #cp \/usr\/local\/etc\/mpd5\/mpd.conf.sample mpd.conf #ee \/usr\/local\/etc\/m<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[62,61],"_links":{"self":[{"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/posts\/88"}],"collection":[{"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=88"}],"version-history":[{"count":3,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/posts\/88\/revisions"}],"predecessor-version":[{"id":100,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/posts\/88\/revisions\/100"}],"wp:attachment":[{"href":"https:\/\/www.codeeel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}