实验环境
centos6.8_x64
pptp_server eth0xx.xx.xx.xx(公网IP) eth1 192.168.10.11
pptp_client 192.168.10.12
实验软件
ppp.x86_64 0:2.4.5-10.el6
pptpd.x86_64 0:1.4.0-3.el6
软件安装
cp -pv /etc/sysctl.conf /etc/sysctl.conf.bak
cat >> /etc/sysctl.conf << EOF
> net.ipv4.tcp_syncookies = 1
> net.ipv4.tcp_tw_reuse = 1
> net.ipv4.tcp_tw_recycle = 1
> net.ipv4.tcp_fin_timeout = 10
> net.ipv4.ip_forward= 1
> EOF && sysctl -p
cp -pv /etc/security/limits.conf /etc/security/limits.conf.bak
cat >> /etc/security/limits.conf << EOF
> * soft nofile 10240
> * hard nofile 10240
> * soft nproc 10240
> * hard nproc 10240
> EOF && sysctl -p
cp -pv /etc/profile /etc/profile.bak
echo ulimit -n 10240 >> /etc/profile && source /etc/profile && ulimit -n
10240 修改系统默认线程数
modprobe ppp-compress-18 && echo ok
ok 查看是否支持 mppe
lsmod | grep ppp
ppp_mppe 17127 0
ppp_generic 33041 1 ppp_mppe
slhc 13450 1 ppp_generic
yum install -y libpcap kernel-devel ppp pptpd
cp -pv /etc/ppp/options.pptpd /etc/ppp/options.pptpd.bak
cat /etc/ppp/options.pptpd
ms-dns 8.8.8.8
ms-dns 8.8.4.4
debug
logfile /var/log/pptpd.log
cp -pv /etc/ppp/chap-secrets /etc/ppp/chap-secrets.bak
cat /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
test pptpd RffHzYygq* *
用户名 协议(pptpd) 拨号验证 客户端获得指定ip *为dhcp自动分配
cp -pv /etc/pptpd.conf /etc/pptpd.conf.bak
localip 192.168.10.1 pptpd服务端自己预留ip
remoteip 192.168.10.11-14 分配客户端ip
touch /etc/ppp/ip-up.local && chmod +x /etc/ppp/ip-up.local
cat /etc/ppp/ip-up.local
echo "---------------Login---------------------------------------" >> /var/log/pptpd.log
echo "time: `date -d today +%F_%T`" >> /var/log/pptpd.log
echo "clientIP: $6" >> /var/log/pptpd.log
echo "username: $PEERNAME" >> /var/log/pptpd.log
echo "device: $1" >> /var/log/pptpd.log
echo "***IP: $4" >> /var/log/pptpd.log
echo "assignIP: $5" >> /var/log/pptpd.log
echo "-----------------------------------------------------------" >> /var/log/pptpd.log
touch /etc/ppp/ip-down.local && chmod +x /etc/ppp/ip-down.local
cat /etc/ppp/ip-down.local
echo "---------------Logout--------------------------------------" >> /var/log/pptpd.log
echo "time: `date -d today +%F_%T`" >> /var/log/pptpd.log
echo "clientIP: $6" >> /var/log/pptpd.log
echo "username: $PEERNAME" >> /var/log/pptpd.log
echo "device: $1" >> /var/log/pptpd.log
echo "***IP: $4" >> /var/log/pptpd.log
echo "assignIP: $5" >> /var/log/pptpd.log
echo "-----------------------------------------------------------" >> /var/log/pptpd.log
service pptpd restart-kill && service pptpd start && chkconfig --level 35 pptpd on
netstat -tuplna | grep LISTEN
tcp 0 0 0.0.0.0:1723 0.0.0.0:* LISTEN 13139/pptpd
ip addr | grep ppp0
5: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1396 qdisc pfifo_fast state UNKNOWN qlen 3
inet 192.168.10.1 peer 192.168.10.11/32 scope global ppp0
输入pptpdserverip
输入配置用户名验证
拨号无法访网络解决办法:
网络-属性-更改适配器设置-***-属性-网络-tcp/ipv4-属性-高级-(不勾选)在远程网络上使用默认网关