千家信息网

Centos6配置PPTP连接VPS服务器

发表于:2025-02-03 作者:千家信息网编辑
千家信息网最后更新 2025年02月03日,简述:PPTP:点对点隧道协议(PPTP: Point to Point Tunneling Protocol)通过该协议,远程用户能够通过 Microsoft Windows NT 工作站、Wind
千家信息网最后更新 2025年02月03日Centos6配置PPTP连接VPS服务器

简述:

PPTP:点对点隧道协议

(PPTP: Point to Point Tunneling Protocol)

通过该协议,远程用户能够通过 Microsoft Windows NT 工作站、Windows 95 和 Windows

98 操作系统以及其它装有点对点协议的系统安全访问公司网络,并能拨号连入本地 ISP,通过 Internet 安全链接到公司网络。

一、安装前准备

首先检查你 VPS 的 PPP 和 TUN 有没有启用:

[root@yunwei_cq ~]# cat /dev/pppcat: /dev/ppp: No such device or address[root@yunwei_cq ~]#[root@yunwei_cq ~]#[root@yunwei_cq ~]# cat /dev/net/tuncat: /dev/net/tun: File descriptor in bad state

显示结果为:

cat: /dev/ppp: No such device or addresscat: /dev/net/tun: File descriptor in bad state

表明通过,上述两条只要有一个没通过都不行。如果没有启用,你可以给 VPS 提供商 Submit

一个 Ticket 请求开通:

Hello

Could you enabled TUN-TAP for me? I want run pptpon my VPS.

Thank you.

确认 PPP 和 TUN 启用后,开始安装 ppp 和 iptables

二、安装 ppp 和 iptables

1.安装前检查是否已安装(本机已安装 iptables)

[root@yunwei_cq ~]# rpm -qa | grep ppp[root@yunwei_cq ~]# rpm -qa | grep iptablesiptables-1.4.7-11.el6.x86_64iptables-ipv6-1.4.7-11.el6.x86_64

2.安装 ppp 协议

[root@yunwei_cq yum.repos.d]# yum install -y ppp     Loaded plugins: fastestmirror, securityRepository base is listed more than once in the configuration Loading mirror speeds from cached hostfileSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package ppp.x86_64 0:2.4.5-10.el6 will be installed --> Finished Dependency Resolution ...
三、安装 pptpd 程序

1.如果提示没有 pptpd 安装包,需要自己下载安装。

[root@yunwei_cq yum.repos.d]# yum install -y pptpd     Loaded plugins: fastestmirror, securityRepository base is listed more than once in the configuration Loading mirror speeds from cached hostfile Setting up Install ProcessNo package pptpd available.

附 rpm 安装包安装地址: https://down.51cto.com/data/2368471

2.安装 pptpd 服务

[root@yunwei_cq packages]# rpm -ivh pptpd-1.3.4-2.el6.x86_64.rpmwarning: pptpd-1.3.4-2.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 862acc42:NOKEYPreparing...1:pptpd########################################### [100%]########################################### [100%]

四、修改配置文件

1.vim /etc/pptpd.conf

option /etc/ppp/options.pptpd   ##配置文件路径logwtmp ##日志localip xxxxxxxxx   ## 填写远程服务器的外网地址remoteip 192.168.101.1-50   ## 给一个分配给连接的客户机的 IP 地址范围。

2、vim /etc/ppp/options.pptpd

name pptpd  ##设置名称refuse-paprefuse-chaprefuse-mschaprequire-mschap-v2require-mppe-128proxyarplocknobsdcompnovjnovjccompnologfdms-dns 114.114.114.114  ##修改 DNS 地址ms-dns 8.8.8.8  ##备用地址

3、vim /etc/ppp/chap-secrets

# Secrets for authentication using CHAP# client server secret IP addresses ## client 客户端(用户名)server(服务器主机名) secret 加密密码(密码) ip ## addresses (远程主机设置固定 ip 地址)"hongkun"   *   "test"  *

上面第二行代码的四项内容分别对应第一行中的四项。"test@gd.cn"是 Client 端的连接的用户名;"server"对应的是 VPS 服务器的名字,该名字必须和/etc/ppp/options.pptpd 文件中指明的一样,或者设置成""号来表示自动识别服务器;"secret"对应的是登录密码;"IP addresses"对应的是可以拨入的客户端 IP 地址,如果不需要做特别限制,可以将其设置为""号。

4、vim /etc/sysctl.conf ##开启 IP 转发

#   Kernel sysctl configuration file for Red Hat Linux#   For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and#   sysctl.conf(5) for more details.#   Controls IP packet forwardingnet.ipv4.ip_forward = 1 ## 将这个值改为 1 其他的不动#   Controls source route verification net.ipv4.conf.default.rp_filter = 0#   Do not accept source routing net.ipv4.conf.default.accept_source_route = 0#   Controls the System Request debugging functionality of the kernel kernel.sysrq = 0

5、sysctl -p (强制刷新)

net.ipv4.ip_forward = 1net.ipv4.conf.default.rp_filter = 0net.ipv4.conf.default.accept_source_route = 0kernel.sysrq = 0kernel.core_uses_pid = 1net.ipv4.tcp_syncookies = 1net.bridge.bridge-nf-call-ip6tables = 0net.bridge.bridge-nf-call-iptables = 0net.bridge.bridge-nf-call-arptables = 0kernel.msgmnb = 65536kernel.msgmax = 65536kernel.shmmax = 68719476736kernel.shmall = 4294967296

五、iptables

需要开启 1723 端口

iptables -A INPUT -p tcp -m tcp --dport 1723 -j ACCEPT  (开启 1723 端口)/etc/init.d/iptables save   ##保存防火墙配置/etc/init.d/iptables resart ##重启防火墙chkconfig iptables --level 345 on (开机自动启动)chkconfig pptpd --level 345 on/etc/init.d/pptpd start (启动 pptpd)Starting pptpd:      [确定]

六、测试

Win10 系统设置 *PN 的方法:

1、要在 Win10 上设置 PN,请单击左下角的"开始"按钮,然后选择"设置"选项。 然后单击"网络和 Internet",然后单击"PN"。下一步是单击"添加 *PN 连接",之后是时候添加所有必需的信息。

2、首先单击"PN 提供商"下拉列表,然后选择唯一可用的选项 - Windows(内置)。 在"连接名称"字段中,键入您希望连接到 PN 时可以识别的选项名称。

3、现在是时候添加一个"服务器名称或地址",选择"*PN 类型"下的"自动"选项,然后选择"登录信息类型"选项之一。在大多数情况下,这将是默认值 - "用户名和密码"。

4、下一步是将您的输入信息添加到"用户名"和"密码"字段,然后单击"保存"按钮完成该过程。

注:如果连接* PN 后本机不能连接上网,点击如下设置:

地址 服务 服务器 密码 用户 名称 用户名 选择 配置 信息 客户 文件 系统 网络 安全 主机 公司 名字 字段 客户端 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 电气工程软件开发招聘 配置tomcat服务器 学校组织网络安全培训 富民软件开发价格实惠 安徽存储服务器机箱上哪找云主机 如何按名字自动匹配数据库 上海索卫网络技术有限公司 tp钱包软件开发 解释滴滴被网络安全审查 实名信息数据库 全面实行 软件开发尾款 软件开发单招考试报几类 数据库基础试卷多项选择题 滨海软件开发有限公司 工程管理前沿属于哪个数据库 学了软件开发好难 网络安全知识格言 服务器设置管理地址是什么 学校网络安全自查报告博客 北京超频服务器代理价格 青岛软件开发驻场服务费 服务器与浏览器交换安全性 万方医学网可以查全万方数据库吗 计算机网络技术工作经验怎么写 西农移动软件开发实习 软件开发测试员岗位职责 盛聚网络技术 奥迪斯电梯服务器操作使用说明 网络安全产品公司排行 云服务器ecs是什么做什么用
0