Telenet Cloud Online Help

Establish VPN connection on linux (command line)

To establish a VPN connection on linux through command line you first need to install pptp-linux.


You can do this as follows:

apt-get install pptp-linux


After pptp-linux is installed on the system you can add the user credentials of the vpn connection in the file /etc/ppp/chap-secrets

vim /etc/ppp/chap-secrets


This file should look as follows:

# Secrets for authentication using CHAP
# client server secret IP addresses
username PPTP password *

* Replace "username PPTP password" with your own credentials. You can enter more credentials.

Then create a new file in the folder /etc/ppp/peers/

vim /etc/ppp/peers/vpn10-user


This file should look as follows:

 

pty "pptp vpn10.hostbasket.com --nolaunchpppd"

name <loginname>

remotename PPTP

require-mppe-128

file /etc/ppp/options.pptp

ipparam <name_of_script_under_etc_ppp_peers_...>

 


Once the file is created, you can start the VPN connection

pon vpn10-user


If you now execute the command ’ip a’, you will notice that the VPN connection is active

root@User-Ubuntu12:~# ip a


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:15:c5:bc:ba:31 brd ff:ff:ff:ff:ff:ff
inet 192.168.15.98/24 brd 192.168.15.255 scope global eth0
inet6 fe80::215:c5ff:febc:ba31/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether 00:18:de:a4:c5:b3 brd ff:ff:ff:ff:ff:ff
9: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1496 qdisc pfifo_fast state UNKNOWN qlen 3
link/ppp
inet 172.31.3.167 peer 172.31.1.1/32 scope global ppp0


If you would like to stop the VPN connection, you can execute the following command

poff vpn10-user


3 (4)
Article Rating (4 Votes)
Rate this article
Attachments
There are no attachments for this article.
Related Articles
How do I connect to my Linux server?
Viewed 2602 times since Fri, Sep 18, 2009
Which Linux distributions can be installed on a dedicated server?
Viewed 2744 times since Wed, Aug 19, 2009
Can I run ASP.NET on a Linux Dedicated Server?
Viewed 1942 times since Fri, Nov 28, 2008