Tải bản đầy đủ (.pdf) (32 trang)

Tài liệu Learning DebianGNU Linux-Chapter 11. Getting Connected to the Internet docx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (7.78 MB, 32 trang )

11. Getting Connected to the Internet
This chapter explains how to use Linux to connect to remote servers. First, it
explains how to use wvdial, a program that makes it easy to connect to the
Internet via a PPP connection provided by an ISP. Then, the chapter explains
basic TCP/IP network concepts that you must know in order to administer a
Linux system connected to the Internet or a local area network. So that you
can use your knowledge of TCP/IP effectively, the chapter explains how to
use pppconfig to configure and administer a system that connects to a
local area network and to a remote server via PPP. Next, the chapter
describes several popular network client applications available under Linux,
including a web browser and an FTP client. The chapter then describes the
use of minicom and seyon, which provide dial-out capabilities like those
of Window's hyperterminal. Finally, the chapter shows how to make a
PPP connection manually, by using minicom.
11.1 Connecting to the Internet
Most Internet service providers (ISPs) offer two primary types of service:
shell accounts and PPP (point-to-point protocol) accounts. Shell accounts
were more popular before the advent of the Web. A shell account lets you
use your computer much as if it were a virtual console associated with a
remote computer. You can type commands, which are interpreted by the
remote computer, and view the resulting output on your computer. Although
a few web browsers, such as Lynx, can operate via a shell account, they
don't generally support the highly graphical, multimedia pages which web
surfers have come to expect.
In contrast, a PPP account connects your computer directly to the Internet.
While your computer is connected to the Internet, you can use it to surf the
Web with your favorite browser. If your ISP allows, you can even run a web
server, providing pages that can be viewed by others around the world.
You can compare the two types of Internet accounts - shell and PPP - with
two kinds of postal service. Imagine that no mail carrier actually comes to
your home to pick and deliver mail. Instead, every time you want to conduct


postal business, you go to the post office. This resembles a shell account:
The computer that connects you to the Internet is remote, and every time you
want to do something on the Internet you must open a terminal, or telnet,
session to that computer. PPP, on the other hand, is like home delivery: The
Internet comes right to your doorstep, and your computer is literally placed
on the Internet by the machine at your ISP that you connect to.
Under Microsoft Windows, you use hyperterminal to access a shell
account and Dial-Up Networking to access a PPP account. Under Linux, you
can choose from among several programs that let you access a shell account.
The most commonly used programs are minicom and seyon. To access a
PPP account under Linux, you use the PPP daemon, pppd. The next section
describes how to use wvdial to make the process of establishing a PPP
connection simple.
11.2 Configuring Your Modem
Your modem is a peripheral device to Linux, like a CD-ROM drive, hard
drive, or a mouse. Your modem will be connected to a serial port, which
means that one of the serial devices in the /dev directory actually points to
your modem. You may notice that there's also a file, /dev/modem, which
serves as a placeholder for your modem. Initially this file doesn't point to
anything. To simplify your operations, so that applications like
minicomand seyon need only refer to /dev/modem, you can create a
symbolic link from the serial device connected to your modem to
/dev/modem.
To do so, login as root and issue the command:
ln -sf /dev/ttyS
X /dev/modem
where X is replaced by the number corresponding to the serial device that
points to your modem. Table 11.1 shows how the proper command
corresponds to the device by which your modem is known user DOS and
Linux.


Table 11.1: Command to Create /dev/modem
DOS Modem
Device
Linux Modem
Device
Command
Table 11.1: Command to Create /dev/modem
DOS Modem
Device
Linux Modem
Device
Command
COM1 ttyS0
ln -sf /dev/ttyS0
/dev/modem
COM2 ttyS1
ln -sf /dev/ttyS1
/dev/modem
COM3 ttyS2
ln -sf /dev/ttyS2
/dev/modem
COM4 ttyS3
ln -sf /dev/ttyS3
/dev/modem
11.3 Using wvdial
ISPs use a variety of dialogs to make a PPP connection. Often the most
difficult part of configuring your computer to make a PPP connection is
specifying dialog options consistent with those required by your ISP, which
may not be especially helpful in explaining the necessary options to you.

For example, most ISPs use one of three PPP login procedures: PAP
(Password Authentication Protocol), CHAP (Challenge-Handshake
Authentication Protocol), or ordinary user/password authentication. PAP is
currently the most popular of the three procedures. If you ask the tech
support person at your ISP what login procedure your ISP uses, the tech
support person may have no idea what you're talking about, because most
users run Microsoft Windows, and Windows Dial-Up Networking handles
the login procedure transparently.
The wvdial program transparently establishes a PPP connection in much
the same way as Windows Dial-Up Networking. It understands a variety of
possible dialogs used by ISPs. In most cases, it will analyze data sent by
your ISP and respond with the proper data in the format required by the ISP.
To use wvdial, be sure that you've established your nameserver
configuration, as described in Chapter 10, Setting Up a Linux-Based LAN.
Then, issue the following commands
route del default
wvdial &
The command generates quite a bit of output, which makes further use of
this virtual terminal distracting. The simplest solution is to switch to another
virtual terminal, by pressing Alt- n, where n stands for the virtual terminal
(1-7). Alternatively, you can direct the output of the command to a file, by
typing this command in place of the one given earlier:
wvdial 2>/tmp/wvdial.messages &
Of course, you'll need to consult the file if something goes wrong with
wvdial. Do so by using the more command:
more /tmp/wvdial.messages
Once your connection is up, you can browse the Web and access other
Internet services, as described later in this chapter. For now, simply verify
that your connection is working by issuing the command:
ping www.oreilly.com

The ping command should report that echo packets were successfully
received from the server. If not, check your nameserver configuration.
When you want to log off your ISP, issue the following command:
killall wvdial
11.4 PPP Client
The Linux PPP client lets your Linux system connect to the Internet via a
PPP server, much the same way Dial-Up Networking lets your Microsoft
Windows system do so. Behind the scenes, wvdial calls on the services of
the PPP client to connect to a PPP server. However, it's possible to use the
Linux PPP client directly, without the aid of wvdial. Doing so gives you
access to the many options provided by PPP, which can prove helpful if your
networking needs are too sophisticated to be met by wvdial's simple fire-
and-forget mechanism. Even if you're content with wvdial, you'll benefit
from understanding the PPP client. For example, you'll find it much easier to
troubleshoot PPP problems if you understand the functions performed by the
PPP client on behalf of wvdial.
11.4.1 Specifying PPP Options
The Linux PPP client requires several configuration files. Rather than build
these files manually, you can use pppconfig, a program that leads you
through a dialog and then creates the proper configuration files based on
your responses. Login as root, and issue the command:
pppconfig
Figure 11.1 shows pppconfig's main menu, which the program displays
whenever you start it. Notice that pppconfig lets you create a
connection - the term by which it refers to a complete set of configuration
parameters - but it does not let you edit an existing connection. To change a
connection, you must edit the configuration files manually. It's usually
simpler to forego editing a connection, creating a new connection instead.
Figure 11.1: The pppconfig main menu


To create a new connection, use the arrow keys to highlight Next or Create,
and then press Enter.
If pppconfig determines that the file /etc/resolv.conf does not exist or
does not specify one or more nameservers (DNS servers), it will display the
screen shown in Figure 11.2, which asks you to specify nameservers. You
should do so, therefore highlight Yes and press Enter.
Figure 11.2: Request to specify nameservers

Figure 11.3 shows the screen used to specify the primary nameserver. To
specify the primary nameserver, type its IP number and press Enter. Your
ISP should be able to tell you what IP number to specify.
Figure 11.3: Specifying the primary nameserver

You can also specify the IP number of a secondary nameserver, as shown in
Figure 11.4. Simply type the IP number and press Enter. Your ISP should
be able to provide you with the IP number of the secondary namesever; if
you don't know the IP number, leave it blank.
Figure 11.4: Specifying the secondary nameserver

Figure 11.5 shows the next screen displayed by pppconfig, which asks
for a name by which to refer to this connection. If your /etc/resolv.conf file
already specified one or more nameservers, pppconfig displays this
screen after its initial screen. Choose a connection name you'll be able to
recall, backspace over the default connection name, type your connection
name, and press Enter. You may find it convenient to use the domain name
of your ISP as the connection name.
pppconfig equivocates by sometimes referring to a connection,
sometimes to an ISP (Internet Service Provider), and sometimes to a
provider. The term connection is more accurate in this context, because you
may have several ways of connecting to a particular ISP - for example, the

ISP may have several dial-up numbers. Each way of connecting to an ISP
can be configured as a distinct pppconfig connection.
Figure 11.5: Specifying the connection (provider) name

Next, pppconfig asks what method your ISP uses to authenticate your
access to its network, as shown in Figure 11.6. PAP (Password
Authentication Protocol) is currently the most popular method; however,
some ISPs continue to use other methods. The technical support staff of
many ISPs cannot tell what authentication method their system uses. So, you
may have to guess; if so, initially guess PAP. If you find you cannot
establish a connection, you can try the alternative values. Select the desired
authentication method and press Enter.
Figure 11.6: Specifying the authentication method

Next, you must specify your login password, as shown in Figure 11.7. Type
the password and press Enter.
Figure 11.7: Specifying the password

Next, pppconfig asks you to specify some basic connection properties.
Press Enter to exit the Configuration screen and the Manager User
Configuration screen, shown in Figure 11.8, appears. Type the login
username assigned to you by your ISP and press Enter. Your login
username may differ from your actual username, so be sure to use your login
username.
Figure 11.8: Specifying the username

Next, you must specify the device that corresponds to your modem, as
shown in Figure 11.9. Type the name of the device file, paying careful
attention to capitalization, and press Enter.
Figure 11.9: Specifying the modem device


The program next asks whether you want it to establish a default route when
it makes a connection, as shown in Figure 11.10. You almost certainly do, so
accept the default choice - Enable Default Route - by using the arrow keys to
highlight Ok and pressing Enter.
Figure 11.10: Enabling a default route

Figure 11.11 shows the next pppconfig screen, which requests
information on your computer's network address (IP number). Most ISPs
assign your computer a different network address each time you establish a
connection. Some ISPs give you the option of having a static network
address, meaning that your computer's network address is always the same.
Figure 11.11: Specifying your computer's network address

Unless your ISP has assigned your computer a static network address,
simply press Enter. If your computer has a single static network address,
type the address followed by a colon and press Enter. If it has separate local
and remote network addresses, type the local address, a colon, and the
remote address; then press Enter.

×