This is just another handy howto I found which works quite well:

Creating an Ubuntu/Debian PPTP Client

To configure Ubuntu or Debian as a PPTP client, you will need to install the pptp-linux package first:

$ sudo apt-get install pptp-linux

Now you will need to edit the options.pptp file

$ sudo vi /etc/ppp/options.pptp

and insert the below line:

lock noauth nobsdcomp nodeflate

Next you will need to modify chap-secrets

$ sudo vi /etc/ppp/chap-secrets

add this line:

$DOMAIN\\$USERNAME PPTP $PASSWORD *

where:
$DOMAIN is the VPN domain name
$USERNAME is your VPN username
$PASSWORD is your VPN password

A completed chap-secrets on a default Dapper setup would look something similar to this:

# Secrets for authentication using CHAP
# client        server  secret                  IP addresses

MYVPN\\myusername PPTP mypassword *

You will then need to create a tunnel configuration file:

$ sudo vi /etc/ppp/peers/$TUNNEL

where $TUNNEL is the name you wish to give this VPN connection. Now:

$ sudo vi /etc/ppp/peers/MyVPN

and add the following lines:

pty "pptp $SERVER --nolaunchpppd"
name $DOMAIN\\$USERNAME
remotename PPTP
require-mppe-128
file /etc/ppp/options.pptp
ipparam $TUNNEL

where $SERVER is the IP address or hostname of the VPN gateway
where $DOMAIN, $USERNAME and $TUNNEL are as defined earlier.
the resulting file will look something like this:

pty "pptp myvpnserver --nolaunchpppd"
name MYVPN\\myusername
remotename PPTP
require-mppe-128
file /etc/ppp/options.pptp
ipparam MyVPN

The last step you’ll need to take is to create a file in /etc/ppp/ip-up.d with the same name as your “peers” file that sets the route to the other network automatically for you:

$ sudo vi /etc/ppp/ip-up.d/MyVPN

which in this example for a class C network will look something like this:

#!/bin/sh  

route add -net 192.168.1.0 netmask 255.255.255.0 dev ppp0

Finalise the process by making the file executable:

$ sudo chmod a+x /etc/ppp/ip-up.d/MyVPN

Provide all your settings are correct, you should be able to start the PPTP connection by running:

$ sudo pon MYVPN

You can now run the ifconfig and route -n commands and perhaps ping a host at the other end to make sure the connection is good. The output of which will look similar to this:

$ ifconfig 
eth0    Link encap:Ethernet  HWaddr 00:AA:11:BB:22:CC
           inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
           inet6 addr: fe80::20e:35ff:fefc:e95/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:16780 errors:0 dropped:0 overruns:0 frame:0
           TX packets:14489 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:11422112 (10.8 MiB)  TX bytes:1604047 (1.5 MiB)
           Interrupt:5 Base address:0x8000 Memory:e0210000-e0210fff

lo        Link encap:Local Loopback
           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:16436  Metric:1
           RX packets:56159 errors:0 dropped:0 overruns:0 frame:0
           TX packets:56159 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:25007982 (23.8 MiB)  TX bytes:25007982 (23.8 MiB)  

ppp0   Link encap:Point-to-Point Protocol
           inet addr:192.168.1.2  P-t-P:192.168.1.1  Mask:255.255.255.255
           UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1496  Metric:1
           RX packets:7 errors:0 dropped:0 overruns:0 frame:0
           TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:3
           RX bytes:88 (88.0 b)  TX bytes:82 (82.0 b) 

$ route -n 
Kernel IP routing table 
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface 
192.168.1.1    0.0.0.0         255.255.255.255 UH    0      0        0 ppp0 
192.168.0.0     0.0.0.0        255.255.255.0   U     0      0        0 eth0 
192.168.1.0    0.0.0.0         255.255.255.0   U     0      0        0 ppp0 
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0 
$ ping remote-server 
PING remote-server.remote.com.au (192.168.1.101) 56(84) bytes of data. 
64 bytes from remote-server.remote.com.au (192.168.1.101): icmp_seq=1 ttl=254 time=765 ms 
64 bytes from remote-server.remote.com.au (192.168.1.101): icmp_seq=2 ttl=254 time=41.2 ms

Reference:
https://mcwhirter.com.au/craige/blog/2006/Creating_an_Ubuntu-Debian_PPTP_Client/

Advertisements

One thought on “Creating an Ubuntu/Debian PPTP Client

  1. Thanks for writing this awesome article. I’m reading your blog since a
    long time already but I never compelled to leave a comment.
    I subscribed to your blog and shared it on my Facebook.

    I will come back for sure to check your future posts!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s