我已經使用以下腳本在我的 Linode 中成功安裝了 PPTP VPN:
https://github.com/liaohuqiu/centos-setup/blob/master/install/install_vpn.sh
yum install -y ppp
wget http://centos-files.liaohuqiu.net/f/pptpd-1.3.4-2.el6.x86_64.rpm
rpm -ihv pptpd-1.3.4-2.el6.x86_64.rpm
rm -rf *.rpm
rm -rf /etc/pptpd.conf
rm -rf /etc/ppp
mkdir -p /etc/ppp
echo "option /etc/ppp/options.pptpd" >> /etc/pptpd.conf
echo "localip 10.0.0.1" >> /etc/pptpd.conf
echo "remoteip 10.0.0.10-100" >> /etc/pptpd.conf
echo "ms-dns 8.8.8.8" >> /etc/ppp/options.pptpd
echo "ms-dns 8.8.4.4" >> /etc/ppp/options.pptpd
pass=`openssl rand 6 -base64`
if [ "$1" != "" ]
then pass=$1
fi
echo "vpn pptpd ${pass} *" >> /etc/ppp/chap-secrets
function config_iptables()
{
# Reset/Flush iptables
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
# Flush end
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A INPUT -i eth0 -p tcp --dport 1723 -j ACCEPT
iptables -A INPUT -i eth0 -p gre -j ACCEPT
# Allow localhost traffic
iptables -A INPUT -i lo -m state --state NEW -j ACCEPT
iptables -A OUTPUT -o lo -m state --state NEW -j ACCEPT
# Allow server and internal network to go anyway
iptables -A INPUT -s 10.0.0.0/24 -m state --state NEW -j ACCEPT
iptables -A OUTPUT -m state --state NEW -j ACCEPT
# Allow ssh
iptables -A INPUT -p tcp --dport ssh -j ACCEPT
service iptables save
service iptables restart
}
chkconfig pptpd on
service pptpd start
config_iptables
ip=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
echo "===================================="
echo " VPN INSTALLATION COMPLETE"
echo "===================================="
echo " "
echo "VPN hostname/ip: ${ip}"
echo "VPN type: PPTP"
echo "VPN username: vpn"
echo "VPN password: ${pass}"
echo " "
它運作得很好。但這些天我發現有很多連接斷開,導致我的伺服器流量不足。
看來我可以使用任何帳戶和密碼連接到伺服器。
這是我的設定檔:
[root@mylinode ppp]# ll
total 24
-rw------- 1 root root 16 Jun 20 01:53 chap-secrets
-rw------- 1 root root 349 Oct 23 2013 eaptls-client
-rw------- 1 root root 405 Oct 23 2013 eaptls-server
-rw-r--r-- 1 root root 5 Nov 16 2009 options
-rw-r--r-- 1 root root 86 Jun 20 01:37 options.pptpd
-rw------- 1 root root 77 Nov 16 2009 pap-secrets
還有chap-secets
[root@mylinode ppp]# cat chap-secrets
vpn pptpd 111 *
日誌來自/var/log/message
:
Jun 20 02:03:53 mylinode pptpd[23994]: CTRL: Client 221.218.36.184 control connection started
Jun 20 02:03:53 mylinode pptpd[23994]: CTRL: Starting call (launching pppd, opening GRE)
Jun 20 02:03:53 mylinode pppd[23995]: pppd 2.4.5 started by huqiu, uid 0
Jun 20 02:03:53 mylinode pppd[23995]: Using interface ppp0
Jun 20 02:03:53 mylinode pppd[23995]: Connect: ppp0 <--> /dev/pts/3
Jun 20 02:03:56 mylinode pppd[23995]: peer from calling number 221.218.36.184 authorized
Jun 20 02:03:57 mylinode pppd[23995]: local IP address 10.0.0.1
Jun 20 02:03:57 mylinode pppd[23995]: remote IP address 10.0.0.10
我嘗試重裝多次,問題依舊。
任何幫助都會很棒,如果需要,我可以提供更多資訊。先感謝您。
答案1
看來你的密碼很弱並且被破解了,那個人把你的ip和你的通行證發佈在某個地方,使你的VPN伺服器成為公共伺服器,請重命名你的用戶和通行證。
答案2
您可以檢查以下內容/etc/ppp/chap 秘密。可以連接到 VPN 伺服器的使用者名稱和密碼儲存在那裡。文件的內容應如下所示:
$ cat /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
username1 pptpd password1 *
username2 pptpd password2 *
答案3
謝謝@賈勒特
我將此添加到/etc/ppp/options.pptpd
:
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
然後我應該使用帳戶和密碼/etc/ppp/chap-secrets
登入。
原因
我忘了提及其中的內容/etc/ppp/options.pptpd
,它們是:
name pptpd
ms-dns 8.8.8.8
ms-dns 8.8.4.4
然後我使用加密等級連接到伺服器:None
。