📄 ch61.htm
字号:
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="127" ALIGN="LEFT">Close Window</TD>
<TD ALIGN="LEFT">Closes the current Document View window. If you have only one window open, the entire
application exits. Also available on the File menu.</TD>
</TR>
</TABLE>
When removing an extra window, such as an extra Browser window, remember to delete
or close the window. If you choose the Destroy option in your window manager, all
active sessions are destroyed.</P>
<P>The cursor in Mosaic or Netscape is generally a standard short arrow pointing
slightly to the left of 12 o'clock. The cursor changes its configuration depending
on where you are in the Document View window. It is the arrow configuration unless
it is pointing to a hyperlink. When the cursor rests on a hyperlink, it changes to
a small hand icon pointing to the left. When the cursor changes its configuration,
the hyperlink's URL is displayed in the information line. This URL tells you what
will be retrieved if you select the hyperlink. It also might tell you the format
of the document.
<CENTER>
<H3><A NAME="Heading36<FONT COLOR="#000077">Setting Up SLIP Connections</FONT></H3>
</CENTER>
<P>This section really belongs in a chapter by itself, but it's here because you
are most likely to run into these types of problems when trying to use your browser.
Setting up a SLIP connection is necessary if you are not already on the Internet.
To get a dialup SLIP connection, you have to use the /sbin/dip program. The dip stands
for Dialup Internet Protocol. For a dedicated connection, you should use the slattach
program.</P>
<P>If you are already connected to the Internet through another means, skip this
section entirely.
<CENTER>
<H4><A NAME="Heading37<FONT COLOR="#000077">dip</FONT></H4>
</CENTER>
<P>The dip program uses a script file to connect you to a SLIP account. You need
a SLIP account to use Mosaic or Netscape if you are connected to the Internet with
a serial connection. Using dip with a <TT>-t</TT> option can also let you run in
interactive mode for debugging, but in most cases you use it with a script file.</P>
<P>A script file is basically a file that handles your login and setup for you. You
invoke <TT>/sbin/dip</TT> with the script name as an argument. A sample script file
to work with my Internet SLIP account is shown in Listing 61.1. Your Internet provider
should provide a script for you. If it does not provide a script, ask for one.</P>
<P>Let's look at the sample script file in Listing 61.1.
<CENTER>
<H3><A NAME="Heading38<FONT COLOR="#000077">Listing 61.1. A sample dip script
file.</FONT></H3>
</CENTER>
<PRE><FONT COLOR="#0066FF">
main:
#
# Get the local and remote names for the network
#
get $remote remote
#
#
#
default
get $mtu 1500
port cua1
speed 38400
modem HAYES
flush
reset
send +++
sleep 1
send ate1v1m1q0\r
wait OK 2
if $errlvl != 0 goto error
send atdt5551212\r
if $errlvl != 0 goto error
# wait CONNECT 60
login:
sleep 3
wait login: 30
if $errlvl != 0 goto error
send johndoe\r
wait ord: 5
send doa+sol!\r
wait TERM 10
send dumb\r
wait $ 10
send dslip\r
wait Your 10
#
# get $remote remote
#
get $local remote
#
# Ask for the remote site's IP address interactively from the user
#
get $remote ask
# cannot do this dec $remote
done:
print LOCAL address is $local
print CONNECTED to $remote
print GATEWAY address $remote
default
mode CSLIP
goto exit
error:
print SLIP to $remote failed
exit:
</FONT></PRE>
<P>Listing 61.1 shows how to access an Internet service provider via a dialup SLIP
account. This script gives you an example of how to log into the remote system and
get your local address, and it even asks you for the remote IP address.</P>
<P>Normally, you run the SLIP script as root. You can set the permissions on the
files in <TT>/etc/dip</TT> for all user access and not have to run as root. For debugging
purposes, the <TT>-v</TT> option echoes all the script lines as they are executed.
The <TT>echo on</TT> and <TT>echo off</TT> commands in script files turn the echoing
on or off while executing. The <TT>-v</TT> option is like having the <TT>echo on</TT>
command set as the first line in the script file.</P>
<P>The modem command in the scripts for dip supports only the <TT>HAYES</TT> parameter.
You can set the speed with the speed command. For other parameters of your modem,
use the Hayes command set. For example, <TT>ate1v1m1q0\r</TT> sends the accompanying
string to the modem to initialize it.</P>
<P>You can send output to the modem (and remote host) with the <TT>send</TT> command.
To wait for a specific string, use the <TT>wait</TT> command with part of the string
you are waiting for. Beware, though, that if the string you are waiting for never
appears, you can hang forever. The <TT>sleep</TT> command simply pauses the shell
execution for the specified number of seconds. All variables for dip must be lowercase
and preceded with a dollar sign. The dip program recognizes the following special
variables:</P>
<PRE><FONT COLOR="#0066FF">$remote for remote host name
$rmtip for remote host IP address
$local for local host name
$locip for local host IP address
$mtu contains the MTU value for the connection.
 You get this value from your internet provider.
</FONT></PRE>
<P>The <TT>get</TT> command is dip's way of setting a variable. The following line
requests the name of the remote host from the user. The <TT>ask</TT> parameter tells
<TT>dip</TT> to prompt the user for the input.</P>
<PRE><FONT COLOR="#0066FF">get $remote ask
</FONT></PRE>
<P>The local address for this script is derived when you log into your service provider.
The remote host prints a string of the form <TT>Your IP address is </TT>zzz.yyy.xxx.www.
So the script waits for the <TT>Your</TT> string and then gets the last word on the
line. Some SLIP service providers assign you a different address every time you log
in, so you have to do this. The way to do this is as follows:</P>
<PRE><FONT COLOR="#0066FF">#
# Get local address from this string.
#
wait Your 10
get $local remote
</FONT></PRE>
<P>The <TT>default</TT> command tells dip to route all default message traffic points
to the SLIP link. The <TT>default</TT> command should be executed just before the
<TT>mode</TT> command.</P>
<P>The <TT>mode</TT> command recognizes either <TT>SLIP</TT> or <TT>CSLIP</TT> as
a parameter. CSLIP is the compressed SLIP mode. If all goes well, the dip program
goes into daemon mode. The dip program executes the ifconfig program to automatically
configure your interface as a point-to-point link.</P>
<P>Finally, to kill an existing dip process, you can use <TT>/sbin/dip</TT> with
the <TT>-k</TT> option. You should do this when you turn off your machine or log
out to free up your phone line.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading39<FONT COLOR="#000077"><B>NOTE:</B> </FONT>Read Chapter 43,
"Networking," to set your <TT>/etc/hosts</TT> file. Also, if you are not
familiar with the <TT>ifconfig</TT> and <TT>traceroute</TT> commands, read the man
pages for them. The ifconfig program configures and maintains kernel resident network
interfaces. The <TT>traceroute</TT> command is useful in tracking messages as they
come and go from your machine on the SLIP link. It is an invaluable tool for debugging.
<HR>
</DL>
<CENTER>
<H4><A NAME="Heading40<FONT COLOR="#000077">slattach</FONT></H4>
</CENTER>
<P>The <TT>slattach</TT> file is used to connect on a dedicated line to a remote
server. If your modem is on <TT>/dev/cua2</TT>, the command to configure a CSLIP
connection is run as root:</P>
<PRE><FONT COLOR="#0066FF"># slattach /dev/cua2 &
</FONT></PRE>
<P>You can put this in your <TT>rc.inet</TT> files if you like. If your service provider
does not support CSLIP, you can use the <TT>-p</TT> slip option to get the uncompressed
SLIP mode. Just make sure that you run the same mode as your service provider.</P>
<P>Then, you execute the following commands:</P>
<PRE><FONT COLOR="#0066FF"># ifconfig sl0 localhost pointtopoint myrichISP
# route add myrichISP
# route add default gw myrichISP
</FONT></PRE>
<P>The first command connects you as a point-to-point to a SLIP connection. (The
<TT>sl0</TT> is s ell zero.) The next two commands add the node <TT>myrichISP</TT>
(the Internet service provider) as the default route.</P>
<P>To kill this connection, you must issue the following commands:</P>
<PRE><FONT COLOR="#0066FF"># route del default
# route del myrichISP
# ifconfig sl0 down
# kill -9 (slAttachPID)
</FONT></PRE>
<P>In this case, <TT>slAttachPID</TT> is the process ID of the slattach process.
<CENTER>
<H3><A NAME="Heading41<FONT COLOR="#000077">Summary</FONT></H3>
</CENTER>
<P>If you can use Netscape, you can use just about any other browser. All browsers
are based on the same basic principles of retrieving and displaying a file by checking
the type of data in it. After you know how to navigate using URLs, surfing the Net
becomes a task of learning how to use the special keys for your browser to help you
customize its functions to best suit your needs.</P>
<P>The following items were covered in this chapter:
<UL>
<LI>Where to get Netscape for Linux, which versions to use, and how to debug common
problems in Mosaic.
<P>
<LI>How to install Netscape on your machine after you get the distribution via FTP.
<P>
<LI>What alternatives you have to Netscape as far as browsers are concerned: Mosaic
or Lynx, to name two.
<P>
<LI>A brief introduction to connecting your Linux node via SLIP to an Internet service
provider.
</UL>
<P>Happy surfin'.
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -