CentOS vps vpn tutorial

Source: Internet
Author: User

There are many friends who want to use VPN, But they purchase other VPN services, but the speed is limited and the traffic is limited, and the price is unstable. Why not set up your own VPN Server? The cost of setting up a VPN on your own is very low. For example, if you buy a buyvm VPS, the cheapest price is 15 $/year, and RMB is less than one hundred RMB. Why? The following is a tutorial on setting up a VPN:

1. First, check whether the PPP and TUN of your VPS are enabled:

Cat/dev/ppp
Cat/dev/net/tun

The displayed results are: cat:/dev/ppp: No such device or address and cat:/dev/net/tun: File descriptor in bad state, none of the above two items will work if one fails. If it is not enabled, you can Submit a Ticket request to the VPS provider for activation:

Hello

Cocould you enabled TUN-TAP for me? I want run pptp-vpn on my VPS.
Thank you.

After you confirm that PPP and TUN are enabled, start to install ppp and iptables:

Yum install-y ppp iptables

Ii. Install pptp:

Rpm-ivh http://acelnmp.googlecode.com/files/pptpd-1.3.4-1.rhel5.1.i386.rpm (32-bit System)

Rpm-ivh http://acelnmp.googlecode.com/files/pptpd-1.3.4-1.rhel5.1.x86_64.rpm (64 bit System)

3. Configure pptp and edit the/etc/pptpd. conf file:

Vim/etc/pptpd. conf

Remove the # preceding the following field:
Localip 192.168.0.1
Remoteip 192.168.0.234-238,192.168 .0.245

4. Edit the/etc/ppp/options.ppt pd file:

Vim/etc/ppp/options.ppt pd

Remove "#" before "ms-dns" and use the Google DNS server to modify it to the following fields:

Ms-dns 8.8.8.8
Ms-dns 8.8.4.4

5. Set the VPN account password and edit the/etc/ppp/chap-secrets file:

Vim/etc/ppp/chap-secrets

6. Modify the kernel settings to support forwarding and edit the/etc/sysctl. conf file:

Vim/etc/sysctl. conf

Change "net. ipv4.ip _ forward" to 1, and add # Before "net. ipv4.tcp _ syncookies = 1 #

7. Make the sysctl. conf configuration file take effect and add iptables forwarding rules:

Sysctl-p
Iptables-t nat-a postrouting-s 192.168.0.0/24-j SNAT-to-source ***.***.***.***
)

Save iptables forwarding rules:

/Etc/init. d/iptables save

Restart iptables:

/Etc/init. d/iptables restart

Restart the pptp service:

/Etc/init. d/pptpd restart

Set to automatically run the pptp service at startup:

Chkconfig pptpd on

Set to automatically run the iptables service at startup:

Chkconfig iptables on

Now, the VPN has been set up in Linux VPS. If the connection error 619 occurs, enter the following command to solve the problem:

Rm/dev/ppp
Mknod/dev/ppp c 108 0

If error 734 appears, modify the/etc/ppp/options.ppt pd file, add # In Front Of The require-mppe-128 field, and then connect to windows client by setting.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.