PPTP服务搭建
1.安装pptpd
[root@vm6]# yum install -y pptpd
rpm -ivh http://static.ucloud.cn/pptpd-1.3.4-2.el6.x86_64.rpm
2.对虚拟专用网络进行IP段分配
- [root@VM_0_6_centos etc]# vim /etc/pptpd.conf
- localip 193.112.40.37
- remoteip 172.16.1.120-200
3.指定DNS写入文件末尾即可
- [root@VM_0_6_centos etc]# vim /etc/ppp/options.pptpd
- ms-dns 8.8.8.8
- ms-dns 8.8.4.4
4.配置用户名和密码
- [root@VM_0_6_centos etc]# vim /etc/ppp/chap-secrets
- # Secrets for authentication using CHAP
- # client server secret IP addresses
- xingyulin pptpd 123456 *
5、开启IP转发
- [root@VM_0_6_centos etc]# vim /etc/sysctl.conf
- #将“net.ipv4.ip_forward = 0”改为“net.ipv4.ip_forward = 1”
- # Controls IP packet forwarding
- net.ipv4.ip_forward = 1
转发生效
[root@VM_0_6_centos etc]# sysctl -p
6.配置转发策略以及开放常用的端口
- [root@VM_0_6_centos ppp]# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
- [root@VM_0_6_centos ppp]# iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
- [root@VM_0_6_centos ppp]# iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
- [root@VM_0_6_centos ppp]# iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
- [root@VM_0_6_centos ppp]# iptables -A INPUT -p tcp -m tcp --dport 1723 -j ACCEPT
- iptables -I INPUT -p gre -j ACCEPT 【需要打开gre协议 ,否则拨号上不去】
- -A FORWARD -s 10.168.0.0/24 -j ACCEPT 开启内网转发[10.168.0.0/24]pptp下发网段地址
7、重启pptpd服务
- [root@VM_0_6_centos etc]# systemctl start pptpd.service
- #检查状态active (running)为成功
- [root@VM_0_6_centos etc]# systemctl status pptpd.service
- ● pptpd.service - PoPToP Point to Point Tunneling Server
- Loaded: loaded (/usr/lib/systemd/system/pptpd.service; enabled; vendor preset: disabled)
- Active: active (running) since 五 2019-01-04 11:15:53 CST; 4h 17min ago
- Main PID: 19053 (pptpd)
- CGroup: /system.slice/pptpd.service
- └─19053 /usr/sbin/pptpd -f
电脑测试