PPTP dialer in Linux - step-by-step tutorial

Updated: October 26, 2006

This article is a simple guide for helping Linux users using PPTP dialers connect to the Internet. It should specially benefit broadband users in Austria and Israel, in particular, and possibly Holland.

Why did I decide to write this article? As a Linux user, I'm faced with a critical dilemma whenever I connect to the Internet. Most ISPs offer limited or no support for Linux customers. The absolute majority of their effort is geared toward Windows. Accordingly, whether you use a direct connection or a dialer has little impact for Windows users. However, this can pose a serious problem for the Linux users.

In fact, this has proven to be the greatest challenge in Linux I have faced yet. But I have tamed it. One less reason for any skeptical soul not to migrate to Linux. Connecting to the Internet can be done using a number of communications protocols - PPPOE, PPTP, L2TP etc. In Windows, this is fairly simple.

In Linux, PPPOE works well. L2TP almost never works. PPTP is somewhere in between. Usually, you will have little choice in choosing since the protocol will be dictated by your ISP. Hopefully, this will change in a few years. In the meantime, I will try to alleviate the situation.

Most people, especially beginner users, are extremely intimidated by the prospect of configuring these dialers. Usually, the procedure involves "hacking" 5-10 different files, running 5-10 different scripts, all via command line. Usually, it takes a LOT of time. Even people who like a good challenge will find this method rather dissuading.

In the recent weeks, I have being hunting around the Internet, searching for a simple formula that will provide a working solution, with no more than 10 minutes of hard work. And I have found it. This does not mean it's SIMPLE. It's just much simpler than any other method / solution I can think of. Let's see how you can (easily) configure a PPTP dialer that will work.

Prerequisites

The only prerequisite is that you use a cables infrastructure. By the way, phone ADSL dialers usually support PPPOE. Most Linux distributions have a mature and stable PPPOE dialer wizard (similar to Windows). In this tutorial, you will only need: edit 2 files, run 4 commands and 10 minutes of your time.

Step 1: Download cable startup script

Download Linux NV Cables Script by makini from SourceForge.net. Save it to a folder of your choice. Make sure you can grab it when booted in Linux. When booted in Linux, copy the file to your /home folder (or any sub-folder).

Step 2: Unpack archive

Unpack the package by running the following command in a Terminal window:

tar zxvf nvc-c026.tar.gz

Step 3: Edit cable script

Access the unpacked folder called nvc. In it, you will find the scripts named cablestart-v026 and cablestop. These scripts are configured to work specifically with an Israeli ISP Netvision. You need to change them to work with your ISP. In Terminal, open the script cablestart-v026 in a text editor (e.g. vi, kate):

kate cablestart-v026

This is the content of the script:

#!/bin/bash

USERNAME="$1"
IFACE="$2"
PPTPS=cable.netvision.net.il
NEWDNS=194.90.1.5

ifdown $IFACE
ifup $IFACE

NVGW=$(ping -c 3 -w 3 $PPTPS | head -n 1 | cut -d" " -f3 | cut -d"(" -f2 | cut -d")" -f1)
CABLEGW=$(route -n | grep 0.0.0.0 | cut -d" " -f10 | tail -1)
  
route add -host $NVGW gw $CABLEGW dev $IFACE

./pptp $NVGW debug user $USERNAME mtu 1380 mru 1380 defaultroute persist nobsdcomp usepeerdns

sleep 6

NEWGW=$(ifconfig ppp0 | grep inet | cut -d":" -f3 | tail -1 | cut -d" " -f1)

route add default gw $NEWGW
route del default gw $CABLEGW

echo nameserver $NEWDNS > /etc/resolv.conf

You need to change two variables: PPTPS and NEWDNS to reflect YOUR ISP information, for example:

PPTPS=cable@provider
NEWDNS=xxx.xxx.xxx.xxx

Save the changes.

Step 4

You need to provide your credentials (username and password) to allow the dialer to authenticate your connection with the ISP servers. This is done by editing a file called pap-secrets.

To edit this file, you MUST be logged in as root (su) or run the file as root (sudo). Again, you will need to edit the file using a text editor.

kate etc/ppp/pap-secrets

Look for the commented line reading Outbound connections. You need to specify your username and, password. Please note the comments. If you're using multiple ISPs simultaneously, do not enter the credentials here. Instead, you will be asked for your password every time you dial a connection.

pap secrets

Your addition should be something like this:

l33tcabler    *    12345678

Separate the three fields (username, host and password) with tabs; * indicates any host.

Step 5: Establish connection

It's time to establish the connection.

At this stage, it is important that you know WHICH network card installed in your computer connects to the Internet. If you have a single card, its name will be eth0. However, if you have more than one card, the name could be eth0 or eth1, for example.

You can check the status of your network devices by executing the following command in the Terminal:

/sbin/ifconfig

The list of your network cards will be displayed, similar to what you get by typing ipconfig in Windows command line. When connected to the cables intranet, you will receive an internal IP particular to your cables infrastructure. Look for that IP and you will know which network device connects to the Internet.

ifconfig

Once you are completely sure which device is the right one, execute the cablestart script as root:

./cablestart-v026 username eth0

To stop the connection, execute cablestop:

cablestop

This package has been successfully tested with the following distributions and under following conditions:

Alternatives

The best solution that I have found is a bit impractical for everyone, but it works flawlessly. It requires that a user dedicates an old computer to act as a router and install SmoothWall firewall (with its own Linux OS) on it. SmoothWall is controlled through a web interface and is equipped with a powerful dialer that will master any protocol. In addition to functionality, this setup will grant you solid security, as well. All it takes is an aging P2 or P3 that you can spare. I will make a step-by-step tutorial soon.

If you do not like my article, you can try other available solutions. Here's the brief history of my PPTP quest. Below are some of the links to various Internet sources that I have found to be rather useful if not well suited for the average user. Nevertheless, the people who have created these sources deserve the respect of the community and Internet users worldwide for their efforts in pioneering a very difficult project.

PPTP Client project on SourceForge.net

Netvision Linux scripts - includes L2TP (most suited for Debian) and PPTP dialers

Older and very complex guides

Austrian high speed Internet connection & Linux howto - in German

CABLES-DHCP-PPTP-HOWTO

Cable Modem Mini-Howto

L3ech's cable Internet connection guide for Linux users

Linux Cables+Ethernet+PPTP HOWTO

Other sources

Actcom Linux cable dialers - including PPTP and L2TP

Actcom Linux ADSL PPTP dialer

Regrettably, I have found very few sources for PPTP in Austria that I can list here, for the simple reason that almost all of them are in German, fragmented and several orders of magnitude more messy than the solutions at the above links.

Furthermore, there are many other guides and how-tos addressing the issue of PPTP dialers for Linux, more or less suitable to the general public. Feel free to expand your searches. If you find anything that is simpler or works more efficiently than my solution, I would be grateful if you emailed me. Coming soon (hopefully): L2TP guide - managing the impossible!

You may also like: