Absolute beginner's guide to PPTP VPN !

Links to great tutorials and original contributions.
Don't know how to setup your VPN ? How to install a panel ? How to tweak yout VPS ? Check here and ask if you don't find what you are looking for.
Admin
Site Admin
Posts: 490
Joined: Wed Jul 25, 2012 10:54 pm

Absolute beginner's guide to PPTP VPN !

Post by Admin » Tue Aug 07, 2012 12:06 am

Hello all !

A huge number of tickets are about tun/tap ppp and VPN.
I will detail here a very simple vpn for windows users. I think that people which are looking to setup an OpenVPN are fairly seasoned in Linux and could do that without much help. If there will be requests, I will do a tutorial step-by-step for OpenVPN too.
I also asume that you need your box only for VPN or you already have an OVZ plan and want to add simple VPN capabilities with it.
This is for Debian 6 32 bit, my distribution of choice for a VPS. It will work probably on 64 bit too, also on Ubuntu. Didn't test it except on Debian 32 bit.
It works on any VZ plan, tested this on a 50cents box.
So, here we go.
First, open a cmd box, we will need this later, and put a ping on your IP to stay on all the time we work on this.
Press windows key+r. Windows key is the key between left ctrl+alt. If you dont see it, go to start, type cmd in the search programs and files box and then click the command prompt icon.
Write this inside:

Code: Select all

ping youriphere -t
Replace youriphere with the VPS IP you received from us. Must be something like 37.xxx.xxx.xxx 192.xxx.xxx.xxx or something along those lines. Write it exactly like there.
For our VPN to work we need to enable 2 devices (one in fact, but since we are there, let's enable both), TUN/TAP and PPP. Do not worry, you can do this simple, just login into your solusvm panel: https://solusvm.prometeus.net:5656 using the data you got in the mail which told you you received a VPS from us (user is vzuser-somenumber and pass is below in mail).
In the first screen, click manage and in the next window locate the buttons i highlighted like in this picture:Image
Initially they are disabled, so you will see on both enable. Now, please don't rush and take it slowly. If you hurry too much, something will break.
Click Enable TUN/TAP and confirm. Your VPS will reboot automatically, you will see in the black window we opened, you will stop receiving replies, instead you will see request timed out and occasional other errors. DO NOT CLICK THE OTHER BUTTON UNTILL YOU SEE REPLIES COMING AGAIN ! Failure to do so will mean you do not enable PPP and your VPN will not work, even tho in SolusVM it will look like enabled. Once you see replies coming, click the PPP button too, confirm, and wait again for the replies to appear.
So, lets login in our prepared vps using a ssh client called putty (download here: http://the.earth.li/~sgtatham/putty/lat ... /putty.exe)
We need for this the IP of the server and the root password (should be in the mail you got when you bought the vps, but if it does not work, you can easily change it in solusvm control panel):Image
Put there the IP of the server in both fields, then click save to have it for further sessions. Now click open, you will be presented with a security warning, click yes and proceed to insert your username (root), click enter, then your password (you won't see it as you type so make sure you type right).
Image
In putty you have to do a few things:
First, do this (copy/paste works):

Code: Select all

apt-get update
,

Code: Select all

apt-get upgrade
Reply y (enter) to all questions. After the upgrade has been done, do this

Code: Select all

apt-get remove samba* apache2*
I asume this is only for VPN box and you do not need a webserver. If you do, eliminate apache2 from the above command.
Now we need to download a script to install VPN for us and setup users (thanks putdispenserhere.com !).
The following command will download it, the second will make it executable and the third will launch it. After that make sure you read the questions and answer correctly. At first run choose 1, when you need to add more users only, choose 2.

Code: Select all

wget http://board.prometeus.net/myfiles/pptpvpn.sh

Code: Select all

chmod +x pptpvpn.sh

Code: Select all

./pptpvpn.sh
That is about it ! You should have a working PPTP server. If you need more users to connect, do again the last command and choose 2 for every user you need to add.
You can now close all windows and go test your VPN.
If something is not working, please post here, don't open a ticket, we need everyone to see the possible problems and the way to solve them.
Thank you !

Admin

javaclinic
Posts: 3
Joined: Sat Sep 15, 2012 5:11 pm

Re: Absolute beginner's guide to PPTP VPN !

Post by javaclinic » Sun Sep 16, 2012 11:10 pm

It is giving error

./pptpvpn.sh
-bash: ./pptpvpn.sh: /bin/bash^M: bad interpreter: No such file or directory
root@vpn1:~# /bin/bash
root@vpn1:~# /bin/bash pptpvpn.sh
Select on option:
1) Set up new PPTP server AND create one user
2) Create additional users
: command not found
1
': not a valid identifier `x
pptpvpn.sh: line 69: syntax error near unexpected token `elif'
'ptpvpn.sh: line 69: `elif test $x -eq 2; then

javaclinic
Posts: 3
Joined: Sat Sep 15, 2012 5:11 pm

Re: Absolute beginner's guide to PPTP VPN !

Post by javaclinic » Sun Sep 16, 2012 11:13 pm

did this trick
open in vi editor and do
:set fileformat=unix

and save

Admin
Site Admin
Posts: 490
Joined: Wed Jul 25, 2012 10:54 pm

Re: Absolute beginner's guide to PPTP VPN !

Post by Admin » Mon Sep 17, 2012 9:48 am

Thanks for pointing that out :)
Should be fixed now.

Admin

dedicados
Posts: 5
Joined: Tue Jan 08, 2013 12:07 am

Re: Absolute beginner's guide to PPTP VPN !

Post by dedicados » Tue Jan 08, 2013 12:09 am

ok works with Debian, any way to make it work with Centos?

need to modify something?

i tested on Debian in openvz and works.

dedicados
Posts: 5
Joined: Tue Jan 08, 2013 12:07 am

Re: Absolute beginner's guide to PPTP VPN !

Post by dedicados » Tue Jan 08, 2013 1:24 am

o well i make it work, with some modifications =)

Admin
Site Admin
Posts: 490
Joined: Wed Jul 25, 2012 10:54 pm

Re: Absolute beginner's guide to PPTP VPN !

Post by Admin » Tue Jan 08, 2013 3:27 pm

Could you post some diffs ? :)

dedicados
Posts: 5
Joined: Tue Jan 08, 2013 12:07 am

Re: Absolute beginner's guide to PPTP VPN !

Post by dedicados » Tue Jan 08, 2013 4:05 pm

shure, let me arrive to office, but was something about yum, rpm, and network.

arriving office i post the file.

Admin
Site Admin
Posts: 490
Joined: Wed Jul 25, 2012 10:54 pm

Re: Absolute beginner's guide to PPTP VPN !

Post by Admin » Tue Jan 08, 2013 5:37 pm

Thank you, I will add then another file to download for Centos/Fedora, whatever other RH clones :)

Carbon6
Posts: 2
Joined: Tue Aug 28, 2012 12:29 am

Re: Absolute beginner's guide to PPTP VPN !

Post by Carbon6 » Mon Jan 28, 2013 10:15 pm

Hello guys,
This worked fine while I was using Debian,
But I'm having a bit of trouble getting this to work on Ubuntu 12.04.

It set up ok, username and pass match what are in chaps-secrets, but after windows authenticates username and password, it proceeds attempting to connect, but doesn't.
PPPD process on unbuntu will chew up 100% of available CPU time while this is going on, and for another 2 minutes after stopping windows from trying to connect.

Could this be related to using Nginx for webserver? as when I was on Debian, I was using Apache2.
I should add, as this was a re-install of my instance, tun/tap and ppp were already showing as enabled in the control panel.

Thanks, Rob

pptpd-options

Code: Select all

name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
ms-dns 8.8.8.8
ms-dns 8.8.4.4
proxyarp
nodefaultroute
lock
nobsdcomp
etc/iptables.conf

Code: Select all

# Generated by iptables-save v1.4.12 on Mon Jan 28 09:11:25 2013
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A POSTROUTING -j SNAT --to-source 37.247.50.178
COMMIT
# Completed on Mon Jan 28 09:11:25 2013
# Generated by iptables-save v1.4.12 on Mon Jan 28 09:11:25 2013
*mangle
:PREROUTING ACCEPT [349983:329509567]
:INPUT ACCEPT [349983:329509567]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [227712:43253541]
:POSTROUTING ACCEPT [227712:43253541]
COMMIT
# Completed on Mon Jan 28 09:11:25 2013
# Generated by iptables-save v1.4.12 on Mon Jan 28 09:11:25 2013
*filter
:INPUT ACCEPT [349983:329509567]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [227712:43253541]
COMMIT
# Completed on Mon Jan 28 09:11:25 2013

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests