PPTP VPN 以成本低、設定簡單、客戶端原生支援廣(Windows/macOS/Linux/手機)著稱,適合中小企業遠端存取需求。本文提供 CentOS 專用一鍵安裝腳本、用戶管理、OpenVZ 虛擬化環境常見問題排查與免加密連線設定。
wget https://d.xker.com/2014/pptpd.sh
# 備用連結:wget https://www.zrblog.net/sh/pptpd.sh
sh pptpd.sh
全自動無需互動,安裝完成會顯示預設帳號密碼(請截圖保存)。


編輯 /etc/ppp/chap-secrets,格式:
# 用戶名 服務 密碼 IP
user1 pptpd password1 *
user2 pptpd password2 *
修改後無需重啟服務即時生效。
OpenVZ 容器需宿主機開啟 TUN/TAP 與 PPP 模組:
# 檢查 TUN/TAP
cat /dev/net/tun
# 正常回應:File descriptor in bad state
# 檢查 PPP
cat /dev/ppp
# 正常回應:No such device or address
若回應 No such file or directory,請聯繫 VPS 供應商開啟對應模組。
編輯 /etc/ppp/options.pptpd,註解強制加密:
# require-mppe-128
客戶端 VPN 內容設為「選擇性加密」並允許未加密密碼(PAP/CHAP)。
/etc/init.d/pptpd restart
/etc/ppp 找不到關閉 yum fastestmirror 外掛:
sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
總結:一鍵腳本讓 CentOS 幾分鐘內架設 PPTP VPN,配合 OpenVZ 模組檢查與免加密設定,可解決 90% 連線問題。生產環境請評估更安全的 VPN 協定。