{"id":3776,"date":"2024-02-21T10:45:01","date_gmt":"2024-02-21T02:45:01","guid":{"rendered":"https:\/\/dasmz.com\/?p=3776"},"modified":"2024-03-06T00:03:51","modified_gmt":"2024-03-05T16:03:51","slug":"debian-12%e7%b3%bb%e7%bb%9f%e7%8e%af%e5%a2%83%e4%b8%8a%ef%bc%8c%e9%83%a8%e7%bd%b2pptp%e6%9c%8d%e5%8a%a1-2024-02-21","status":"publish","type":"post","link":"https:\/\/dasmz.com\/?p=3776","title":{"rendered":"Debian 11\/12\u7cfb\u7edf\u73af\u5883\u4e0a\uff0c\u90e8\u7f72PPTP\u670d\u52a1 2024-02-21"},"content":{"rendered":"\n<p><strong>\u524d\u7f00\u3001\u6587\u6863\u4fee\u6539\u8bb0\u5f55<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">20240221 \u521d\u59cb\u5316\u7f16\u8f91\u6b64\u6587\u7ae0\uff0c\u5b8c\u7a3f<\/pre>\n\n\n\n<p><strong>\u7ae0\u82821\u3001\u9700\u6c42\u63cf\u8ff0<\/strong><\/p>\n\n\n\n<p>PPTP\uff08Point-to-Point Tunneling Protocol\uff09\u4f5c\u4e3a\u6700\u7b80\u5355\u7684\u7ec4\u7f51\u6280\u672f\uff0c\u867d\u7136\uff0c\u5b89\u5168\u6027\u4e0d\u600e\u4e48\u6837\uff0c\u4f46\u662f\u7528\u6765\u8f7b\u91cf\u5316\u7ec4\u7f51\u65f6\u5019\uff0c\u8fd8\u662f\u633a\u597d\u7528\u7684\uff0c\u672c\u7bc7\u535a\u5ba2\uff0c\u4ecb\u7ecd\u4e00\u4e0b\uff0c\u5728Debian 11\/12\u7cfb\u7edf\u4e0a\uff0c\u90e8\u7f72PPTP\u670d\u52a1\u7aef\u7684\u8fc7\u7a0b\u3002<\/p>\n\n\n\n<p><strong>\u7ae0\u82822\u3001\u90e8\u7f72PPTP\u670d\u52a1\u7aef<\/strong><\/p>\n\n\n\n<p><strong>2.1 apt\u6e90\u66f4\u65b0<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@debian:~# apt update<\/pre>\n\n\n\n<p><strong>2.2 \u5b89\u88c5PPTP\u8f6f\u4ef6<\/strong><\/p>\n\n\n\n<p>\u5148\u786e\u4fdd\u4f60\u7684\u670d\u52a1\u5668\u652f\u6301PPP<\/p>\n\n\n\n<p>To verify PPP is working, run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/dev\/ppp<\/code><\/pre>\n\n\n\n<p>\u5e94\u8be5\u8fd4\u56de\u5982\u4e0b\u7684\u4fe1\u606f:<\/p>\n\n\n\n<p><code>cat: \/dev\/ppp: No such device or address<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@debian:~# apt install pptpd \nroot@debian:~# apt install iptables\nroot@debian:~# apt install ethtool\n\nroot@debian:~# uname -a\nLinux debian 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64 GNU\/Linux\nroot@debian:~# apt list | grep header | grep linux\n...\nlinux-headers-5.10.0-28-amd64\/oldstable\n...\nroot@debian:~# apt install linux-headers-5.10.0-28-amd64<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img decoding=\"async\" loading=\"lazy\" width=\"644\" height=\"218\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-21-10-47-39.png\" alt=\"\" class=\"wp-image-3779\" srcset=\"https:\/\/dasmz.com\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-21-10-47-39.png 644w, https:\/\/dasmz.com\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-21-10-47-39-624x211.png 624w\" sizes=\"(max-width: 644px) 100vw, 644px\" \/><\/figure>\n\n\n\n<p><strong>2.3 \u914d\u7f6e\u6587\u4ef6\u4fee\u6539 \/etc\/pptpd.conf&nbsp;<\/strong><\/p>\n\n\n\n<p>\/etc\/pptpd.conf&nbsp; \u4e2d\uff0c\u9700\u8981\u6839\u636e\u4f60\u4eec\u7f51\u7edc\u7684\u60c5\u51b5\uff0c\u4fee\u6539\u6307\u5b9a\u4e00\u4e0b\u670d\u52a1\u5668\u7aef\u7684\u79c1\u7f51IP\u5730\u5740\uff0c\u5206\u53d1\u7684\u79c1\u7f51\u5730\u5740\u6bb5\uff0c\u4e0d\u8981\u8ddf\u73b0\u7f51\u7684\u5730\u5740\u51b2\u7a81\u5373\u53ef\u3002<\/p>\n\n\n\n<p>\u589e\u52a0\/\u4fee\u6539\u5982\u4e0b\u7684\u79c1\u7f51\u5730\u5740\uff08\u8bf7\u52ff\u5b8c\u5168\u7167\u6284\uff0c\u5177\u4f53\u8bf7\u6839\u636e\u4f60\u4eec\u81ea\u8eab\u73af\u5883\u5b9e\u9645\u7684\u6765\uff09<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#debug    # \u53ef\u9009\uff0c\u6392\u9519\u65f6\u5019\u5f00\u542f\nconnections 200   # \u5ba2\u6237\u7aef\u7684\u6570\u91cf\nlocalip 192.168.13.254\nremoteip 192.168.13.1-200<\/pre>\n\n\n\n<p><strong>2.4 \u4fee\u6539\u8ba4\u8bc1\u7684\u914d\u7f6e\u6587\u4ef6 \/etc\/ppp\/chap-secrets<\/strong><\/p>\n\n\n\n<p>\/etc\/ppp\/chap-secrets \u4e2d\uff0c\u6307\u5b9a\u7684\u662f\u7528\u6237\u540d\uff0c\u670d\u52a1\u540d\u79f0\uff0c\u5bc6\u7801\uff0c\u8be5\u7528\u6237\u7684\u5165\u7ad9IP\u7b49\u4fe1\u606f<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">useraaa  pptpd  passB7bFCf  *\nuserbbb  pptpd  passaE00cf  *<\/pre>\n\n\n\n<p>\u5176\u4e2d *\u8868\u793a\uff0c\u5141\u8bb8\u4efb\u4f55\u6765\u6e90IP\uff0c\u767b\u5f55\u8be5\u8d26\u53f7\u3002<\/p>\n\n\n\n<p><strong>2.5 \u4fee\u6539\u6307\u5b9a\u670d\u52a1\u7aef\u7684DNS\u670d\u52a1\u5668IP  \/etc\/ppp\/pptpd-options<\/strong><\/p>\n\n\n\n<p>\/etc\/ppp\/pptpd-options \u4e2d\uff0c\u53ef\u4ee5\u6307\u5b9a\u670d\u52a1\u7aef\u53ef\u81ea\u5b9a\u4e49DNS\u670d\u52a1\u5668<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#debug    # \u53ef\u9009\uff0c\u6392\u9519\u65f6\u5019\u5f00\u542f\nms-dns 119.29.29.29\nms-dns 114.114.114.114\nms-dns 8.8.8.8\nms-dns 1.1.1.1<\/pre>\n\n\n\n<p>2.6 \u4fee\u6539\u5185\u6838\u6a21\u5757\u7684\u52a0\u8f7d <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@debian:# cat \/etc\/modules-load.d\/pptpd.conf \nnf_nat_pptp\nnf_conntrack_pptp\nnf_conntrack_proto_gre   # \u8fd9\u4e2a\u672a\u627e\u5230\uff0c\u5947\u602a\n\n<\/pre>\n\n\n\n<p><strong>2.6 \u4fee\u6539\u7cfb\u7edf\u7684IPv4\u8f6c\u53d1\u53c2\u6570<\/strong><\/p>\n\n\n\n<p>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6 \/etc\/sysctl.conf&nbsp;\uff0c\u589e\u52a0\u4e00\u884c<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">net.ipv4.ip_forward = 1<\/pre>\n\n\n\n<p>\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff0c\u4f7f\u5176\u751f\u6548<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sysctl -p<\/pre>\n\n\n\n<p><strong>2.7 \u521b\u5efa\u9632\u706b\u5899iptables\u7684\u8f6c\u53d1\u89c4\u5219<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># \u5165\u7ad9\u653e\u884c\u7aef\u53e3 47(GRE) \/ 1723(PPTPD)\niptables -A INPUT -p gre -j ACCEPT\niptables -A INPUT -p tcp --dport 1723 -j ACCEPT\niptables -A INPUT -p tcp --dport 47 -j ACCEPT\n\n# \u5176\u4e2dens3\u540d\u79f0\uff0c\u6839\u636e\u4f60\u7f51\u5361\u5b9e\u9645\u7684\u540d\u79f0\u6765\u5199\uff0c\u5e38\u89c1\u7684\u540d\u79f0\u4e3aens3,ens3,ens5,enp0s3\niptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE \n\n# \u8f6c\u53d1\u7b56\u7565\u653e\u884c\uff0c\u53ef\u9009\n# \u5141\u8bb8\u8bbe\u7f6e\u7684VPN\u7f51\u6bb5\u7684\u5165\u7ad9\u8f6c\u53d1\niptables -A FORWARD -s 192.168.13.0\/24 -j ACCEPT   \n# \u5141\u8bb8\u8bbe\u7f6e\u7684VPN\u7f51\u6bb5\u7684\u51fa\u7ad9\u8f6c\u53d1             \niptables -A FORWARD -d 192.168.13.0\/24 -j ACCEPT                \n\n# \u53ef\u9009\niptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE\niptables -I INPUT -s 192.168.13.0\/24 -i ppp0 -j ACCEPT\niptables --append FORWARD --in-interface ens3 -j ACCEPT\n\n# \u4fdd\u5b58\u89c4\u5219\niptables-save<\/pre>\n\n\n\n<p>\u4e3a\u4e86\u5b89\u5168\u6027\uff0c\u53ef\u9009\u7684\u662f\uff0c\u589e\u52a0\u5bf91723\/47\u7aef\u53e3\u7684\u9650\u6e90\u8bbf\u95ee\u3002<\/p>\n\n\n\n<p><strong>2.8 \u542f\u52a8\u670d\u52a1<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># \u91cd\u542f\u670d\u52a1\nsystemctl restart pptpd \n\n# \u5f00\u542f\u670d\u52a1\nsystemctl start pptpd \n\n# \u5173\u95ed\u670d\u52a1\nsystemctl stop pptpd \n\n# \u5f00\u673a\u542f\u52a8\nsystemctl enable pptpd\n<\/pre>\n\n\n\n<p>\u5728\u817e\u8baf\u4e91\u670d\u52a1\u5668\uff0c\u672c\u7bc7\u6587\u6863\u6d4b\u8bd5\u901a\u8fc7\uff0c\u5c40\u57df\u7f51\u6d4b\u8bd5\u901a\u8fc7\uff0c\u6d4b\u8bd5\u672a\u901a\u8fc7\uff0c\u4f30\u8ba1\u5176\u4e91\u6c60\u7684\u5927\u7f51\u4fa7\u6709\u9632\u706b\u5899\u7c7b\u7684\u8bbe\u5907\uff0c\u5bf9GRE\u6709\u9650\u5236\u3002<\/p>\n\n\n\n<p><strong>\u7ae0\u82823\u3001\u7279\u522b\u8bf4\u660e<\/strong><\/p>\n\n\n\n<p>PPTP\/L2TP\u57fa\u672c\u5df2\u7ecf\u8fc7\u65f6\uff0c\u662f\u56e0\u4e3a\u5176\u4e3b\u8981\u7684\u5bc6\u7801\u7b97\u6cd5\u5df2\u7ecf\u88ab\u7834\u89e3\uff0cPPTP\u7684MS-CHAP-v1\u3001MS-CHAP-v2\u3001 MPPE\u52c9\u5f3a\u7528EAP-TLS \u6491\u4e2a\u573a\u9762\uff0c<br>\u5df2\u7ecf\u660e\u786e\u7834\u89e3\u7684\u7b97\u6cd5\uff0cMD5\u30013DES\u3001RC4\/RC5\u3001SHA1(Google\u7834\u89e3)\u3002<\/p>\n\n\n\n<p>\u4e3a\u4e86\u6570\u636e\u5b89\u5168\u7684\u9700\u6c42\uff0c\u4f60\u5df2\u7ecf\u4e0d\u5e94\u8be5\u9009\u62e9PPTP\/L2TP\u8fd9\u6837\u7684\u534f\u8bae\u4e86\u3002<\/p>\n\n\n\n<p><strong>\u9644\u5f551\u3001\u89c6\u9891\u64cd\u4f5c\u6f14\u793a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"000144  Debian 12\u7cfb\u7edf\u73af\u5883\u4e0a\uff0c\u90e8\u7f72PPTP\u670d\u52a1\uff0c\u53e4\u8001\u7684\u7ec4\u7f51\u534f\u8bae 2024-03-05\" width=\"625\" height=\"352\" src=\"https:\/\/www.youtube.com\/embed\/oWbkS3AZZWI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><strong>\u9644\u5f552\u3001@Dasmz<\/strong><\/p>\n\n\n\n<p>\u535a\u5ba2\u5185\uff0c\u6240\u6709\u6559\u7a0b\u4e3a\u624b\u6253\u539f\u521b\u6559\u7a0b\uff0c\u5982\u679c\u6280\u672f\u6559\u7a0b\u5bf9\u60a8\u6709\u6240\u5e2e\u52a9\uff0c\u6b22\u8fce\u6253\u8d4f\u4f5c\u8005\u3002\u6280\u672f\u5c42\u9762\uff0c\u95fb\u9053\u6709\u5148\u540e\uff0c\u5982\u6709\u758f\u6f0f\u3001\u9519\u8bef\uff0c\u6b22\u8fce\u6307\u6b63\u3002\u6280\u672f\u535a\u5ba2\u7684\u5185\u5bb9\uff0c\u4e00\u822c\u5177\u6709\u4e00\u5b9a\u7684\u73af\u5883\u4f9d\u8d56\uff0c\u5177\u6709\u4e00\u5b9a\u7684\u5e74\u4ee3\u4f9d\u8d56\uff0c\u914c\u60c5\u53c2\u8003\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u8bf7\u52ff\u5b8c\u5168\u7167\u642c\u7167\u6284\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u535a\u5ba2\u5185\u5df2\u63d0\u53ca\u7684\u4e13\u4e1a\u77e5\u8bc6\uff0c\u5982\u679c\u9700\u8981\u6280\u672f\u6307\u5bfc\uff0c\u6b22\u8fce\u8054\u7cfb\u6211\uff0c\u4ec5\u9700\u652f\u4ed8\u5de5\u65f6\u8d39<\/p>\n\n\n\n<p>Twitter: <a href=\"https:\/\/twitter.com\/fdmove\">Dasmz<\/a><\/p>\n\n\n\n<p>Youtube: <a href=\"https:\/\/www.youtube.com\/@DasmzStudio\" data-type=\"URL\" data-id=\"https:\/\/www.youtube.com\/@DasmzStudio\">@DasmzStudio<\/a><\/p>\n\n\n\n<p>Telegram: <a href=\"https:\/\/t.me\/fdmove\" data-type=\"URL\" data-id=\"https:\/\/t.me\/fdmove\">@Dasmz<\/a><\/p>\n\n\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"574\" height=\"446\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2020\/12\/DONATE.jpg\" alt=\"Donate\" class=\"wp-image-18\"\/><figcaption class=\"wp-element-caption\">\u4e91\u4e5e\u8ba8<\/figcaption><\/figure><\/div>","protected":false},"excerpt":{"rendered":"<p>\u524d\u7f00\u3001\u6587\u6863\u4fee\u6539\u8bb0\u5f55 20240221 \u521d\u59cb\u5316\u7f16\u8f91\u6b64\u6587\u7ae0\uff0c\u5b8c\u7a3f \u7ae0\u82821\u3001\u9700\u6c42\u63cf\u8ff0 PPTP\uff08Point-to-P [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[130,128],"_links":{"self":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/3776"}],"collection":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3776"}],"version-history":[{"count":28,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/3776\/revisions"}],"predecessor-version":[{"id":3829,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/3776\/revisions\/3829"}],"wp:attachment":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}