java android pptp,Centos7搭建PPTP

搭建清单:

Centos7 (我这里使用腾讯云的服务器)

ppp和pptpd 包

iptables (我这里使用iptables)

win10客户端(连接测试使用)

1、查看是否支持

[root@VM_centos ~]# modprobe ppp-compress-18 && echo yes

yes

[root@VM_centos ~]# cat /dev/ppp cat: /dev/ppp: 没有那个设备或地址

2、禁用firewalld防火墙和安装需要的包

#停止和禁用firewalld

[root@VM_centos ~]# systemctl stop firewalld

[root@VM_centos ~]# systemctl disable firewalld

#增加epel yum源

[root@VM_centos ~]# yum install epel-release -y

#安装需要的包

[root@VM_centos ~]# yum install ppp ppp-devel pptpd iptables iptables-services -y

3、修改配置文件pptpd.conf option.pptpd

[root@VM_centos ~]# vim /etc/pptpd.conf

#找到此处去掉前面注释 localip xxx.xxx.xxx.xxx

#内网ip地址(云服务器的eth0网卡地址,不是服务器公网地址) remoteip 192.168.0.10-20

#自定义分配给客户端的网段

[root@VM_centos ~]# vim /etc/ppp/options.pptpd

#修改成下面的参数

name pptpd

refuse-pap

refuse-chap

refuse-mschap

require-mschap-v2

require-mppe-128

ms-dns 8.8.8.8

ms-dns 114.114.114.114

proxyarp lock

nobsdcomp

novj

novjccomp

nologfd

logfile /var/log/pptpd.log

4、修改用户认证配置文件chap-secrets

[root@VM_centos ~]# vim /etc/ppp/chap-secrets

#添加用户格式:用户名 pptpd 密码 *

# Secrets for authentication using CHAP

# client    server    secret      IP addresses test    pptpd 123456 *

5、打开系统ipv4转发 sysctl.conf

[root@VM_centos ~]# vim /etc/sysctl.conf

#有此项的话修改数值为1 没有的新添加一条 net.ipv4.ip_forward=1

#应用生效

[root@VM_centos ~]# sysctl -p

6、启动pptpd服务

[root@VM_centos ~]# systemctl start pptpd

7、开放需要的端口(iptables和云服务器的安全组),此步操作完就可以先测试下是否可以连接了

iptables -A INPUT -i lo -j ACCEPT

iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT

iptables -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT

iptables -A INPUT -p tcp --dport 22 -j ACCEPT

iptables -A INPUT -p tcp --dport 80 -j ACCEPT

iptables -A INPUT -p tcp --dport 443 -j ACCEPT

iptables -A INPUT -p tcp --dport 1723 -j ACCEPT

iptables -A INPUT -p gre -j ACCEPT

#保存规则

[root@VM_centos ~]# service iptables save

#重启生效

[root@VM_centos ~]# systemctl restart iptables

8、增加转发规则,和修改mtu的大小,为了可以连上***后上网

#注意这里网段和上面配置文件网段一致,eth0和本机网卡名称一致(本机只有eth0和lo)

[root@VM_centos ~]# iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE

#保存规则

[root@VM_centos ~]# service iptables save

#重启生效 [root@VM_centos ~]# systemctl restart iptables

#修改MTU默认值1396为1500,在exit 0前面加一句

[root@VM_centos ~]# vim /etc/ppp/ip-up ....... ifconfig $1 mtu 1500 exit 0

#重启下pptpd服务

[root@VM_centos ~]# systemctl restart pptpd

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值