Install pptp vpn Server on CentOS
1. Verify ppp
Run the cat command to check whether ppp is enabled. Generally, servers are enabled except for special VPS hosts.
[root@localhost1 /]# cat /dev/ppp
cat: /dev/ppp: No such device or address
If the above result is displayed in cat, it indicates that ppp is enabled and pptp can be configured properly.
2. Install PPP
[root@localhost1 /]# yum -y install ppp iptables
Generally, iptables is installed after the system is installed by default. iptables is installed for NAT so that the PPTP client can access the Internet through the PPTP server.
3. Install PPTP
[root@localhost1 ~]# rpm -ivh pptpd-1.3.4-2.el6.x86_64.rpm
The above is for 64-bit systems. This package cannot be used for yum installation. You need to download an rpm package that supports 32-bit or 64-bit systems from the Internet. <Br>
4. Configure pptp
[root@localhost1 /]# vi /etc/pptpd.conf
Add the following two lines at the bottom. The localip is the IP address of the pptp server, and the remoteip is the IP address range obtained by the client.
Localip 192.168.100.100
Remoteip 192.168.100.101-110
Modify the options.ppt pd File
[root@localhost1 /]#vi/etc/ppp/options.pptpd
Open the following field and modify it to the dns server you want to allocate to the VPN user.
Ms-dns 8.8.8.8
Ms-dns 8.8.4.4
Add the vpn account and password[root@localhost1 /]#vi /etc/ppp/chap-secrets
Add an account in one row. Each account needs to add four fields: User Name, service, password, and assigned IP address (if the IP address is *, it indicates random allocation, the allocation range is pptp. conf)
# clientserversecret IP addresses
hmj pptpd hmj123 *
5. Enable ip Forwarding
[root@localhost1 /]#vi /etc/sysctl.conf
Change net. ipv4.ip _ forward to 1,
Save and exit, and execute the following command to make the Kernel configuration take effect:[root@localhost1 /]#sysctl -p
6. Configure iptables forwarding
[root@localhost1 /]#iptables -t nat -A POSTROUTING -s 192.168.100.0/24 -j SNAT --to-source58.33.244.126
This command allows the IP address of 192.168.100.0 to access the Internet through the public IP address 58.33.244.126.
Replace 192.168.100.0/24 with your IP address in pptp. replace 58.33.244.126 with the public ip address of your server. Otherwise, you can only access the Intranet.
Save iptables configurations
[root@localhost1 /]#service iptables save
7. Start the service
[root@localhost1 /]# service pptpd start
[root@localhost1 /]# service iptables start
Configure the service to start automatically upon startup
[root@localhost1 /]#chkconfig pptpd on
[root@localhost1 /]#chkconfig iptables on
Now that the configuration is complete, you can use a common PC to establish a VPN (encrypted by default) connection ..