[Ubuntu] Setting up a VPN on VPS

OpenVPN + Mobile on VPS

myhosting.com Provides a powerful VPS application template for OpenVPN and PPTP to quickly get you started! This template is only supported on newer CentOS plans.

myhosting.com OpenVPN Getting Started Guide

For details on configuring OpenVPN, see: OpenVPN VPS - Getting Started Guide

myhosting.com Mobile VPN connection using PPTP for iPhone, Android etc

For details on configuring Mobile VPN using PPTP, see: Mobile VPN with PPTP Tutorial

 

Manual PPTP VPN Installation and Setup for iPhone, iPad iOS VPN and other PPTP Clients

This article will describe VPN use on myhosting.com VPS. We may provide links to third party tutorials that we do not actively maintain. Any third party instructions should be performed at own risk so please MAKE A BACKUP! :)

 

Enabling VPN Support on Linux VPS

Since Virtuozzo 4.6, it has been possible to enable VPN support on Linux VPS containers. This tutorial will describe how to enable VPN support for Linux Virtuozzo Containers on myhosting.com onCloud Linux VPS http://myhosting.com/linux-vps.

  1. Log into your myhosting.com onCloud Control Panel at https://manage.myhosting.com 
  2. If you have only one subscription with myhosting.com, simply click Home. If you have multiple subscriptions, click the VPS subscription you wish to add VPN support to, by clicking the subscription in the drop down menu.
  3. Click VPS Management 
  4. Click the Applications tab.
  5. Click Install 
  6. From this menu, you should be able to find a .vpn... package. Read the description of the resource to make sure it's the right one and to note any details about installation, then put a checkmark beside this package and click Submit.
  7. This will begin installing the VPN package.
  8. Once finished (click refresh to check), you will need to reboot your VPS before you can begin setting up any VPN software.
  9. After rebooting your VPS is complete, log into your VPS with SSH and run the following command to see that it has been setup successfully:

cat /dev/ppp

If this command returns the below then VPN support is successfully enabled:

cat: /dev/ppp: No such device or address

Have fun!

 

PPTP VPN on Ubuntu 12.04 Example

Here is a quick tutorial to set up a basic PPTP VPN server on Ubuntu 12.04.

Install Necessary Packages

1)      Install the required software:
sudo apt-get install ppp pptpd

Configure PPTP IP Ranges on the Server

1)      Edit the following file:
sudo vim /etc/pptpd.conf

2)      At the bottom of the file add:
localip 10.89.64.1
remoteip 10.89.64.100-150

This sets up the PPTP server to use IP 10.89.64.1 while distributing the IP range 10.89.64.100 to 10.89.64.150 to PPTP clients. Change these as you wish as long as they are private IP addresses and do not conflict with IP addresses already used by your server.

Configure DNS Servers to Use When Clients Connect to this PPTP Server

1)      Open the pptpd-options file:
sudo vim /etc/ppp/pptpd-options

2)      Find lines containing ms-dns and add
ms-dns 8.8.8.8
ms-dns 8.8.4.4

This configures the VPN server to use Google's DNS service. You can specify other DNS servers if you know such addresses you would prefer to use.

Create a PPTP User

1)      Edit the following file:
sudo vim /etc/ppp/chap-secrets

2)      Append a line at the bottom so your file looks something like:
# client    server  secret          IP addresses
test    pptpd   abcd1234    *

Configure NAT for PPTP Connections

**Without this step you will be able to connect but your connection will not be able to load any web connection from this server.

1)      Edit the following file:
sudo vim /etc/rc.local

2)      Add the following to the bottom right before “exit 0” line:
iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE

3)      Enable IPv4 forwading:
sudo vim /etc/sysctl.conf

4)      Uncomment the following line:
net.ipv4.ip_forward=1

5)      Then reload the configuration:
sudo sysctl -p

Reboot your VPS and everything should work swimmingly from any PPTP client.

 

PPTP VPN on CentOS Example

An example tutorial can be found at the below URL. This is not a supported tutorial, it's an example what can be done with VPN on a VPS, use at own risk! http://docs.cslabs.clarkson.edu/wiki/Install_PPTP_on_CentOS_5 

The above link has been found to work using the following configurations:

In /etc/pptpd.conf use:

localip 10.89.64.1
remoteip 10.89.64.100-150

In /etc/ppp/options.pptpd use google DNS by setting the following lines:

ms-dns 8.8.8.8

ms-dns 8.8.4.4

Lastly, any reference in your firewall config to the virtual network device will usually show eth0, but in the case of Virtuozzo, you must use venet0 instead.

 

PPTP VPN on Debian Example

An example tutorial can be found at the below URL. This is not a supported tutorial, it's an example what can be done with VPN on a VPS, use at own risk! http://www.putdispenserhere.com/pptp-debian-ubuntu-openvz-setup-script/ 

Remember, any reference in your firewall config to the virtual network device will usually show eth0, but in the case of Virtuozzo, you must use venet0 instead.

 

Enabling VPN Support on Windows VPS

Presently, VPN support is only possible through third party applications such as OpenVPN or others. Windows VPN is only supported under Standard Edition of Windows Server 2008 R2 and we presently offer only Web Edition.

Check back for updates!!

 

Was this article helpful?
0 out of 0 found this helpful