Centos6.5 install pptp-vpn Server
1. I am using yum for installation;
# Yum-y install dkms ppp pptpd rpm-build gcc iptables # Wait quietly
2. Configure the address range obtained by the client;
# Cat <eof>/etc/pptpd. conf
> Localip 192.168.2.2
> Remoteip 192.168.2.100-200
> Eof
Or
# Echo "localip 192.168.2.2">/etc/pptpd. conf
# Echo "remoteip 192.168.2.100-200">/etc/pptpd. conf
3. Set the dns Service of the server;
# Echo "ms-dns 8.8.8.8">/etc/ppp/options.ppt pd
# Echo "ms-dns 8.8.4.4">/etc/ppp/options.ppt pd
The above is the dns service obtained from the configuration file/etc/ppp/options.ppt pd.
5. Configure route forwarding and find the configuration file/etc/sysctl. conf;
Net. ipv4.ip _ forward = 0 # Change 0 to 1
Refresh Kernel Parameters
# Sysctl-p
6. Configure the VPN account and password
# Vim/etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# Client server secret IP addresses
User1 * user1 *
User2 * suer2 *
The first column is the corresponding account. The third column corresponds to the password. The fourth column is the server address.
7. Configure Firewall settings;
# Iptables-t filter-a input-p tcp-m state NEW-m tcp -- dport 1723-j ACCEPT
# Iptables-t filter-a input-p tcp-m state NEW-m tcp -- dport 22-j ACCEPT
# Iptables-t filter-a input-p tcp-m state NEW-m tcp -- dport 47-j ACCEPT
# Iptables-a input-p gre-j ACCEPT
----- The firewall implements nat forwarding settings (two methods are available ----
# Iptables-t nat-a postrouting-s 192.168.2.0/24-j SNAT -- to-source = x. x. x. x (corresponding to the IP address on which your server can access the Internet) is the first method.
# Iptables-t nat-a postrouting-s 192.168.2.0/24-o eth0 (your Nic name)-j MASQUERADE # method 2
# Service iptables save
# Chkconfig pptpd on
# Chkconfig iptables on
# Service pptpd start
# Service iptables start
At this point, my vpn Server has been built.