1.删除之前已安装的相关软件:
1
2
3
|
yum remove -y pptpd ppp
rm -rf /etc/pptpd.conf
rm -rf /etc/ppp
|
删除iptables规则:
1
|
iptables --flush POSTROUTING --table nat
|
2.下载相关软件:
1
2
3
4
|
wget http://www.vpsyou.com/sources/dkms-2.0.17.5-1.noarch.rpm
wget http://www.vpsyou.com/sources/kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm
wget http://www.vpsyou.com/sources/pptpd-1.3.4-1.rhel5.1.i386.rpm
wget http://www.vpsyou.com/sources/ppp-2.4.4-9.0.rhel5.i386.rpm
|
3.安装相关软件
1
2
3
4
5
6
|
yum -y install make libpcap iptables gcc-c++ logrotate tar vim-minimal cpio perl pam tcp_wrappers
rpm -ivh dkms-2.0.17.5-1.noarch.rpm
rpm -ivh kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm
rpm -qa kernel_ppp_mppe
rpm -Uvh ppp-2.4.4-9.0.rhel5.i386.rpm
rpm -ivh pptpd-1.3.4-1.rhel5.1.i386.rpm
|
4.相关配置:
a.ppp配置:
设置vps启动时加载此项,编辑/etc/rc.local,加入:
修改配置文件/etc/ppp/options.pptpd,加入:
1
2
|
ms-dns 8.8.8.8
ms-dns 8.8.4.4
|
b.配置文件/etc/sysctl.conf,修改
1
|
net.ipv4.ip_forward = 0
|
为:
1
|
net.ipv4.ip_forward = 1
|
然后执行:
c.配置文件/etc/pptpd.conf,加入:
1
2
|
localip 192.168.9.1
remoteip 192.168.9.11-30
|
d.修改配置文件/etc/ppp/chap-secrets,加入:
1
2
3
|
# Secrets for authentication using CHAP
# client server secret IP addresses
myusername pptpd mypassword *
|
PS:myusername为vpn用户名,mypassword为密码
5.启动iptables.加入规则,启动pptpd
1
2
3
4
5
6
7
8
|
iptables -t nat -A POSTROUTING -s 192.168.9.0/255.255.255.0 -j SNAT --to-source `ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk 'NR==1 { print $1}'`
service iptables save
chkconfig iptables on
chkconfig pptpd on
service iptables start
service pptpd start
|
安装一键包地址:pptpd.sh
(责任编辑:IT) |