Generally, you only need to add the last two lines, that is, allocate the server IP address and client IP address range. you can select an appropriate IP address.
Usage:
Wget http://jymoz.com/wp-content/uploads/2013/05/pptpd.sh
Sh pptpd. sh
Edit the configuration file vi/etc/pptpd. conf
The following content is required:
Option/etc/ppp/options.ppt pd
Logwtmp
Localip 172.16.36.1
Remoteip 172.16.36.2-254
Generally, you only need to add the last two lines, that is, allocate the server IP address and client IP address range. you can select an appropriate IP address.
Edit the configuration file vi/etc/ppp/options.ppt pd
The following content is required:
Name pptpd
Refuse-pap
Refuse-chap
Refuse-mschap
Require-mschap-v2
Require-mppe-128
Proxyarp
Lock
Nobsdcomp
Novj
Novjccomp
Nologfd
Ms-dns 8.8.8.8
Ms-dns 8.8.4.4
Generally, you only need to set the dns server address of the last two lines, that is, remove the # number and change the IP address to the dns IP address of the server for the client to use.
Edit the configuration file vi/etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# Client server secret IP addresses
(User) pptpd (passwd )*
The four items are respectively the client user name, vpn server name (usually not changed), login password, IP address allocation address (* automatic), separated by spaces or Tab keys
You can join multiple users and enter branches
Enable the ip forwarding function (otherwise, you can only connect to the vpn server and cannot access the external network through the vpn server), modify the configuration file
The contents in vi/etc/sysctl. conf are as follows:
Net. ipv4.ip _ forward = 1
Make the configuration take effect immediately:
/Sbin/sysctl-p
Enable log vi/etc/syslog. conf
Append a row:
Daemon. debug/var/log/pptpd. log
Restart syslog:
Kill-SIGHUP 'cat/var/run/syslogd. Pi'
Set automatic start of pptpd boot:
Chkconfig pptpd on
Start pptpd
Service pptpd start
Some common commands:
Centos:
Start the vpn server
Service pptpd start
Stop the vpn server, but the existing connection is not shadow
Service pptpd stop
Restart the vpn server and disconnect the connected client.
Service pptpd restart-kill
Service pptpd start
View the local dns server address
Cat/etc/resolv. conf
View information of all NICs
Ifconfig-