⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0164-0166.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:






<HTML>

<HEAD>

<TITLE>Sams Teach Yourself Linux in 24 Hours:Connecting to the Internet:EarthWeb Inc.-</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!-- ISBN=0672311623 //-->

<!-- TITLE=Sams Teach Yourself Linux in 24 Hours//-->

<!-- AUTHOR=Bill Ball//-->

<!-- PUBLISHER=Macmillan Computer Publishing//-->

<!-- IMPRINT=Sams//-->

<!-- CHAPTER=10 //-->

<!-- PAGES=0161-0172 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->







<P><CENTER>

<a href="0161-0163.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0167-0169.html">Next</A>

</CENTER></P>



<A NAME="PAGENUM-164"><P>Page 164</P></A>





<P>

If you say &quot;Neither. I'm using Linux,&quot; and the response you get is a blank stare, dead

air on the phone, or &quot;What's Linux?&quot; don't panic!

</P>



<P>You may get lucky. As Linux grows in popularity, many ISPs in the U.S. and around

the world recognize and support Linux users. If your ISP is aware of Linux, ask for

the minimum system requirements, any setup guides, or install tips. The CD-ROM with

this book contains the latest, stable releases of the software you need, so you won't have to

worry anyway.

</P>



<P>Assuming that your ISP doesn't know about Linux, here's what you need from your ISP:

</P>



<UL>

<LI>          Your account information: username (login name) and password, so             you canlog into your ISP's computer.

<LI>          Your ISP's modem connect number(s), so you can connect.

<LI>          Whether your ISP assigns you a static Internet Protocol (IP) address,

or assigns your IP address dynamically (the examples in this hour assume dynamic

addresses, but show you where you can make changes for a static IP address).

<LI>          The IP addresses and names of your ISP's primary Domain Name Server

and secondary domain name server. This information will go into the

/etc/resolv.conf file (as explained in the section &quot;Editing the

resolv.conf File&quot;).

          These addresses will be in the form of four 8-bit numbers, and will look

something like: 205.198.114.1 or 205.198.114.20. These will be the address

or addresses of the servers used or maintained by your ISP that (among

other things) translate hostnames, such as

sunsite.unc.edu, into numeric IP addresses, so you can connect, query, or address other computers and users around

the world. This section doesn't go into the details about the mechanics of IP

addressing, and this book doesn't cover all aspects of networking under Linux.

<LI>          The name or IP address of your ISP's

mailserver, so you can send and retrieve mail. You'll need this information in Hour 11, &quot;Configuring Internet Email.&quot;

<LI>          The name or IP address of your ISP's

news server, so you can read Usenet news and subscribe to newsgroups. You'll need this information in Hour 12,

&quot;Configuring Internet News.&quot;



</UL>



<P>Finally, ask for the Uniform Resource Locator, or URL, of your ISP's World Wide

Web home page, if it exists. You may find technical bulletins, help files, or other

information that may help in troubleshooting connections.

</P>



<H3><A NAME="ch10_ 7">

Setting Up a PPP Connection

</A></H3>



<P>Armed with this information, you'll now learn how to specify your ISP's DNS server and

how to create or edit your connection script,

ppp-on. Although specifying your ISP's DNS

</P>





<A NAME="PAGENUM-165"><P>Page 165</P></A>







<P>

server(s) isn't necessary to initiate or maintain your connection, you'll need

this information in place during the next hour, when you learn about Internet email.

</P>



<H4><A NAME="ch10_ 8">

Editing the resolv.conf File

</A></H4>



<P>This is a simple process. First, make sure that you're logged in as the operator. Then

look in the /etc directory for a file called

resolv.conf. If it's there, open it with your favorite text

editor (see Hour 14, &quot;Text Processing&quot;) and add the IP addresses of your ISP's DNS servers.

If your ISP has only one, that's okay. If your ISP has more than one, that's okay, too.

Enter the lines, using this format:

</P>



<!-- CODE SNIP //-->

<PRE>

nameserver 205.198.114.1

nameserver 205.198.114.20

</PRE>

<!-- END CODE SNIP //-->



<P>Then close the file. That's all there is to do! Next, you'll create or edit a script you can

use to start a PPP connection.

</P>



<H4><A NAME="ch10_ 9">

Editing the PPP Connection Scripts

</A></H4>



<P>Before you start, you should know that using this script is only one way to start a

PPP connection. You can use this approach, which requires you to be logged in as

the root operator; a much simpler approach, which I'll show you later; or other, more

complex approaches, using wrapper programs or setting options in

pppd's /etc/ppp/options file (which is parsed when the

pppd daemon first starts).

</P>



<P>I won't go into the detailed methods, because I want to outline the simplest approaches

for you and get you on line quickly. But when you get a working connection, I suggest that

you look at pppd's manual pages, Robert Hart's

PPP-HOWTO under the /usr/doc/HOWTO directory, Al Longyear's PPP-FAQ under the

/usr/doc/FAQ directory, or pertinent sections in the

Linux Network Administrators Guide.

</P>



<P>The first thing you should do is to make sure that you're logged in as the root

operator. Then, look in the /etc/ppp directory for a file called

ppp-on. If it's there, make a copy (you can call it anything you want), or rename

ppp-on to ppp-on.org. If ppp-on isn't there, copy it from

the /usr/doc/ppp-2.20f-3/scripts directory. Listing 10.1 shows you parts of the script, written by

Al Longyear:

</P>



<P>Listing 10.1. The ppp-on connection script.

</P>



<!-- CODE //-->

<PRE>...

TELEPHONE=555-1212     # The telephone number for the connection

ACCOUNT=username        # The account name for logon (as in `George Burns')

PASSWORD=password     # The password for this account (and `Gracie Allen')

LOCAL_IP=0.0.0.0     # Local IP address if known. Dynamic = 0.0.0.0

REMOTE_IP=0.0.0.0     # Remote IP address if desired. Normally 0.0.0.0

...

DIALER_SCRIPT=/etc/ppp/ppp-on-dialer

...

exec /usr/sbin/pppd lock modem crtscts /dev/modem 57600 \



</PRE>

<!-- END CODE //-->



<A NAME="PAGENUM-166"><P>Page 166</P></A>





<!-- CODE SNIP //-->

<PRE>

     asyncmap 20A0000 escape FF $LOCAL_IP:$REMOTE_IP \

     noipdefault netmask $NETMASK defaultroute connect \

        $DIALER_SCRIPT &amp;

</PRE>

<!-- END CODE SNIP //-->



<P>You need to change several parts of this script. For the most part, you need to make

only a few changes. Some of the critical elements are

</P>



<UL>

<LI>          TELEPHONE&#151;Enter your ISP's modem connect number here.

<LI>          ACCOUNT&#151;Enter your username or login name (usually assigned by your ISP).

<LI>          PASSWORD&#151;Enter your password here (usually assigned by your ISP).

<LI>          DIALER_SCRIPT&#151;The complete pathname of your dialing script, which uses

the pppd daemon's companion chat program. The chat program does the

dialing, connecting, and login for you. If you can't find a copy of this script, which

is called ppp-on-dialer, look under the

/usr/doc/ppp-2.2.0f-3/scripts directory. (Listing

10.2 shows the ppp-on-dialer script.) Note that if your ISP's computer doesn't present

a login: and password: prompt, you'll have to change the

login: and password: strings in this script to match the ones from your ISP.

</UL>



<P>Listing 10.2. The ppp-on-dialer dialing script.

</P>



<!-- CODE //-->

<PRE>...

exec chat -v                                            \

        TIMEOUT         3                               \

        ABORT           `\nBUSY\r'                      \

        ABORT           `\nNO ANSWER\r'                 \

        ABORT           `\nRINGING\r\n\r\nRINGING\r'    \

        `'              \rAT                            \

        `OK-+++\c-OK'   ATH0                            \

        TIMEOUT         30                              \

        OK              ATDT$TELEPHONE                  \

        CONNECT         `'                              \

        login:            $ACCOUNT                        \

        password:        $PASSWORD

</PRE>

<!-- END CODE //-->



<P>Next, examine the pppd command line in the ppp-on

script, and change /dev/modem to match the device your modem is connected to. If you want, you can use the approach

outlined in Hour 9, &quot;Using Communications Programs,&quot; to make a symbolic link from

your modem's serial port to /dev/modem. Here's a tip: If you have a 14.4 modem, use 19200

as the numeric value; if you have a 28.8 or 33.6 modem, try 57600. You may be able

to connect at a faster speed, especially with newer modems.

</P>



<TABLE BGCOLOR=#FFFF99><TR><TD>TIME SAVER</TD></TR><TR><TD>

<BLOCKQUOTE>

If your ISP assigns IP addresses automatically (dynamic IP addresses, or addresses that may be different each time you log in), you're all set. But if

you 

</BLOCKQUOTE>

</TD></TR></TABLE>





<P><CENTER>

<a href="0161-0163.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0167-0169.html">Next</A>

</CENTER></P>











</td>
</tr>
</table>

<!-- begin footer information -->









</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -