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

电脑测试

posted @ 2020-11-26 17:21  局域网外  阅读(1113)  评论(0编辑  收藏  举报