[Linux for Newbies]

Linux for Newbies, Part 8:
Connecting to the Internet

by Gene Wilburn

(The Computer Paper, March 2000. Copyright © Wilburn Communications Ltd. All rights reserved)


If you've followed the Newbies series this far you now have Linux installed, you've created some user accounts and you have X Window up and running. You have a general idea of how the Linux filesystem is laid out and you know how to edit a text file. You've battened down the security of your system, you can navigate around your system, and your confidence is increasing daily. Okay! Let's put it all together and take this puppy out on the road for a spin. Time to hook up your system to the Internet.

To connect to the Internet from home you will need an ISP account, a modem, and a dialup telephone line. If high-speed service is available in your residential area, you may elect to go the route of cable modem or ADSL modem instead, but in this column we'll concentrate on dialup.

First, make sure you have the right kind of modem. If you're in the market for a new modem, be sure to get a real modem, not a "Winmodem". Winmodems are lobotomized entities that require MS Windows to supply part of the processing that has been removed from the modem itself to make the modem cheap to manufacture. Winmodems do not work with Linux. Get the real deal. I prefer external modems myself, but you may prefer an internal. External modems have the advantage that they can be moved easily from system to system.

Terminology and Concepts

Dialup connections to the Internet use a protocol called PPP (Point-to-Point Protocol). PPP provides a temporary network connection to your ISP at low speed across the telephone line. During the time you are connected to your ISP, you are a node on their network and this is what gives you access to the Internet.

The Internet itself runs on a protocol called TCP/IP (Transmission Control Protocol/Internet Protocol). Every node on the Internet has a unique IP number, called an IP address. IP numbers are usually displayed as a set of decimal numbers arranged in quartets--e.g. 192.168.20.30. Each IP number also has something called a subnet mask, which looks something like 255.255.255.0. Most books on Linux include a chapter on TCP/IP networking which you can peruse for additional understanding of how TCP/IP networking works.

One of the things your ISP's PPP connect provides you with is a valid, unique IP address. These are taken from a pool of registered addresses that belong to your ISP.

To translate Internet site names back into numbers (the only thing TCP/IP actually understands), you need the help of Domain Name Services (DNS). DNS provides a network of lookup tables that will turn something like www.google.com back into 209.185.108.220 so your Netscape packets can find their way there. Every ISP provides you with a DNS server and at least one backup DNS server.

Now, on to the practical:

Checklist

In order to connect your Linux box to your ISP, you need the information your ISP provided you when you signed up for your account. Specifically, you will need to know the following:

Next you need to check to see if your modem is working under Linux. One of the best programs to use for this is minicom, a program similar to the old DOS version of Telix. Start by creating a symbolic link for your modem port. If your modem is on what DOS would call COM1, your Linux serial port is /dev/ttyS0. COM2 corresponds to /dev/ttyS1, COM3 to /dev/ttyS2, etc. To make things easier to remember, create a symbolic link called /dev/modem to your actual modem device driver. A modem is typically connected to COM2 so let's use that as our example. Logged in as root, go to the /dev directory and type:

Adjust the ttyS# number to match your modem port.

The alternative method of setting up your modem, if you have Red Hat Linux installed, is to run a program called mdmconfig. If you do it by hand, as in the preceding example, you will learn more.

Now fire up minicom and type AT. You should get OK in return. If you get OK, try dialing your ISP by typing ATDT NNN-NNNN (fill in the blanks - you may need to include a 9, to dial out from an exchange, and an area code in some regions). If you don't get an OK, you'll need to check your cabling if the modem is external. Also check the minicom settings to make sure it's trying to use /dev/modem as the correct serial port.

If you get a modem handshake (odd noises as your modem and your ISP's modem sniff each other out) and a connect, the basics are in place and you're ready to start configuring Linux to do PPP.

PPP the easy way: kppp

Setting up PPP has traditionally been one of the great hurdles for new Linux users, ranking right up there with installing Linux itself and setting up X Window. There are several programs now available that help you with this task, making the procedure nearly as easy as setting up PPP in Windows. You may elect to use gnomeppp or kppp on a freshly installed Red Hat system that has either GNOME or KDE included.

You may also want to explore two popular downloadable programs: xisp and ezppp. Both have good reputations. The Red Hat netconfig program also provides a menu-driven interface for setting up PPP and PPP setup can also be done through linuxconf, which works for both X Window and console-based setups. Because it's the best one I've seen, I'll focus on kppp.

If you are running KDE, log in to Linux as root, start your X Window KDE session, open a terminal window and type kppp at the prompt. When the kppp window appears, start by clicking on the Setup tab.

When the kppp program appears, click Account, New to create a new account. You must have at least one account set up. Enter the name of your ISP and the dialup number. (Check your ISP's website if you've misplaced your original instruction sheet.) There are three basic types of authentication for logging in to your PPP account: PAP, CHAP and script-based. Check with your provider to see which method they use. In my case, it's script-based.

Click the IP tab and check that it's set to Dynamic IP Address. Then click on the DNS tab to enter your ISP's DNS server addresses. Click the Gateway tab and check that it is set to Default Gateway.

If your ISP uses script-based logins, you'll need to click on the Login Script tab and create a script. Otherwise you're ready for the next step. Click OK to finish the Account setup.

Three last checks. Click on the Device tab to make sure that /dev/modem is the selected device. Then click on the Modem tab. Click Query Modem to see if it can pick up your modem settings automatically. Leave the other settings at their default values.

Finally, click on the PPP tab. Options you may wish to enable later in this section are Dock into Panel on Connect and Automatic Redial on Disconnect. For now, stay with the defaults.

That's it. If all is okay, you should be able to dial out to the world. If everything appears to be working, type something like ping www.yahoo.com to see if your packets are going across the Net.

If you run into difficulties, be sure to click on Help on the kppp setup program main screen. It provides excellent examples of more complex setups. If you're still having problems, see the Troubleshooting section at the end of this column.

PPP the hard way: scripting

If you're not running KDE or GNOME you'll either have to set up PPP through linuxconf or set up PPP the traditional way, through a series of scripts. Red Hat provides a good online tutorial on the linuxconf method of setting up PPP at www.redhat.com/support/docs/new.html. Click on "PPP Setup Tips".

The traditional method of setting up PPP involves creating a series of special script files. The best way to work your way through PPP scripting is to follow a good model in a beginning Linux book or the PPP-HOWTO, located in /doc/HOWTO on Red Hat systems. There's also a good online tutorial for this at www.knowplace.org/ppp.html called "The 5-minute Linux PPP HOWTO".

Troubleshooting

If you're lucky, things will work the first time you try them and you can say "that was a snap!" Be aware, however, that PPP setup doesn't always go smoothly on the first or even the second try. There are many factors involved, from modem to ISP authentication procedures to permissions on files.

If you have access to the Internet, your best bet if you're having setup difficulties is to try one of the relevant newsgroups or mailing lists. Red Hat maintains a mailing list devoted exclusively to PPP problems and troubleshooting. You can subscribe by entering subscribe as the subject and sending an email to redhat-ppp-list-request@redhat.com. You may also want to try one of the Internet newsgroups such as comp.os.linux.networking or linux.redhat.misc.

Good luck, and I hope to see you on the Net!

Next time: Internet mailers

Gene Wilburn (gene@wilburn.ca) is a Toronto-based IT specialist, musician and writer who operates a small farm of Linux servers.

-30-