PPTP connection server VPS configuration Centos6

Brief:

PPTP: Point to Point Tunneling Protocol

(PPTP: Point to Point Tunneling Protocol)

Through this agreement, users can remotely via Microsoft Windows NT Workstation, Windows 95, and Windows

98 operating systems and other secure access to the corporate network with a point to point protocol, and can dial into a local ISP, the Internet security company linked to the network.

I. Before You Begin

First, check your VPS of PPP and TUN have not enabled:

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

Showing results:

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

Show by the two as long as one did not pass will not work. If not enabled, you can give VPS provider Submit

Request to open a Ticket:

Hello

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

Thank you.

After confirming the PPP and TUN enabled, start the installation ppp and iptables

Second, install ppp and iptables

1. checked before installation is installed (the machine is installed iptables)

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

2. Install the ppp protocol

[root@yunwei_cq yum.repos.d]# yum install -y ppp 
    Loaded plugins: fastestmirror, security
Repository base is listed more than once in the configuration Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ppp.x86_64 0:2.4.5-10.el6 will be installed --> Finished Dependency Resolution ...

Third, the installation program pptpd

1. If there is no prompt pptpd installation package, so you need to download and install.

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

Rpm installation package is attached Address: https://down.51cto.com/data/2368471

2. Install pptpd Service

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

Fourth, modify the configuration file

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-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd
ms-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"  *

The above four elements of the second line of the first row respectively correspond to four. "[email protected]" is the user name of the Client side of the connector; "Server" is the name corresponding to VPS server, the name must be specified in the same and /etc/ppp/options.pptpd file, or set to " " No. automatic recognition server is represented; "Secret" corresponds to a login password; "IP addresses" corresponds to the client may dial an IP address, if the need to do particularly limited, and may be set to " " number.

4, vim /etc/sysctl.conf ## open IP forwarding

#   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 forwarding
net.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 (force a refresh)

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

Five, iptables

Need to open port 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:      [确定]

Six test

Win10 System Settings * PN method:

1, to be provided on Win10 PN, please "start" button, click the lower left corner, then select "Settings" option. Then click "Network and Internet", then click " PN." The next step is to click the "Add * PN connection", then it's time to add all the necessary information.

2, first click the " PN provider" drop-down list and select the only available option - Windows (built-in). In the "Connection Name" field, type you want to connect to the option name can be identified when the PN.

3, now is add a "server name or address" when one of "automatic" option under "* PN type" and then select "login type" option. In most cases, this will be the default value - "a user name and password."

4, the next step is to add your information to enter the "User Name" and "Password" field, then click the "Save" button to complete the process.

NOTE: If the machine is not connected to the Internet connection * PN, click the following settings:

PPTP connection server VPS configuration Centos6

Guess you like

Origin blog.51cto.com/13689359/2438970