Yesterday I had an idle server, so I set up a VPN. The system is centos 6.5 X64 and The PPTP type is set up. Strip Records, weed removal...
The procedure is as follows:
1. Install software related to PPP and PPTPD
The installation command is as follows:
Yum install-y ppp
Yum clean all
Yum makecache
Yum-y install pptpd
Run the preceding commands separately. You can see that the prompt is successful.
2. Configure PPTP
Follow the command below to perform the step-by-step operation:
Vi/etc/pptpd. conf
In this file:
# Localip 192.168.0.1
# Remoteip 192.168.0.234-238
Remove the preceding #, that is, remove the comment, and save and exit!
Note: the IP addresses set above: localip 192.168.0.1 and remoteip 192.168.0.2-200 are the vpn gateway address and the vpn dialing address segment respectively. You can also set the IP addresses by yourself.
Next, edit:
Vi/etc/ppp/options.ppt pd
Set
# Ms-dns 10.0.0.1
# Ms-dns 10.0.0.2
Remove the previous # and change it to your desired DNS:
Ms-dns 114.114.114.114
Ms-dns 114.114.115.115
By the way, the commonly used DNS in the appendix:
Next, configure the username, password, and other information that can be logged on:
Vi/etc/ppp/chap-secrets
There are only two rows after opening,
# Secrets for authentication using CHAP
# Client server secret IP addresses
Add user information in the following format under the two lines. Each item is separated by a space, for example:
# Secrets for authentication using CHAP
# Client server secret IP addresses
Gongzi pptpd 123456 *
* Indicates that all IP addresses can be logged on.
Next, modify the kernel parameters to support forwarding:
Vi/etc/sysctl. conf
Set
Net. ipv4.ip _ forward = 0
Change
Net. ipv4.ip _ forward = 1
Save and exit, and then use the following command to make it take effect:
Sysctl-p
3. Add iptables forwarding rules
Iptables-a forward-s 192.168.0.0/24-o eth1-j ACCEPT
Iptables-a forward-d 192.168.0.0/24-I eth1-j ACCEPT
Iptables-t nat-a postrouting-s 192.168.0.0/24-o eth1-j MASQUERADE
You need to pay attention to the NIC to see which network port is connected to the public network. Otherwise, the network cannot be connected to the public network after successful connection.
Restart the service:
/Etc/init. d/pptpd restart
Set pptp and iptables to start with the system
Chkconfig pptpd on
Chkconfig iptables on
Add a new VPN to test the connection.