Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

Related items

Made to Measure : Apache Web Server Customization

Apache at your Web Service

Jump Start your Intranet Web Sites - Setting up Virtual Hosts on Apache

Linux #6 Stairway to Heaven? - Setting up your Linux Server as an Internet Gateway!

Linux with RPM

Linux #5 What's in a name? - Domain Name Server on Linux

Linux #4 "Setting up DHCP is not P2C2E"

Linux #3 "You teach best...."

Linux#1 A Red Hat to cover your a-- (oops!) head.

Linux#2 Net Connection

You are here: irt.org | Articles | Linux & Apache | Linux#2 Net Connection [ previous next ]

Published on: Friday 11th September 1998 By: Tarique Sani


"Your titles were silly, then they became more silly, this one is the most silly and in incorrect English" Well Folks! If you have been following my other articles you would know who made this comment, still I feel that the title is very descriptive - SO WHAT IF IT IS INCORRECT ENGLISH?

In the last article I guided you through the basic installation of Linux Red Hat and since I have not received a single complaint / question I assume everything went fine for everyone. This time I will outline some of the methods to get your Linux box connected to the Internet, again remember I am just scratching the surface, the wide variety of things you can do with a PPP connection can cover a complete book, also since the article is already threatening to be long, I will be a bit terse in my explanations, you are strongly advised to read further.

Need to Know and Assumptions

It is assumed that you know your ISP's login prompt (login / Username / Account) and the password prompt (usually password) the phone numbers to dial, the IP addresses and names of his primary Domain Name Server (there can be more than one DNS) I will also assume that your ISP assigns your IP address dynamically as it most common to do so. (If not ask me what to do). Plus you also should know on which port your modem is connected.

Simple Method

Where is the modem - tell Linux

If your modem is an external one, connected to Com1 in DOS, then it is visible as /dev/cua0 to Linux, or, if it is Com2, as /dev/cua1.

It's a good idea to set up a symlink to a special file called modem, which your dialling program talks to. To do this at the console or Xterm, go to your /dev/ directory, and type ln -sf /dev/cua0 /dev/modem. You then have to set its default group to uucp. Simply type chgrp uucp /dev/modem.

This is done so that any script or program which refers to /dev/modem automatically refers to the modem in your machine.

Editing the resolv.conf File

First make sure that you are logged in as root. Then look in the /etc directory for a file called resolv.conf. Open it in your favorite text editor (I prefer JED) and add the IP addresses of your ISP's DNS servers. If your ISP has more than one, enter them one below another like this:


Make sure that you use the IP addresses of your ISP not the ones given above, save this file.

Editing / Writing the PPP connection scripts

I will show here one of the simplest scripts possible for starting a PPP connection, by using the Chat program.

Chat is a small, but extremely powerful dialer used by almost all programs to set up a serial connection. It's used in conjunction with pppd, which is the PPP daemon. Again be sure that you are logged in as root operator. Type out the following using a text editor and save it with a name of your choice, it is nice to keep is something meaning full like myPPP-on:

/usr/sbin/pppd connect ‘chat -v "" ATDT550666 CONNECT "" account: TARIQUE :
password: MY_PASSWORD "" PPP' /dev/modem 38400 debug crtscts modem defaultroute

Replace 55066, TARIQUE and MY_PASSWORD with your dialup number, login name and password respectively. Here you will have to know the login prompt provided by your ISP (e.g., Username / login) for your script to work properly.

The script executes pppd, which in turn calls chat. Within the quotes are a series of expect/reply sequences that perform the authentication to login to the server. The last option defaultroute tells pppd to set up a default route to the Internet for all packets that are not destined for the local network. Save the script and make it executable (chmod +x yourdialerscript).

Alternatively you can also edit a copy of the ppp-on script found in the /etc/ppp directory or /usr/doc/ppp-2.xx/scripts directory (xx depends on which version you are using). These scripts allow dialing multiple phone numbers, automatic updating of your DNS and other features.

Starting and stopping PPP connections using scripts

That's simple - once the above script has been made executable just typing the script name from an Xterm window or console should start the PPP connection, once connected you can fire up your favorite browser (Netscape Communicator 4 came bundled with my CD) or Email Client or do whatever you want on the net.

For stopping the PPP connection use the ppp-off script in the /etc/ppp directory. This script works by finding your network interface (ppp0) and then using the kill command to kill the process ID of ppp0.

Simpler Method. - Using the control panel in Xwindows

You can set up your modem and a PPP interface using the tools in the Control panel of Red Hat distribution.

Start up X, and click on the Modem Configuration icon in the control-panel. Click on the Com port that your modem is connected to, save, and exit. Your modem is now set.

Now to set up a PPP interface, scroll down the list in the control panel, and click on the Network Configuration icon. To start with you should see your machine name and nameserver listed (if you installed one), which should show your machine's own IP address. Click on the Interfaces button. You should see two interfaces listed, one called lo or localhost, and another one called eth0 if you have an Ethernet card. Click on Add to add a new interface, and select PPP from the list that pops up. You will then be prompted for a phone number, login and password. Enter these as given to you by your ISP.

Click on Customize, and then on Communication. Enter your modem's init string and dialing command (ATDP for pulse, or ATDT for tone dialing). Click to enable the checkbox marked Debug Connection. This is important to help you debug your scripts later if anything goes wrong. In the box below you should see a line with the word ogin: and your login name in front of it, see if it is right. If not click on it to correct it, repeat the same for Password as well. If your ISP sends a different prompt than login it should be changed here. If your ISP expects you to type in something else e.g.., mode > ppp then you can add it here thus -

Select the last line (TIMEOUT line), and click on Insert. In the ensuing dialog box, type > for the expect entry, and ppp for the send entry. Click on Done. Finally click on the ‘~—' line and delete it. Save the entry, and your ready to go!

Simplest Method - Use a good X dialer

I use XISP, which is available from, http://users.hol.gr/~dbouras/ OR from my site http://www.nagpurcity.net/article/xisp-2.4p1-ix86.tar.gz (337Kb). This is a .tar.gz file you will have to first extract and then compile xisp. Oh! don't worry I will show you how it is to be done:

Presuming that the file is in directory temp:

tar xzf /temp/xisp-2.4p1-ix86.tar.gz -C /usr/local
cd /usr/local/xisp-2.4p1-ix86
make install

That should do it, now when in X Windows type xisp in Xterm to run . You will have to set up a few options though before you can actually dial. The Account Information menu under Options allows you to specify the various phone numbers you use to dial your ISP. You can enter each number separated by a ‘;'. You can also specify if you want the line to be automatically redialled if the connection drops.

Click on the Dialling and Login menu. Under the Automatic Login section, there are two columns marked expect and send. These are commands that have to be performed to allow you to login to the remote end once a connection has been established. Under the Expect column enter ogin, assword, and > on individual lines. In the corresponding rows of the Send column, enter your login name, password and ppp.

In the Communication Options menu, set your modem device (which should be /dev/modem if you have set it up as specified earlier). You can additionally set the baud rate, and whether it uses Tone or Pulse dialling, among other options.

Finally, click on the TCP/IP settings menu, and enable Dynamic Local address, Dynamic remote address, Add default route (important!!). Enable Support IP-Up/Down and enter the DNS IP address for your ISP here (Do not enable Support IP-Up/Down if you are going to be running a cacheing only nameserver. More about that in forth coming articles) Save your options, and you are ready to use XISP!

Click on Connect and you should see the script being executed in the dial-up window. It will cycle through the phone numbers in your list until a connection is made.

Further readings and recommendations

There it is - take your pick, freedom of choice is what Linux is all about. Whatever method you choose it would be a good idea to check your connection for first few times you dial out. Linux has got a rich repertoire of commands to do this like ifconfig, netstat, ping and route. Again I strongly advise you to read the related manual pages (use man commandname) for more information.

Also if you want to do more with Linux - read Robert Hart's PPP-HOWTO under /usr/doc/HOWTO directory and Al Longyear's PPP-FAQ under the /usr/doc/FAQ directory or the pertinent sections in Linux Network Administrators Guide, you will find a lot of handy hints here. You can also check up on news:comp.os.linux.networking, or news:comp.os.linux.setup newsgroups for specific information or tips on using PPP.

Last Tip - You have to be connected to the Internet when you configure your Netscape Email, took me some time to realize that one ;-)

Related items

Made to Measure : Apache Web Server Customization

Apache at your Web Service

Jump Start your Intranet Web Sites - Setting up Virtual Hosts on Apache

Linux #6 Stairway to Heaven? - Setting up your Linux Server as an Internet Gateway!

Linux with RPM

Linux #5 What's in a name? - Domain Name Server on Linux

Linux #4 "Setting up DHCP is not P2C2E"

Linux #3 "You teach best...."

Linux#1 A Red Hat to cover your a-- (oops!) head.

Feedback on 'Linux#2 Net Connection'

©2018 Martin Webb