16

I am trying to create a VPN connection for my Ubuntu Server machine to use. I only have access via ssh terminal session.

I have seen many articles detailing how to connect to an existing connection, but none about creating a new connection.

I am using Ubuntu Server 12.x

4
  • So I guess you want to install a VPN server on your machine, right?
    – laurent
    Jul 10, 2012 at 21:51
  • I dont think so (unless I am misunderstanding). I want my server to connect to VPN, not be a VPN server
    – David
    Jul 10, 2012 at 22:12
  • ssh is really powerful. You can connect using $ ssh -X <host> -u <user>. This way, you will have a connection with X forwarding, so, you can use X applications from your remote machine. This can be useful if you feel using X more comfortable than just using a plain console.
    – jap1968
    Jul 10, 2012 at 23:29
  • another option is using shadowsocks + proxychains instead of VPN
    – elprup
    Mar 15, 2016 at 3:18

3 Answers 3

8

As I didn't understand what you need to do exactly, let me explain how VPN works:

To have a VPN you need a VPN Server (where you connect to) and a VPN Client (the machine you use to connect to the Server). You can't create a connection without a VPN server. We have 3 possibilities here:

  • You want your server to connect to another one (a VPN Server). In this case you need a client and as there are different VPN types, you need to follow instructions from the VPN Server administrator.

  • You want to connect to your server from another machine (your local machine probably) and in this case you need to install a VPN server on your server and a client on your machine. For that I use OpenVPN since many years and it works very well with Windows and Ubuntu clients

  • You want to connect both machines to a hosted VPN server from a 3rd party and in this case as there are many different VPN types, you need to follow the instructions of the 3rd party administrator.

If you only want a "private / encrypted" connection to your server, you already have SSH and you won't have much more with a VPN. A VPN is useful to connect to a network as if you were a local machine in the network and not so useful to connect to a single machine where you can use SSH connections for terminals (and redirect graphic output to your screen if the server has graphic desktop) and SSH tunnels to access other ports. For example tunneling with SSH a local port on your machine to port 3306 on the remote server to administer MySQL with a 100% encrypted connection instead of using phpmyadmin sending your DB root password over http.

PPTP Update:

For PPTP client via command line, you can use pptp-linux client:

sudo apt-get install pptp-linux

There are many tutorials on how to configure it:

Edited after comments from OP: Ubuntu community help site worked.

Others are available like PPTP Linux client. The tutorial is for command line client or GUI client so install only pptp-linux and not network-manager-pptp

pptp-linux site instructions for Debian is also detailed for command line and should work without problem on Ubuntu.

8
  • 1
    Yes I understand that. I trying to do what you have listed in the first bullet point - connect to another VPN Server, from my server. I know all the connection details, I am connected to my server's terminal (via ssh). I trying to find out how to configure the vpn connection via this terminal session.
    – David
    Jul 12, 2012 at 9:50
  • So what are the connection details? (type of VPN of the server and parameters required if any -- obs no need of the password or real ip if any). Don't you have instructions to setup the client from the VPN server admin?
    – laurent
    Jul 12, 2012 at 13:07
  • 1
    I am asking the kind of VPN because each VPN protocol needs a different client. You can find instruction for some of them in help.ubuntu.com/community/VPNClient
    – laurent
    Jul 12, 2012 at 13:34
  • Its a PPTP connection, the link you posted seems but it doesnt detail the steps to creating a new PPTP connection (as far as I can see). It would be great if I could launch network-manager via ssh X11 forwarding - but I dont want to install gdm just to do that
    – David
    Jul 12, 2012 at 15:03
  • updated answer for PPTP
    – laurent
    Jul 13, 2012 at 2:26
1

This article might be helpful. http://ashu-geek.blogspot.com/2012/05/vpn-virtual-private-network.html

it describes how to create vpn connection using terminal and GUI dekstop.

1
  • 4
    Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – Lucio
    Feb 9, 2013 at 5:46
0

use the 'pppd' to accomplish it:

sudo pppd nodetach defaultroute replacedefaultroute persist password mypassword file myvpn

replace "mypassword" with your pptp account's password. the "myvpn" is a config file, format as:

linkname myvpn 
ipparam myvpn 
pty "pptp server_address --nolaunchpppd " 
name myaccount 
usepeerdns 
require-mppe 
refuse-eap noauth

# adopt defaults from the pptp-linux package 
file /etc/ppp/options.pptp

this config file format is mentioned in here:https://help.ubuntu.com/community/VPNClient

And, "nodetach", or "defaultroute" are options for pppd, been described here:http://manpages.ubuntu.com/manpages/hardy/man8/pppd.8.html

I have use this method in java to setup a pptp client vpn connection, yes, it works.

The pid file, is in /var/run/ppp-xxx.pid, the "xxx" is your linkname that in your config file. You can read the pid of pppd from this pid file send a signal to the pppd, e.g "sudo kill -s SIGTERM pid_of_pppd", to shutdown the pppd.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .