1.安装pptp
安装四个组建
yum install ppp -y
yum install dkms -y
yum install -y ppp-devel
rpm -ivh pptpd-1.4.0-1.el6.x86_64.rpm
支持数据包转发
vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
设置局域网ip段
vim /etc/pptpd.conf
localip 192.168.2.1
remoteip 192.168.2.234-238,192.168.2.245
设置dns服务地址
vim /etc/ppp/options.pptpd
ms-dns 8.8.8.8
ms-dns 8.8.4.4
添加登录帐号
vim /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
name pptpd password *
生效
sysctl -p
至此pptp服务安装完成,客服的可以连接,但还无法利用vpn上网,还要在防火墙中配置数据转发规则
2.配置路由
firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -i eth0 -p tcp --dport 1723 -j ACCEPT
firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -p gre -j ACCEPT
firewall-cmd --permanent --direct --add-rule ipv4 filter POSTROUTING 0 -t nat -o eth0 -j MASQUERADE
firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i ppp+ -o eth0 -j ACCEPT
firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i eth0 -o ppp+ -j ACCEPT
firewall-cmd --reload