【pptp部署】
一、安装pptp
PPTPD下载地址:http://pan.baidu.com/s/1hs6Us1Q
yum -y install ppp
rpm -ivh pptpd-1.3.4-2.el6.x86_64.rpm
二、配置pptp
1)修改pptpd.conf文件,添加如下红色两行
[root@localhost opt]# egrep ‘localip|remoteip‘ /etc/pptpd.conf -n
61:# remoteip option. The default is 100.
64:# TAG: localip
65:# TAG: remoteip
96:localip 192.168.10.1 #服务器IP
97:remoteip 192.168.10.10-50,192.168.10.245 #客户端获取IP地址范围 ,最后面那一个IP是网关
#客户端获取IP地址范围
98:#localip 192.168.0.1
99:#remoteip 192.168.0.234-238,192.168.0.245
101:#localip 192.168.0.234-238,192.168.0.245
102:#remoteip 192.168.1.234-238,192.168.1.245
2)修改options.pptpd文件
[root@localhost opt]# grep ms-dns /etc/ppp/options.pptpd
#ms-dns 10.0.0.1
#ms-dns 10.0.0.2
ms-dns 8.8.8.8 #添加国外DNS服务器
ms-dns 4.4.4.4
3)添加账号
[root@localhost opt]# cat /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
wsyht pptpd wsyht *
注:一行添加一个账号,每个账号需要添加4个字段,分别为:
用户名 、服务器、密码、分配的IP地址
(如果IP为*,则表示随机分配,分配范围采用pptpd.conf的配置
4)开启IP转发
[root@localhost opt]# sed -i ‘s/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/‘ /etc/sysctl.conf
[root@localhost opt]# sysctl -p
5)配置Iptables转发
[root@10-8-16-14 ~]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.4.7 on Mon Mar 28 16:43:52 2016
*filter
:INPUT ACCEPT [30549:11647062]
:FORWARD ACCEPT [296:31794]
:OUTPUT ACCEPT [77461:34587071]
-A INPUT -i eth0 -p tcp -m tcp --dport 1723 -j ACCEPT
-A INPUT -i eth0 -p gre -j ACCEPT
-A FORWARD -i ppp+ -o eth0 -j ACCEPT
-A FORWARD -i eth0 -o ppp+ -j ACCEPT
COMMIT
# Completed on Mon Mar 28 16:43:52 2016
# Generated by iptables-save v1.4.7 on Mon Mar 28 16:43:52 2016
*nat
:PREROUTING ACCEPT [1380:137055]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [13:861]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Mon Mar 28 16:43:52 2016
[root@localhost opt]# service iptables restart
[root@localhost opt]# chkconfig iptables on
6)启动pptp服务
[root@localhost ~]# chkconfig pptpd on
[root@localhost log]# service pptpd start
本文出自 “wsyht的博客” 博客,请务必保留此出处http://wsyht2015.blog.51cto.com/9014030/1825506
原文地址:http://wsyht2015.blog.51cto.com/9014030/1825506