wget http://www.lucong.com.cn/file/pptp-debian.sh && sh pptp-debian.sh
sh pptp-debian.sh
坐等安装,完后会给出默认用户名和密码。
随后软件自动配置vpn,在最后会给出默认的vpn用户名和密码,若要管理vpn用户,直接编辑/etc/ppp/chap-secrets文件对号入座即可,一行一个。
重启pptp后方可生效,
/etc/init.d/pptpd restart
pptp-debian.sh内容如下:
#!/bin/bash
if [ $(id -u) != "0" ]; then
printf "Error: You must be root to run this tool!\n"
exit 1
fi
clear
vpsip=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk 'NR==1 { print $1}'`
apt-get update
apt-get --purge remove pptpd ppp
rm -rf /etc/pptpd.conf
rm -rf /etc/ppp
apt-get install -y ppp
apt-get install -y pptpd
apt-get install -y iptables logrotate tar cpio perl
rm -r /dev/ppp
mknod /dev/ppp c 108 0
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "mknod /dev/ppp c 108 0" >> /etc/rc.local
echo "echo 1 > /proc/sys/net/ipv4/ip_forward" >> /etc/rc.local
echo "localip 172.16.36.1" >> /etc/pptpd.conf
echo "remoteip 172.16.36.2-254" >> /etc/pptpd.conf
echo "ms-dns 8.8.8.8" >> /etc/ppp/options
echo "ms-dns 8.8.4.4" >> /etc/ppp/options
echo "vpn pptpd 1@2#3$4%5&6 *" >> /etc/ppp/chap-secrets
iptables -t nat -A POSTROUTING -s 172.16.36.0/24 -j SNAT --to-source `ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk 'NR==1 { print $1}'`
iptables -A FORWARD -p tcp --syn -s 172.16.36.0/24 -j TCPMSS --set-mss 1356
iptables -t nat -A POSTROUTING -s 172.16.36.0/24 -j SNAT --to-source "$vpsip"
iptables-save > /etc/iptables-rules
echo "pre-up iptables-restore < /etc/iptables-rules" >> /etc/network/interfaces
/etc/init.d/pptpd restart
printf "
ServerIP:$vpsip
username:vpn
password:1@2#3$4%5&6
"
Comments
Post a Comment