系统环境:本次系统采用 系统为基础。

[root@gjp~]# cat /etc/redhat-release

CentOS release 6.4 (Final)

所需工具:dkms-2.0.17.5-1.noarch.rpm

kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm

pptpd-1.3.4-2.rhel6.i386.rpm

ppp-2.4.5-17.0.rhel6.narch.rpm

首先先把以上工具下载到/home/download下:

#mkdir -p /home/download

#cd /home/download

#wget http://www.hi-vps.com/downloads/dkms-2.0.17.5-1.noarch.rpm

#wget http://wty.name/linux/sources/kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm

#http://poptop.sourceforge.net/yum/stable/rhel6/i386/ppp-2.4.5-33.0.rhel6.i686.rpm

#http://poptop.sourceforge.net/yum/stable/rhel6/i386/pptpd-1.4.0-1.el6.i686.rpm

继续安装库:

#yum -y install make libpcap iptables gcc-c++ logrotate tar 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 -Uvh ppp-2.4.5-33.0.rhel6.i686.rpm

#rpm -ivh pptpd-1.4.0-1.el6.i686.rpm

把里面的IP跟DNS改成你所使用的DNS。。。

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 222.85.85.85 >> /etc/ppp/options.pptpd
echo ms-dns 222.88.88.88 >> /etc/ppp/options.pptpd

防火墙配置:

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}’`

在此命令是用反掩号括起来的

[root@gjp ~]# ifconfig |grep 'inet addr' |grep -v '127.0.0.1' |cut -d: -f2 |awk 'NR==1 { print $1}'

10.0.3.251 (获取本机在使用的ip)


iptables -A FORWARD -p tcp –syn -s 172.16.36.0/24 -j TCPMSS –set-mss 1356

服务启动:

service iptables save

chkconfig iptables on
chkconfig pptpd on

service iptables start
service pptpd start

好的,到这里,×××就已经搭建完成了。。。

下面开始建立用户:

#vi /etc/ppp/chap-secrets

编辑内容为(IP中*号代表所有):

# Secrets for authentication using CHAP
# client server secret IP addresses
用户名 pptpd 密码 *

gjp * 12345 *

配置好以后,重启pptp服务

#service pptpd start

后续查看理解:

ppp0 Link encap:Point-to-Point Protocol

inet addr:172.16.36.1 P-t-P:172.16.36.2 Mask:255.255.255.255

UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1396 Metric:1

RX packets:1641 errors:0 dropped:0 overruns:0 frame:0

TX packets:1502 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:3

RX bytes:327280 (319.6 KiB) TX bytes:370597 (361.9 KiB)


Centos 6.4下搭建pptp!_第1张图片

Centos 6.4下搭建pptp!_第2张图片

Centos 6.4下搭建pptp!_第3张图片

Centos 6.4下搭建pptp!_第4张图片

参考来源:http://www.shangxueba.com/jingyan/121595.html