Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I can use either PPTP or L2TP. All the tutorials I find require a GUI to setup the connections. However, I want to connect from a virtual server to which I have only SSH access. Any hints?

share|improve this question

2 Answers 2

To use PPTP, you need to do the following:

First, install the pptp-linux, pppd, ppp packages. Then, create a file in /etc/ppp/peers/. The file name is irrelevant, but this name will be used to switch on the PPTP tunnel, so name it something meaningful. The file (the "peer file") should contain this:

pty "/usr/sbin/pptp <server_ip_address> --nolaunchpppd"
name <your_login_name>
remotename <identifier>
require-mppe-128
file /etc/ppp/options.pptp
ipparam <ipparam_id>

Replace the server_ip_address and the your_login_name with the appropriate values. The identifier will be used for supplying a password (see below). The ipparam_id is used by the scripts in /etc/ppp/ip-up.d/. It is needed if you want to do something with the tunnel interface (adding routes, maybe -- see below).

You need to supply your password. The password is stored in a plaintext file (which sucks, be sure to chown the file to 0600). The file is /etc/ppp/chap-secrets, anbd it should contain a line like this:

your_login_name    identifier    <your_password>    *

The first two parameters is from the peer file.

If you want to do something when the PPTP tunnel starts and/or stops, you need to add scripts to the /etc/ppp/ip-up.d/ and the /etc/ppp/ip-down.d/ directories. Every script in these directories will be run upon (de)activating a ppp tunnel. The following global variables exported for the scripts (there are others, but these are the most useful):

  • PPPD_PID: The PID of the pppd process
  • PPP_IFACE: The interface in question
  • PPP_IPPARAM: The ipparam_id, which is given in the peer file
  • PPP_LOCAL: The local IP address assigned to the ppp interface
  • PPP_REMOTE: The remote IP address assigned to the ppp interface

After all this, you can use the

pon <peer file>

to start the PPTP tunnel, and the

poff <peer file>

to stop it.

share|improve this answer
    
pppd seems to be included in Ubuntu by default and is not found as a package to install –  Martin Aug 29 '12 at 20:54
    
works great - perfect tutorial –  Martin Aug 29 '12 at 21:13

This is a good site: http://pptpclient.sourceforge.net

  1. Usually, we can setup PPTP VPN connection using "pptpsetup" command

    pptpsetup --create Test_VPN --server xxx.xxx.xxx.xxx --domain MyDomain --username MyName --password mypassword --encrypt
    
  2. Start the VPN connection

    pppd call Test_VPN
    
  3. If something is wrong, here is the debug command

    pppd call Test_VPN logfd 2 nodetach debug dump
    

On ubuntu, I think the package you need is pptp-linux, you can install it by the command:

apt-get install pptp-linux
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.