相关文章推荐
冷冷的小笼包  ·  Ubuntu 12.04 ...·  1 年前    · 
冷冷的小笼包  ·  Ubuntu 12.04安装Flash ...·  1 年前    · 
冷冷的小笼包  ·  Ubuntu Server ...·  1 年前    · 
冷冷的小笼包  ·  Ubuntu ...·  1 年前    · 
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":"Ubuntu 12.04 LTS","path":"Ubuntu 12.04 LTS","contentType":"directory"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"shadowsocksR搭建.md","path":"shadowsocksR搭建.md","contentType":"file"},{"name":"shadowsocks安装及优化.md","path":"shadowsocks安装及优化.md","contentType":"file"},{"name":"ubuntu 14.04 PPTP 和 L2TP 安装教程.md","path":"ubuntu 14.04 PPTP 和 L2TP 安装教程.md","contentType":"file"}],"totalCount":5}},"fileTreeProcessingTime":5.689216,"foldersToFetch":[],"reducedMotionEnabled":null,"repo":{"id":28848816,"defaultBranch":"master","name":"vpnConf","ownerLogin":"devk1d","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2015-01-06T05:45:32.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/1422507?v=4","public":true,"private":false,"isOrgOwned":false},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1613986727.307789","canEdit":false,"refType":"branch","currentOid":"3c0c5e72e5d589db25d5e5834e065d57b33eb492"},"path":"ubuntu 14.04 PPTP 和 L2TP 安装教程.md","currentUser":null,"blob":{"rawLines":null,"stylingDirectives":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/devk1d/vpnConf/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null,"repoAlertsPath":"/devk1d/vpnConf/security/dependabot","repoSecurityAndAnalysisPath":"/devk1d/vpnConf/settings/security_analysis","repoOwnerIsOrg":false,"currentUserCanAdminRepo":false},"displayName":"ubuntu 14.04 PPTP 和 L2TP 安装教程.md","displayUrl":"https://github.com/devk1d/vpnConf/blob/master/ubuntu%2014.04%20PPTP%20%E5%92%8C%20L2TP%20%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B.md?raw=true","headerInfo":{"blobSize":"3.15 KB","deleteInfo":{"deleteTooltip":"You must be signed in to make or propose changes"},"editInfo":{"editTooltip":"You must be signed in to make or propose changes"},"ghDesktopPath":"https://desktop.github.com","gitLfsPath":null,"onBranch":true,"shortPath":"6c768d2","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fdevk1d%2FvpnConf%2Fblob%2Fmaster%2Fubuntu%252014.04%2520PPTP%2520%25E5%2592%258C%2520L2TP%2520%25E5%25AE%2589%25E8%25A3%2585%25E6%2595%2599%25E7%25A8%258B.md","isCSV":false,"isRichtext":true,"toc":[{"level":2,"text":"用的是linode,基于Unbuntu 14.04LTS 64位,32位的没试过,装好系统后设置","anchor":"用的是linode基于unbuntu-1404lts-64位32位的没试过装好系统后设置","htmlText":"用的是linode,基于Unbuntu 14.04LTS 64位,32位的没试过,装好系统后设置"},{"level":2,"text":"PPTP:","anchor":"pptp","htmlText":"PPTP:"},{"level":2,"text":"L2TP:","anchor":"l2tp","htmlText":"L2TP:"}],"lineInfo":{"truncatedLoc":"203","truncatedSloc":"119"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplateHelpUrl":"https://docs.github.com/articles/about-issue-and-pull-request-templates","issueTemplate":null,"discussionTemplate":null,"language":"Markdown","languageID":222,"large":false,"loggedIn":false,"newDiscussionPath":"/devk1d/vpnConf/discussions/new","newIssuePath":"/devk1d/vpnConf/issues/new","planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/devk1d/vpnConf/blob/master/ubuntu%2014.04%20PPTP%20%E5%92%8C%20L2TP%20%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B.md","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","dismissStackNoticePath":"/settings/dismiss-notice/publish_stack_from_file","releasePath":"/devk1d/vpnConf/releases/new?marketplace=true","showPublishActionBanner":false,"showPublishStackBanner":false},"renderImageOrRaw":false,"richText":"

用的是linode,基于Unbuntu 14.04LTS 64位,32位的没试过,装好系统后设置

\n

PPTP:

\n

一键脚本,亲测有效: https://github.com/viljoviitanen/setup-simple-pptp-vpn

\n

安装pptpd

\n
apt-get update\napt-get install pptpd\n
\n

编辑pptpd-options

\n
vi /etc/ppp/pptpd-options\n
\n

底部添加

\n
nopcomp\nnoaccomp\n\nms-dns 8.8.8.8\nms-dns 8.8.4.4\n
\n

编辑pptd.conf

\n
vi /etc/pptpd.conf\n
\n

底部添加

\n
localip 192.168.17.1\nremoteip 192.168.17.2-200\n
\n

编辑options

\n
vi /etc/ppp/options\n
\n

底部添加

\n
ms-dns 8.8.8.8\nms-dns 8.8.4.4\n
\n

编辑

\n
vi /etc/ppp/chap-secrets\n
\n

添加用户

\n
test * test *\n
\n

编辑

\n
vi /etc/sysctl.conf\n
\n

底部添加

\n
net.ipv4.ip_forward=1\nnet.ipv4.conf.all.accept_redirects = 0\nnet.ipv4.conf.all.send_redirects = 0\nnet.ipv4.tcp_syncookies = 1\n
\n

执行

\n
sysctl -p\n
\n

编辑

\n
vi /etc/rc.local\n
\n

在exit 0前添加,$ip 替换为你的vps ip地址

\n
iptables -t nat -A POSTROUTING -j SNAT --to $ip\niptables -t nat -A POSTROUTING -s 192.168.17.0/24 -o eth0 -j MASQUERADE\nsysctl -p\n
\n

命令行执行,$ip 替换为你的vps ip地址

\n
iptables -t nat -A POSTROUTING -j SNAT --to $ip\niptables -t nat -A POSTROUTING -s 192.168.17.0/24 -o eth0 -j MASQUERADE\niptables-save\n
\n

执行

\n
service pptpd restart\n
\n

L2TP:

\n

安装相应软件

\n
apt-get install openswan xl2tpd ppp lsof\n
\n

安装openswan时可能会弹出问题让你确认,一直回车就是.

\n

编辑ipsec

\n
vi /etc/ipsec.conf\n
\n

注释掉oe=off

\n
#oe=off\n
\n

protostack设置为netkey

\n
protostack=netkey\n
\n

底部添加,$ip 替换为你的vps ip地址

\n
conn %default\n\tforceencaps=yes\n\nconn L2TP-PSK-NAT\n\trightsubnet=vhost:%no,%priv\n\talso=L2TP-PSK-noNAT\n\nconn L2TP-PSK-noNAT\n\tauthby=secret\n\tpfs=no\n\tauto=add\n\tkeyingtries=3\n\trekey=no\n\tikelifetime=8h\n\tkeylife=1h\n\ttype=transport\n\tleft=$ip\n\tleftprotoport=17/1701\n\tright=%any\n\trightprotoport=17/%any\n
\n

编辑ipsec.secrets

\n
\tvi /etc/ipsec.secrets\n
\n

写入, $ip 替换为你的vps ip地址,test替换为你想设的密钥

\n
$ip %any: PSK \"test\"\n
\n

编辑xl2tpd.conf

\n
vi /etc/xl2tpd/xl2tpd.conf\n
\n

写入

\n
[global]\n\t; listen-addr = 192.168.1.98\n\n[lns default]\n\tip range = 192.168.15.2-192.168.15.200\n\tlocal ip = 192.168.15.1\n\trequire chap = yes\n\trefuse pap = yes\n\trequire authentication = yes\n\tname = LinuxVPNserver\n\tppp debug = yes\n\tpppoptfile = /etc/ppp/options.xl2tpd\n\tlength bit = yes\n
\n

执行

\n
cp /usr/share/doc/xl2tpd/examples/ppp-options.xl2tpd \\\n\t/etc/ppp/options.xl2tpd\n
\n

编辑

\n
vi /etc/ppp/options.xl2tpd\n
\n

把ms-dns替换为

\n
ms-dns 8.8.8.8\nms-dns 8.8.4.4\n
\n

编辑rc.local

\n
vi /etc/rc.local\n
\n

在exit 0前添加

\n
for vpn in /proc/sys/net/ipv4/conf/*; do echo 0 > $vpn/accept_redirects; echo 0 > $vpn/send_redirects; done\n\tiptables -t nat -A POSTROUTING -s 192.168.15.0/24 -o eth0 -j MASQUERADE\n\tiptables --table nat --append POSTROUTING --jump MASQUERADE\n
\n

执行

\n
for vpn in /proc/sys/net/ipv4/conf/*; do echo 0 > $vpn/accept_redirects; echo 0 > $vpn/send_redirects; done\niptables -t nat -A POSTROUTING -s 192.168.15.0/24 -o eth0 -j MASQUERADE\niptables --table nat --append POSTROUTING --jump MASQUERADE\n\niptables-save\n
\n

执行

\n
ipsec verify\nservice xl2tpd restart\nservice ipsec restart\n
\n
","renderedFileInfo":null,"shortPath":null,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"repoOwner":"devk1d","repoName":"vpnConf","showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","showDependabotConfigurationBanner":false,"actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timedOut":false,"notAnalyzed":true,"symbols":[]}},"copilotInfo":null,"csrf_tokens":{"/devk1d/vpnConf/branches":{"post":"vUMIJRuu3qXb--9jP0HvQ1IfJXkEETUpkHg5xG9Wr0rl9DSNiyKlcY_hDOuvXZcy9l8yFKZP-zmfxDHQfZpSQg"},"/repos/preferences":{"post":"2e0KIlwlqALRbUk9VdUr434pG_zYTOrh2jqw8OGF_-dGC3pwbqTp8wNTv5O3-sH8Xem4HDmRM9BQab0VjUL2eA"}}},"title":"vpnConf/ubuntu 14.04 PPTP 和 L2TP 安装教程.md at master · devk1d/vpnConf"}