Using Linux to Dial-up Melb PC

Got Linux, what now?

So you’ve got Linux running and you’ve tampered with your new Unix toy a bit. What now? Well, what’s the point of having Linux to play with if you can’t go out and muck around with it in the Internet playground?

Official FAQ now available

Since this article was published, Melb PC has added Configuring MelbPC Dial-up for Linux to the Melb PC FAQs and Assistance page. This step-by-step guide shows how to use the kppp tool for configuration, and is much more straightforward than the method I outline here. I highly recommend it.

However, if you still want to get your hands dirty with some manual configuration - read on!

This brief guide will give you the basics of setting up a connection to the Melbourne PC User Group Internet Service.

I’ve tried to keep it as short and simple as possible without too many ifs, buts, and maybes. For more detail I recommend you have a look at some of the resources listed at the end - the “PPP Howto” document is particularly helpful. If you installed Linux off a CD set, you will probably have a documentation disc which includes all of the “Howto” documents (and plenty of other reading matter).

You should get your connection working if you follow these directions, but in reality you are well advised to refer to the documentation also. My aim here is to give you a short-cut through the documentation to the information you really need.

Preliminary Notes

I have tested this information using the Red Hat 7.1 distribution. If you have installed another distribution, you may find some of the configuration files stored in slightly different places. Check the PPP Howto for details of differences between systems.

As with any computer system, in Linux there is usually more than one way to get into the feline fur business. The PPP Howto mentions a number of easy configuration utilities - I have tried some of these but underneath they all setup the configuration files more-or-less as shown here. Have a look for yourself, you might prefer them to writing configuration files by hand.

In looking through this article you might think that this process is all a bit hard. It can be tricky, but it’s worthwhile because once it’s setup, you’ll be able to connect to the Internet Service with a single command.

Things you’ll need


The Melbourne PC Internet Service provides dial-up connection using the Point-to-Point Protocol (PPP). This is a widespread method of accessing Internet (TCP/IP) services over a telephone line. To make a dial-up connection, we are mostly concerned with getting PPP working.

PPP is implemented in Linux by the pppd daemon (a daemon is a program that runs in the background providing services when required). pppd is usually located at /usr/sbin/pppd.

To check if PPP is installed on your system type the following at the command line:

dmesg|grep PPP

This searches your boot-up messages for references to PPP drivers. If there is no output from this, you probably don’t have PPP installed or enabled on your system. Chances are that PPP is already enabled if you are using a recent distribution, and there will be some lines of output from this command. If you need to install it, see the PPP Howto document for help.

Modem and serial interface

Do you know what port your modem is connected to? If you are running Linux on a PC it is probably one of the “COM” ports (COM1, COM2, …) In Linux these ports have “device file” equivalents:

Windows Linux
COM1: /dev/ttyS0
COM2: /dev/ttyS1
COM3: /dev/ttyS2
and so on

(Just substitute /dev/ttyS for COM and start counting from 0 instead of 1.)

My modem is on /dev/ttyS0 (COM1), so I’ll use that in my example - substitute the correct device number for your modem.

Configure PPP

The following is a brief outline of the configuration files used to connect with PPP. Sample files usually come as part of the PPP package, so just modify them as shown here or download them from my web page. Some files don’t need to be changed at all.

You need to be logged-in as “root” to edit the configuration files.


Provides simple mapping of IP addresses to host names. The only host name required here is the local machine, called “localhost” by default:               localhost

The IP address given to localhost is - the so-called “loopback interface”, a reserved IP address that essentially means “this machine”. (All traffic sent to gets sent “out” on one port and looped-back “in” on another on the same machine.)

Download /etc/hosts (and save it as hosts)


Contains the IP addresses of domain name servers that can be accessed. MelbPC has three domain name servers, so include the lines shown below into your /etc/resolv.conf file.


Download /etc/resolv.conf (and save it as resolv.conf)


Indicates the order in which name resolution should occur. The single line required in this file is:

order hosts,bind

indicating that the domain name resolver should look in /etc/hosts before looking anywhere else. You probably won’t need to change this file

Download /etc/host.conf (and save it as host.conf)

/etc/hosts.allow and /etc/hosts.deny

You probably won’t need to change these two, either. They determine which machines (hosts) are allowed or denied access to Internet services on your system. The system checks hosts.allow first


in this case we are allowing local machines only (ie. your machine) to have access. Then the system checks hosts.deny


and blocks “ALL” other machines from gaining access - not a bad fallback position!

Download /etc/hosts.allow (and save it as hosts.allow) and /etc/hosts.deny (and save it as hosts.deny)


Contains arguments to the pppd command.

asyncmap 0
mru 552
mtu 552


The first eight lines are lifted straight out of the PPP Howto - see the “What options should I use?” section in that document. The “name” and “password” options allow login to occur automatically.

Download /etc/ppp/options (and save it as options)

Connection Scripts


One of the two scripts you actually run directly.




exec /usr/sbin/pppd \ 
  debug /dev/ttyS0  \ 
  38400 \
  connect /etc/ppp/ppp-on-dialer

(Note - last line ‘folded’ for readability - it does not appear like this in the script.)

Log-in as “root” and run this script to kick it all off. It sets up a few things then runs /etc/ppp/ppp-on-dialer.

Download /etc/ppp/melbpc (and save it as melbpc)


The script that does the dialing and connection. Actually it is a wrapper that passes options to a program called chat, which handles the connection. The options used with chat are a bit arcane, so just use the script as shown here:


/usr/sbin/chat -v       \
  TIMEOUT         3           \
  ABORT           '\nBUSY\r'  \
  ABORT           '\nNO ANSWER\r' \
  ABORT           '\nRINGING\r\n\r\nRINGING\r' \
  ''              \rAT         \
  'OK-+++\c-OK'   ATH0         \
  TIMEOUT         45           \
  OK              ATDT$TELEPHONE \
  CONNECT         ''

Only if you’re a glutton for punishment should you look at the manual page for chat.

Download /etc/ppp/ppp-on-dialer (and save it as ppp-on-dialer)


This is the other script you run directly, this one performs an orderly disconnection.


if [ "$1" = "" ]; then

if [ -r /var/run/$ ]; then
    kill -INT `cat /var/run/$`

    if [ ! "$?" = "0" ]; then
            rm -f /var/run/$
            echo "ERROR: removed stale pid file"
            exit 1

    echo "PPP link to $DEVICE terminated"
    exit 0

echo "ERROR: PPP link not active on $DEVICE"
exit 1

Run this one as the end of your session. This is the standard model as I’ve found no need to modify it. You will need to switch to another console window to run this.

Download /etc/ppp/ppp-off (and save it as ppp-off)

That’s all folks

That’s all you need to get going. Now whenever you want to connect, login as “root” and run /etc/ppp/melbpc.

You might be able to just set things up as I’ve shown them here, but the cautious reader may want to test a few things first.

Test your connection

This stage is not essential, but it will reassure you that your modem works with Linux and that you can connect to the MelbPC service.

Use a terminal program - I have one called minicom that was installed as part of my distribution. (Users who remember the DOS-based terminal program Telix will be on familiar ground here - minicom is a near-perfect Telix clone.)

Log-in as root and run this command from the command line:

minicom -s

You will be presented with a configuration menu:

Figure 1. Screen capture image showing minicom configuration menu

![Image of dialup config menu](/download/linux-dialup-config-menu.gif)

Move the cursor (using the arrow keys) to select “Serial port setup”, and in this submenu:

Figure 2. Screen capture image showing serial port setup submenu

![Image of dialup config submenu](/download/linux-dialup-config-submenu.gif)

input your serial device at option A (I’ve typed in /dev/ttyS0). Press enter to shutdown the submenu, then choose “Save setup as dfl” in the main menu, then choose “Exit” - the main terminal program now starts.

minicom prints an introductory message and sequence of obscure characters (the initialisation string for the modem) then gives the OK prompt. Type in:


which is the command to dial a MelbPC server. If all goes well you receive a message “CONNECT” then a few moments later a “login:” prompt. Your modem has made the connection. Now jump out of minicom by pressing Control+A then Q - minicom will ask if you want to exit, and you respond “yes”.

Working fairly quickly, at the command line type:

pppd /dev/ttyS0

and press enter.

Hopefully you will receive the message: “Remote message: Login Succeeded” followed by the dynamically allocated IP addresses of the local and remote hosts. You now have an active PPP link - go surf! Press Control+C or run /etc/ppp/ppp-off to kill the link when you are finished.

You could connect this way every time, but why would you when you have /etc/ppp/melbpc to do it all for you?

Deconstructing the scripts

These two scripts automate the process of dialing and starting PPP.


The key line in /etc/ppp/melbpc is the last line which actually starts the pppd daemon. The line can be dissected as follows:

  • exec /usr/sbin/pppd = run the pppd daemon

  • debug = run it in debug mode. (Debugging output is sent to /var/log/messages - look here for error messages if you’re having trouble. When things are running well, this option should be removed.)

  • /dev/ttyS0 = run it using this device

  • 38400 = connection speed (yes, I have a slooow modem)

  • = dummy IP addresses for local and remote hosts respectively

  • connect /etc/ppp/ppp-on-dialer = handle log-in using this script


I have modified the basic ppp-on-dialer script so that it retrieves the telephone number from the $TELEPHONE environment variable (in the second-last line). This allows me to have a set of startup scripts, called rather originally:

/etc/ppp/melbpc1 /etc/ppp/melbpc2 /etc/ppp/melbpc3

Each with a different MelbPC dial-up number assigned to $TELEPHONE, so I can easily choose to use a less frequented number simply by starting the appropriate script.

Don’t get “root”-ed

Although I’ve said that you need to log-in as “root” to get you PPP connection started, you should not go browsing or do anything else online as “root”. When it comes to everyday computing activities, these should never be done as “root” (especially while online) because of the extra super-user capabilities that come with the “root” log-in.

There are ways of setting up PPP so that you don’t have to log-in as “root”, but we might come back to those some other time.

Download the scripts

Here are all of the script and configuration files:


First published: PC Update Sept 2002 (online version updated)