Whether you use your
to play games or to write letters, chances are you're going to want to
connect to the Internet to use the Web or send and receive e-mail.
That's the topic for this month: Getting connected.
Whether you use your
to play games or to write letters, chances are you’re going to want to
connect to the Internet to use the Web or send and receive e-mail.
That’s the topic for this month: Getting connected.
Internet Service Providers
Finding an ISP is not difficult. The Internet landscape is replete
with ISP offerings. There are local ISPs, national companies, phone
companies — even cable companies are offering Internet services. The
going rate for unlimited access is $20 per month. Some charge more,
others less, so shop around.
Most ISPs will give you an information kit when you sign up, but
unfortunately the information they provide is almost always for Windows.
I’ve yet to encounter an ISP that has an information package for Linux.
But never fear, you can get by on your own.
When you sign up for service, make sure you get the following
information from your ISP:
* Your login name (username) and password.
* The access number to dial your ISP.
* Your ISP’s DNS or Name Server Address (often there will be
two: a primary and secondary DNS address). The address is a series of 4
numbers separated by a dot (It will look something like 184.108.40.206).
* The name of your ISP’s news server (It will be something
like news. yourisp.net).
* The name of your mail server. Some ISPs provide two: one
for incoming mail and another for outgoing mail. They will be called
something like mail.yourisp.net and smtp. yourisp.net.
The relationship between your Linux machine and your ISP is fairly
simple. Your ISP has a computer that takes orders from your computer
such as “give me my mail,” or “get me the Web page at
http://www.linux-mag.com.” Your computer and the ISP’s computer are able
to have this conversation because they are using a common protocol. A
protocol is just a standardized method for exchanging information. The
one most commonly used between an ISP and its customers is PPP
(Point-to-Point Protocol). There’s also another protocol which was
popular a few years ago named SLIP (Serial Line Interface Protocol).
Most ISPs offer PPP and so I’ll assume you’re using it.
|Figure 1: Starting linuxconf. |
To configure PPP, you need to modify several files. With Red Hat
Linux you get a program that will do all of the work for you. This
program is called linuxconf.
Log on to your computer as root andstart X Windows. Open whatever
shell window you wish and type the command linuxconf
&. You will get a display similar to Figure 1
(I’m using the AfterStep window manager; you can use any window manager
you like. See our story on pg. 42 for more on window managers).
Follow the menu selections to “Config -> Networking -> Client
tasks -> PPP/SLIP/PLIP.” Note that the display to the right of the
scrollbar changed. On the right side click on the “Add” button and then
select “PPP” and then “Accept” as shown in Figure 2.
|Figure 2: Select “PPP” then “Accept”. |
Now, just fill in the information fromyour ISP: access telephone
number (be sure to include “9″ if you need that to get an outside line),
login name (your “username”), and password. Note that your password will
be shown in plain text, so if you want to keep it private then make
sure you’re aware of who’s standing behind you while you type. The
correct name for your modem portshould be /dev/modem; if it isn’t, then you’ll have to change
it to the proper port (remember that Windows’ COM1: becomes /dev/cua0 under Linux, COM2 becomes /dev/cua1,
If your ISP requires PAP, (Password Authentication Protocol) then
check that box and select “Customize.” Now select the “PAP” tab and
enter the “Username” and “Secret” that your ISP provided. If they didn’t
tell you anything about PAP, don’t worry about it because they probably
don’t use it.
When you’ve finished, click the “Accept” button at the bottom of the
pagewith the “PPP interface ppp0″ tab. This will now return you to the
page with the “PPP/Slip/Plip configurations” tab at the top.
Your Communications Setup
Click on “ppp0″ in the “Configurations” area and the right side
display will change again [See Figure 3].
|Figure 3: Configuring ppp0. |
Next, select the “Communication” tab [See Figure 4].
The important thing on this page is a series of boxes labeled
“Expect” and “Send.” When your computer reaches the ISP’s computer it
must automatically log in and then start a dialog.
Your computer will expect certain prompts from the ISP, and sends
back predetermined answers. This happens without your assistance, so if
your computer receives a prompt that it did not expect, then you can’t
step in to help.
As you can see, the dialog is already filled in and is probably
correct, so you shouldn’t need to change anythingon this page. If you
have trouble connecting, then this is where you’ll come to fix it.
|Figure 4: Configuring PPP communication.|
Click on “Accept” to return to the “PPP/Slip/Plip configurations”
page, and then select “Quit” to finish.
Configuring the Network
So far, you’ve enabled PPP and set up your computer to call your ISP
and log on. Now you’ll have to tell your workstation how to use your ISP
to connect to the Internet and send and receive e-mail.
From the left side menu select “Config -> Networking -> Client
tasks -> Basic host information.” On the right side select “Adaptor
1″ (yes, it is spelled wrong). Be certain that the “Enabled” box is
checked and check the “Dhcp” box as well. Now go to the line labeled
“Net device,” and on the right side you should see an arrow pointing
down. Click on that and a menu should drop down below it. Select the
item “ppp0.” Now click “Accept” to leave this page.
On the left side menu select “Config -> Networking -> Client
tasks -> Name server specification (DNS)” [See Figure 5].
|Figure 5: Resolver configuration. |
Earlier, I listed the information you’dneed to get from your ISP.
We’ve already used the phone number, username, and password. Here’s
where we make use of the DNS information. In the “nameserver 1″ field
enter the four dot-separated numbers you received (it will look
something like 208.25. 60.124). If your ISP
gave you a secondary DNS address, then enter the second one in the
“nameserver 2″ field. Make sure that the “DNS usage” box is checked, and
then click “Accept.” Finally, click “Quit” at the bottom left to leave
You now have your computer configured to talk to the Internet. You
can activate the connection and make your computer call your ISP from
within linuxconf, but there’s an easier way with Red Hat Linux. Go back
to your shell window and type the command usernet
& and you should see a window like the one in Figure
|Figure 6: Usernet. |
Click once on the “ppp0″ button to make your computer call your ISP.
The red box will turn yellow and you should hear your modem dialing out.
If the connection is successful then the yellow box will turn green.
This may take several seconds, so be patient. To hang up, press “ppp0″
again and the box will turn red.
If you can’t make the connection to your ISP then several things
could be wrong. Is the phone line connecting your modem to the wall
jack? Did you hear a dial tone? Did you hear your computer dial? Did you
get a busy signal? Did you hear the ISP’s computer, answer? Did you hear
several seconds of tones while the two computers connected?
Assuming that your computer did dial out and reach the ISP’s
computer, then it’s possible that the “Expect” and”Send” dialog we saw
earlier has gone wrong. The most common problem here is that your ISP is
not sending what your computer expects, and so we need to have a look at
You must edit a file to do this. The text editors that come with
Linux are very good, but will take a fair amount of explaining. For now
I recommend the vi (or vim
) editor. See the Using vim sidebar for a quick tutorial on
this. The file you need to edit is /etc/
sysconfig/network-scripts/ ifcfg-ppp0. In that file locate
the line: DEBUG=”no” and change the word no to yes. Save the file
and exit the editor.
The vi editor has been around for years. The version that comes with
Red Hat Linux is actually named vim (for vi iMproved). You can use
either command — vi or vim — they’ll both get
you to the same editor.
Vi is a modal editor. It has an insert mode and a control mode. Its
normal mode is control, which means that when you type, you are not
entering text into the file, but instead are sending commands to the
editor. Most vi commands are a single letter. When you give the editor
the i (insert) command then the mode changes and everything
you type is inserted into the file. This is something that is often
despised about vi. Some folks find all this switching between modes
confusing. Vim has tried to clean things up a bit by displaying the word
INSERT a the bottom of the screen if you’re in insert mode.
No matter what mode you’re in, the “Esc” key will put you in control
mode. If you’re ever uncertain of things, just hit “Esc.” If vi beeps in
response, it means that you were already in command mode. No harm done.
You start the editor with the command:
If you want to move the cursor around the screen in command mode, you
can use the keys “h”, “j”, “k” and “l” to move one position left, down,
up or right respectively. If you get yourself into trouble then press
“Esc” to return to command mode, and then :q! to leave the
editor without saving your changes.
Type /DEBUG and press “enter” to search for the word DEBUG.
Next, search for “no” by typing /no . The cursor should now be
over the word no in the DEBUG=”no” line.
Type cw , which means change word. See that the word
no disappears and you are now in insert mode. Type
yes and press the “Esc” key to end the insert mode.
Typing ZZ (note the capital letters) saves your work and
exits. That’s all there is to it.
Normally your computer puts brief messages about what it’s doing
into the file /var/log/messages. This change to
ifcfg-ppp0 tells your computer to put
everything that happens while it’s starting PPP into the message
Type the command tail-f /var/ log/messages.
This will show you any messages that are added to the end of the message
Now click on the “ppp0″ button in the “usernet” window. The window
where you typed tail will show you your
computer’s conversation first with your modem and then with your
|Figure 7: Debugging dialog.|
At first this looks like a lot of incomprehensible nonsense, but if
you take a moment to examine things, it should begin to make sense. tail is showing you the messages that your computer
expects, what it actually receives, and what it sends in response.
You can see in Figure 7 that at 21:03:17 my modem said to
CONNECT to my computer, meaning that it dialed
to my ISP and my ISP answered. Also at 21:03:17 my computer expects to
receive the word ogin:. The “l” is missing
because Linux, unlike some other operating systems, is case-sensitive. I
don’t know if my ISP will send me Login: (with
an upper case “L”) or login: (lower case “l”),
and it shouldn’t matter. At 21:03:22 there is the message –got it. My computer sends MyUserName. At 21:03:22 you can see that my computer
expects to receive password, and soon afterward
it does. In responsemy computer sends MySecretPassword.
What you’re looking for is a message from your ISP that your
computer does not expect. Perhaps your computer receives Welcome.Please enter your user name: instead of login:. When you can see the actual messages from
your ISP, you can return to the PPP configuration we saw in Figure
4 and correct the Expect/ Send sequence.
The tail -f command that you typed does not
stop on its own. To end that program, put the mouse into that window and
type “ctl-c” (press the “control” and “c” keys simultaneously). Don’t
forget to restore the “no” in the ifcfg-ppp0
If you’ve made it this far, then your computer can dial out to your
ISP and the red “ppp0″ box in “usernet” turns green. Now it’s time to
get your Web browser configured. The browser that comes with Red Hat is
Netscape Navigator. You can start Navigator by going to a shell window
and typing netscape &. You should also
find it in one of the pop-up menus (try moving the mouse to a vacant
area and click the left button, there will likely be a “Networking” menu
option under which you will probably find “Netscape Navigator”). If you
know how to configure Navigator for Windows, you should be okay here,
but you’ll notice that the Linux version does not have all the features
of its Windows counterpart.
Once Navigator is running, select “Edit -> Preferences” and a new
window will pop up. In that window, select “Mail & Groups” and then
“Mail Server” [See Figure 8]. There are three fields to fill in:
“Mail server user name” is the user name your ISP assigned to you; your
ISP should have provided the “Outgoing mail server” and “Incoming mail
server” names as well.
Also under “Mail & Groups” you can select “Identity.” Fill in
your name and your e-mail address so that your mail has the correct
When you’re finished with this configuration click on the “OK”
To send and receive e-mail select “Mailbox,” which is probably under
“Communicator” on your toolbar.
|Figure 8: Configuring Netscape mail.|
You’re now set up to surf the Internet with your Netscape browser,
and also use it to send and receive e-mail. There are other mail
programs available (Elm and Pine are two popular ones), however at this
stage Netscape is the easiest to configure. Have fun on the Internet.
I’ll see you next month.
Hal Moroff has been developing Unix systems and applications for
over 20 years. He’s new enough to Linux that he’s finding new things
every day. He can be reached at firstname.lastname@example.org.