Living in Russia I need USA IP address for my work. VPN provider I used to use offer USA address for $20/month, that is too much. To save my money bought a small Ubuntu VPS and installed a private VPN server. In fact, you are not limited geografically – look aroud to find VPS provider in the area you need and follow this article VPN section instructions.
Step 1: Buy a VPS
First of all find a cheap VPS provider (e.g. Linode, Digital Ocean, etc.). Most of them offer free trial period (usually about a week) so if you need foreign access just for once you can get it for free.
As I said above the VPS must have Ubuntu OS onboard. VPS hardware should be very basic. Check my Linode server specs as an example:
Let’s skip the VPS creation process and go to the next step.
Step 2: Setup Virtual Private Network (VPN) server
So you have a basic Ubuntu VPS placed in the country you need with public IP address. All you need is to redirect network traffic from your computer to the Internet through the VPS.
Step 2.1 Install and configure VPN PPTP server
sudo apt-get install pptpd sudo systemctl enable pptpd
Check PPTP server config files. They should be like this:
option /etc/ppp/pptpd-options logwtmp localip 10.30.1.1 remoteip 10.30.1.30-40,10.30.1.15
user1 pptpd pswd "*"
Replace user1 and pswd with new user name and strong password.
name pptpd refuse-pap refuse-chap refuse-mschap require-mschap-v2 require-mppe- ms-dns . ms-dns . proxyarp nodefaultroute lock nobsdcomp novj novjccomp nologfd
After this is done you can connect to the server with PPTP client. But network traffic won’t pass trough – you need to make one more step.
Step 2.2 Turning your server into a router
Enable IP traffic forwarding by runnig this commands.
sudo net.ipv4.ip_forward = 1 sudo sysctl -p
Enable Network Address Transalation (NAT) for all outgoing traffic
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Very important to save this new iptable rule
sudo apt-get install iptables-persistent sudo netfilter-persistent save
Step 3 Configure VPN client in your machine
PPTP clients are available in all popular OS by default. Following instruction is for Windows 7 but configuration process for other systems are pretty similar.
- Go to Control Panel\All Control Panel Items\Network and Sharing Center
- Click on Set up a new connection or network
- Choose “Connect to a workplace” option and press Next
- Choose “No, create a new connection” and press Next
- Choose “Use my Internet connection (VPN)”
- In the form enter the server public IP address. Edit the connection title. Check “Don’t connect now” check box
- Enter username and password you specified in step 2.1. Remember the password and press “Create”
- Don’t connect for now, just close the wizard.
Ok, the connection is ready, but you need to edit it.
- Go to Control Panel\Network and Internet\Network Connections
- Right click on the new connection and choose Properties
- Go to Secuirty tab and configure it as show in screenshot below and press OK
Now you are ready to connect.
Go to speedtest.net to verify that you use your new ip address. Reboot the server and reconnect VPN client to be sure PPTP service and iptables works after reboot.