Linux
by Kamran Husain
IN THIS CHAPTER
- A Brief Introduction to Browsers
- Getting Navigator for Linux
- Getting Around
- Help!
- Selection of Preferences
- Bookmarks
- Directories Used
- Reading News
- Handling Mail in Navigator
- Where to Get Mosaic for Linux
- Using Mosaic
- The Icons in Navigator and Mosaic
- Setting Up SLIP Connections
This chapter is a brief introduction to Netscape and Mosaic. We will cover the following
topics in this chapter:
- How to get and set up Netscape for your Linux machine.
- How to get and set up Mosaic for your Linux machine.
- How to configure a SLIP connection for dialup and dedicated lines using Linux.
To access the services on the Web, you need a browser. A browser is an application
that knows how to interpret and display documents it finds on the Web. Documents
on the Web are encoded in the Hypertext Markup Language (HTML). Hypertext documents
contain special codes that tell the browser how to locate information on the Web.
How the browser interprets the codes is left as a local issue. Some browsers, such
as Lynx, ignore any requests for inline images; some older Mosaic browsers ignore
the interactive forms that a user can fill in while online. Newer versions of Netscape's
Navigator are great for handling images, entry forms, animated images, and programs
like those in scripting languages such as VBScript and JavaScript.
Any browser you work with must have the following features:
- The capability to display plain text, HTML documents, and audio
- The capability to display inline graphics and images
- A reasonably customizable graphical user interface
- The capability to track previous sites with lists in a History and Hotlist
- The capability to find items via search commands within a document and over the
Internet
- Extendibility via third-party software items known as plug-ins
We will cover the Netscape Navigator and, briefly, the Mosaic browser from NCSA.
The emphasis in this chapter will be on Netscape because I think it is easier to
work with under Linux. If you are a die-hard fan of Mosaic, you will get enough information
from this chapter to be able to get and use it.
You need the following items to be able to run Netscape's Navigator on your Linux
machine: an Internet connection (serial or direct), about 10MB of disk space, 8MB
of RAM or better, and X Window running on your machine. Requirements for disk space
might be greater than what I have just quoted here because Navigator uses some disk
space for caching its files. More on that in a bit; let's get the program first.
The latest version of the Netscape Navigator, 3.01, is available free from the
ftp site at ftp.netscape.com. This is the directory to go to at ftp.netscape.com:
/pub/navigator/3.01/unix/
You might find several versions of the Navigator software for different types
of UNIX systems. Get the latest file with the word "linux" in it. You will
most likely get the version that applies to "unknown" and "x86."
-
TIP: You can try ftp5.netscape.com
or ftp6.netscape.com if you get a very slow response from ftp.netscape.com.
Use the string "*linux*" in the mget command. It's
about 2.33MB in a gzipped file, and it takes a some minutes to download, depending
on your connection. Here's an excerpt of a session:
ftp> mget "*linux*"
mget netscape-v301-export.x86-unknown-linux-elf.tar.gz?y
200 PORT command successful.
150 Opening BINARY mode ... <snip> ... (2338294 bytes).
After you get the file, you have to unzip it to get the distribution files, including
the README file. I prefer to rename the recently downloaded file to something
simple (myn.tar.gaz) to avoid goofy typing mistakes. Here are the commands
I used to unzip with the gunzip command and untar the distribution:
$ mv netscape-v301-export.x86-unknown-linux-elf.tar.gz myn.tar.gz
$ gunzip netscape-v301-export.x86-unknown-linux-elf.tar.gz
$ tar -xvf netscape-v301-export.x86-unknown-linux-elf.tar
It's a good idea to unzip the file in a directory by itself. This way, you know
which new files you are dealing with. Unzipping the file reveals a bigger tar file.
In the case of Navigator 3.01, the tar file was about 5.5MB, whereas the zipped file
was 2.3MB.
This is what the files in the 3.01 distribution look like (no doubt, later versions
will have different files, dates, and sizes):
$ ls
total 5385
-r--r--r-- 1 khusain users 12965 Oct 20 21:41 LICENSE
-r--r--r-- 1 khusain users 219640 Oct 20 21:38 Netscape.ad
-r--r--r-- 1 khusain users 9832 Oct 20 21:41 README
-r--r--r-- 1 khusain users 4674 Oct 18 1994 XKeysymDB
-r--r--r-- 1 khusain users 725156 Oct 20 21:41 java_301
-r-xr-xr-x 1 khusain users 5464 Oct 20 21:33 movemail
drwxr-xr-x 2 khusain users 1024 Oct 20 21:41 movemail-src
-r-xr-xr-x 1 khusain users 4505716 Oct 20 21:41 netscape
The movemail-src directory is really not required if you are on a Linux
machine or do not plan on using the mail handler in Netscape. Ignore it for now.
If you are tempted, get the README file in this directory for your mail
handler. Besides this, movemail is freeware and is included in Netscape in case you
run into problems locking mail files in Linux.
The directions in the Navigator README file are easy to read and self-explanatory.
Just copy the relevant files and binaries in known paths, and you are done.
The file that is very important to consider is the java_301 file with
the libraries for the Navigator software. If you are the only person on this machine,
great--just run Netscape from the directory into which you just untarred files. If
you have more than one user on the Linux machine, copy the java_301 file
into one of the directories listed in the README file.
Also, if you are upgrading from a previous version of Netscape Navigator, now
is a good time to remove any legacy files from this lib directory:
# rm /usr/local/lib/netscape/*
You have to be logged in as "root" to be able to do this. After cleaning
up older files, I chose to copy the file into /usr/local/lib/netscape:
# cp java_301 /usr/local/lib/netscape
A common problem with upgrading Navigator on Linux is that folks often forget
to copy the java_301 file to the expected directories. This results in their
crashing their newer version of Navigator with the use of an older Java library.
Be sure to take this step and have at it.
Finally, if you have any shortcuts in your window manager, you might want to point
these locations to the newer version of Navigator. An easier route is to simply remove
the old directory and untar in the new version in a new directory with the same name
as the old directory. If you are cautious, you can simply rename the old Navigator
directory to something else and then untar your files into the directory with the
original name. This way, you will preserve any previous links to "navigator."
Now you are ready to go. Type the following command to start the browser:
$ netscape &
The Netscape program took an inordinately long time to start on a DX4 running
at 100MHz with 32MB of RAM. You might have a different experience with a faster video
card. Maybe. In any event, you are presented with a license agreement as shown in
Figure 61.1. You might as well accept this license if you want to use the software.
It's not as if you have a choice, and you are not signing your life away. (You can
view the license in its entirety in the LICENSE file.)
FIGURE
61.1. The initial startup screen
for Netscape 3.01.
-
NOTE: To navigate the
web of information, start the transfer with a single click of your left mouse button
on the words or images shown in color or underlined, which are the hyperlinks between
documents.
The main scene when Navigator comes up is shown in Figure 61.1. Clicking anywhere
on the window forces the browser to load its default home page. The first thing you
will notice when using your new browser is that it defaults the home page to Netscape.
If you are not connected to the Internet, this might cause Navigator to wait for
a long time. You can easily stop the attempted transfer and set up a local file as
the default home page instead.
This is an annoying but easily fixed problem. Select Options | General Preferences.
You are presented with the dialog shown in Figure 61.2. In the Home Page Location
text field, change the text to http://localhost. This is, of course, assuming
that you have a local httpd server running on your machine. If you would rather open
a file, append the string file:// to the filename. For example, a possible
startup page for me could be /home/khusain/linux/book/index.html. Make sure
that the file and directory you set here are readable by Navigator. For example,
in the dialog shown in Figure 61.2, I have set the default home page to http://localhost
because I have an httpd server running on my machine.
FIGURE
61.2. Setting the default home page.
The other options available in this dialog include those relating to default fonts,
applications, and image display. Images can be displayed as they are being downloaded
or after they are completely downloaded.
One of the first things I noticed when I brought up Navigator was that I was missing
some fonts. The error messages were a bit annoying at first but were not really a
problem. I did, however, have a problem with my .xinitrc file, because I
was too stingy in loading fonts when starting X. I resolved the situation by adding
the following commands to load every font that I have installed on my system:
xset +fp /usr/lib/X11/fonts/misc
xset +fp /usr/lib/X11/fonts/100dpi
xset +fp /usr/lib/X11/fonts/75dpi
xset +fp /usr/lib/X11/fonts/Speedo
xset +fp /usr/lib/X11/fonts/Type1
The commands took care of "unresolved fonts" warning messages. If you
want to change the default appearance of the fonts, you can use the Appearance page
in the Options menu. A typical setup is shown in Figure 61.3. Change the font type
and so on to your liking; then click OK and you're done.
Ordinarily, you would not have to modify the default MIME types. Most of the default
MIME types supported by Navigator will let you get by just fine. If, however, you
want to add some default behavior, you might want to consider setting up your own
actions for a MIME type.
FIGURE
61.3. Changing the basic setup including
fonts.
If you want to know which MIME types are supported in this version of Navigator,
check out the list in the Helpers tab. The Unknown tag refers to something that is
not handled by this version of Navigator. If you have applications that you want
to spring into life when a MIME type is encountered, this Helpers tab is where you
would set it up. Among the options available is the capability to save the incoming
file to disk. For example, if you do not have a WAV listener on Linux, you could
force Navigator to "save to disk" when a WAV file is encountered. Only
a few of the most common MIME types are supported for Linux. Most MIME types that
are not supported in Linux belong in the Microsoft Windows realm. Oh, well. A typical
MIME setup is shown in Figure 61.4. Pressing the Edit button brings up the dialog
that lets you choose which action to take when a certain MIME type is encountered.
You can change the behavior of what Netscape has to do given a MIME type with the
dialog shown in Figure 61.5.
FIGURE
61.4. The default MIME types with Navigator.
FIGURE
61.5. Modifying the behavior for
a MIME type.
Alas, the backspace key did not work right in any of the text widget areas when
I used Navigator with Linux and X Window. This could be a local problem on my Linux
installation, so you might not have this experience. Instead of deleting the character
to the left of the cursor, the backspace key deletes the character to the right of
the cursor. Using the ever-handy Ctrl-H combination does the trick for me for the
most part. But it's irritating as heck to find the backspace working like the old
VT-100 keyboard's Delete key.
The quick solution for me was to map the Delete key to the same value as the backspace
key with the xmodmap command:
$ xmodmap -e "Delete = BackSpace"
After making this change, fire up Netscape from within this xterm. Now the backspace
should work correctly. The sad part is that the Delete key now works like the backspace
key. I told you this was a quick solution. I rarely use the Delete key when editing
text, so it's not a real problem for me. You, on the other hand, might consider this
an affront to programming. All is not lost...so far.
The Help menu lists a searchable list of items on Netscape. You'll find a query
and an answer for this very problem that suggests using the loadkeys program. In
my humble opinion, the loadkeys program is much too complicated to use for such a
simple task. Also, an incorrect use of the loadkeys program can lock up your keyboard
and require a power-up. It's up to you as to which version you want to work with.
-
TIP: Any options you
modify might get enforced immediately but are not necessarily saved to disk. You
must explicitly save these options with the Options | Save Options menu item. Play
it safe and save as often as possible.
Each underlined letter in a menu item is a shortcut to the action which that menu
item normally takes after the menu is open on your screen. (Again, this shortcut
worked on one Linux system and not on another. Your mileage may vary.) You must have
first selected a menu for the underlined shortcuts to work.
In Netscape, you can use the Alt key followed by the menu option to get the same
result. For example, Alt-N or Alt-n opens a new window, and Alt-F searches for text
in the currently viewed document.
The cut and paste features of Navigator do not work very well in Linux. Be careful
because sometimes the cut-and-paste operation crashes Navigator. You can select text
from the viewing area as though you are in a normal workstation or editor window.
Cut and paste into other X Window System windows as usual by pressing the left mouse
button to begin selecting text, and then holding down the button and dragging. Alternatively,
release the left mouse button and use the right mouse button to complete the selection.
See the details about this operation in Netscape's Help.
Speaking of Help, when you click on the Help menu, you can access a Frequently
Asked Questions list relating to your type of operating system. Search on the word
"Linux" and you should get some answers to basic problems that others have
faced with running Linux.
The only catch to this approach is that you must already be hooked up to the Internet
to be able to avail this feature. If getting to the Internet is the crux of your
problem, you will have to resort to some other venue to get help.
Nevertheless, the help in Netscape's archive is very helpful when you can get
to it. If you are using the Linux software from the back of this book, you needn't
worry about asking X11R5 questions, because you will be using X11R6. The rest of
the answers in the FAQ provide a quick insight on the level of Netscape's support
for Linux.
By the way, this is the URL to get help on Navigator directly:
http://help.netscape.com
The preferences you set for your Navigator software will be set in a file in a
special directory called .netscape in your home directory. The file with
your preferences is appropriately called preferences. Shown here is a list
of some of the options in this file:
# Netscape Preferences File
# Version: 3.01
# This is a generated file! Do not edit.
SHOW_TOOLBAR: True
SHOW_URL: True
SHOW_DIRECTORY_BUTTONS: True
SHOW_MENUBAR: True
SHOW_BOTTOM_STATUS_BAR: True
AUTOLOAD_IMAGES: True
FTP_FILE_INFO: True
SHOW_SECURITY_BAR: True
TN3270: xterm -e tn3270 %h
TELNET: xterm -e telnet %h %p
RLOGIN: xterm -e rlogin %h
RLOGIN_USER: xterm -e rlogin %h -l %u
MEMORY_CACHE_SIZE: 3000
DISK_CACHE_SIZE: 5000
CACHE_DIR: ~/.netscape/cache/
VERIFY_DOCUMENTS: 1
CACHE_SSL_PAGES: False
<<SNIP>> file deliberately cut to save a tree<<SNIP>>
FIXED_MESSAGE_FONT: False
ADD_URLS:
BOOKMARK_MENU:
PRINT_COMMAND: lpr
PRINT_REVERSED: False
PRINT_COLOR: True
PRINT_LANDSCAPE: False
PRINT_PAPER: 0
Heed the caution remark at the start of the file, and don't edit this file unless
you absolutely must--for example, if you accidentally overwrite it (a rare but not
an impossible thing for a dyslexic touch typist such as me). The preferences file
is rather long and is not really meant to be edited by the user. Your selections
in the Options menu and dialogs are reflected in the preferences file.
You can specify which types of menus you want to display by turning checkboxes
on or off in the Options menu. The location box should usually be kept open because
it allows you to directly type the URL of where you want to go. If you would rather
have the screen space, you can choose File | Open Location to get the dialog shown
in Figure 61.6. Local files can be retrieved via the Open File option.
FIGURE
61.6. The Open URL dialog.
Your favorite URLs can be saved as bookmarks. When you are at a location you would
want to come back to, just select Options | Add Bookmark. All your previous options
are listed in the drop-down list shown when you select the Bookmarks option.
The drop-down selection list can be very long and quite unmanageable. Also, items
are appended to the end of the list when you add a bookmark. This causes bookmarks
of different topics to be interleaved. You can use "folders" to manage
your bookmarks for you. A folder simply contains other URLs or folders. Navigator
provides an easy way to manage your bookmarks with its Bookmarks window. Choose Window
| Bookmarks. You are presented with a floating window from which you can drag and
drop entries into folders to create your own custom menus.
The History option on the Windows menu presents you with a window listing the
sites you have been to during your session. You can select items in this dialog to
add them to your bookmarks file. The bookmarks file can be saved as an HTML file
as well.
Navigator uses a .netscape directory in your home directory. This directory
includes the current lock files to prevent more than one Navigator application from
being used per user at one time. If you try to run Navigator while a lock file is
in place, it bails out with an error message. In the case of leftover lock files
from a crash or something, all you have to do is remove the lock file and restart
Navigator.
The .netscape directory contains several other files. Here is a directory
listing of these files:
$ ls -l ~/.netscape/
-rw------ 1 khusain users 296 Nov 29 07:16 address-book.html
-rw------ 1 khusain users 16435 Dec 10 08:04 bookmarks.html
drwx------ 34 khusain users 1024 Oct 13 20:23 cache
-rw------ 1 khusain users 4096 Aug 8 11:46 cert-nameidx.db
-rw------ 1 khusain users 13312 Aug 8 11:46 cert.db
-rw------ 1 khusain users 40960 Dec 9 16:11 cert5.db
-rw------ 1 khusain users 922 Dec 10 08:30 cookies
-rw------ 1 khusain users 1323008 Dec 10 08:30 history.db
-rw------ 1 khusain users 16384 Dec 9 16:11 key.db
lrwxrwxrwx 1 khusain users 19 Dec 10 07:30 lock -> 204.251.103.1:28668
-rw-r--r-- 1 khusain users 131 Jun 13 1996 mailcap
-rw-r--r-- 1 khusain users 101 Nov 17 10:41 newsgroups Âgenetics.upenn.edu
-rw-r--r-- 1 khusain users 139600 Nov 29 07:07 newsgroups-news.onramp.net
-rw-r--r-- 1 khusain users 21 Dec 10 07:30 plugin-list
-rw-r--r-- 1 khusain users 21 Dec 9 16:15 plugin-list.BAK
-rw-r--r-- 1 khusain users 3506 Dec 9 16:28 preferences
The HTML files are used to track your preferences such as bookmarks and the address
book. The lock link is present because I am already running Navigator. The preferences
are also listed here.
The cache directory is used to hold HTML files and images so that you do not have
to go to your network connection every time you reload a page. Navigator's cache
area can take up only a few megabytes. For example, in my machine, the du
command revealed that I use about 4.5MB of the cache area. The size of the cache
can be set with the dialog presented in the Network Preferences menu option in the
Cache tab. See Figure 61.7.
FIGURE
61.7. Setting the cache size.
The cache page also lets you flush the cache, thereby forcing Navigator to go and
retrieve the files from the network instead of using a local copy. Do not set the
cache size to an inordinately high value unless you have disk space to spare.
Netscape's Navigator comes with a great news reader. You can start it with the
Netscape News command on the Options menu. You are presented with the window shown
in Figure 61.8. Your Internet Service Provider should be willing to provide you with
a news feed for you to be able to read news. You have to set up the information for
the news server yourself. You can get the setup dialog via the Options | Preferences
menu item. The dialog for this initial setup for the news reader is shown in Figure
61.9. After you have set up the news server information, you can read the news with
the News button. The configured news servers are shown as icons in the pane for the
news reader. Double-click the icon for the server and get all the messages for newsgroups
on that server. Messages that are received for a newsgroup are displayed by subject,
as shown in Figure 61.10. Click on the subject line for each message to read its
contents in the bottom pane.
FIGURE
61.8. The initial news reader.
FIGURE
61.9. Setting up the news server information.
FIGURE
61.10. Reading messages in a newsgroup.
The Navigator program provides for a pretty darn good mail handler in itself.
Figure 61.11 shows the default mail handler screen. You have to set up your own personal
items for this mail handler to work right. Choose the Options | Mail and News Preferences
menu item. You are presented with the dialog shown in Figure 61.12. The options you
set up for your mail address are found in the page for the Identity tab.
FIGURE
61.11. The Mail Handler screen.
FIGURE
61.12. Setting up your identity for your
mail handler.
The latest version is available from the Internet at the ftp site sunsite.unc.edu
in the directory /pub/Linux/system/Network/info-systems/www/Mosaic. Several
files can be found there, the latest of which was the May 31, 1995, version, Mosaic-linux-2.62b.Z.
Get the latest version, if any, for Linux and unzip and untar it in a separate directory.
(The 2.72 version was not specifically named as having been built for Linux, and
therefore I cannot recommend it at this time.)
After the dust settles from the extraction commands, you have the Mosaic file
in your directory. You also have some app-defaults files you can use to customize
your copy of Mosaic. As with other X applications, almost all of Mosaic's features
can be customized using the Xdefaults file with the Mosaic resource.
It's easier, however, to use the application's menus to set the items in the Xdefaults
file than to manually edit it. For example, to set the home page, use this line:
Mosaic*HomePage : "http://www.ikra.com"
Alternatively, you can set the WWW_HOME environment variable to the path
previously shown. Or you can use the menu items to set the home page. Using the environment
variable is more consistent with other UNIX platforms. Using the menus and dialogs
is a whole lot easier. The distributions from NCSA include the app-defaults files
for each version of Mosaic. After you have installed Mosaic on your machine, edit
these files to customize your own files. Read the app-defaults files for all the
resources that are available to you for your version of Mosaic.
Now, you can fire up Mosaic from within an xterm with the command Mosaic.
(It's probably best to have Mosaic run in the background so that you won't tie up
your xterm.) When Mosaic is up, it attempts to load its default hypertext document,
called the Home Page. Basically, the Home Page is the first document you start with
and the one document that you know you can always load if you get lost while browsing
the Web.
Like Navigator, Mosaic lets you keep a history of where you've been. You now have
quick access to frequently used documents via two types of personal lists. History
lists are valid for a current session only. Hotlists are those lists you want to
keep for all future sessions.
-
TIP: If you want to use
a text-only browser to get faster access to data instead of looking at images, use
the Lynx browsers. In the sunsite.unc.site, get the lynx2-6.color.ELF.tgz
file for the latest version.
The Mosaic Document View screen is where you see all the HTML documents on the
Web. The Document View window has six pull-down menus: File, Options, Navigate, Annotate,
News, and Help. The main portion of the screen is taken up by the viewing area for
the data. Mosaic shows the title of the document and its URL under the menu bar.
In the upper-right corner of the Mosaic screen is a globe superimposed on a stylized
S. In Netscape, it's an image of a planet with an N on it. This is the official logo
for NCSA Mosaic. This icon serves two purposes in each browser:
- When a hyperlink is activated by a click on the word or image, the globe spins
and beams of light travel along the segments of the S toward the globe. This movement
signifies that your document is being retrieved. This is analogous to the stars in
the Netscape Navigator icon, which shows animated meteorites and stars.
- You can stop a transfer by clicking on the globe icon. The beams of light usually
stop when you do this, which in turn indicates that the current transfer has been
aborted. In Netscape, clicking the icon warps you to Netscape's home page. You have
to use the STOP icon to stop message transfer in Netscape.
The status line in the browser then displays a message. If part of the file was
already retrieved without the inline images, the Document View window contains the
new document; click the Back button at the bottom of the window to return to the
document containing the hyperlink.
The following list discusses some common actions you might take when using a browser:
Back |
Returns to the previous document in the Document View window history. |
Forward |
Returns to the document that preceded the current document. This button is dimmed
if you have not moved backward yet. |
Home |
Moves to your home document or home page. |
Reload |
Reloads the current document from the server or sometimes the cache. |
Open Location |
Opens the Open Document window to enter the URL for a file to be viewed. |
Open File |
Opens the Open Document window to enter the pathname for a file to be viewed. |
Save As |
Opens the Save Document window that lets you save the current document to your local
system in different formats: HTML, Postscript, or text. |
Save Frame |
Lets you save the contents of a frame rather than an entire window. A frame is a
portion of the screen. |
New Window |
Opens a new Document View window. The content of the new window is your default home
page. You can have several instances of browsers running in one session, each pointing
to a different URL. |
Close Window |
Closes the current Document View window. If you have only one window open, the entire
application exits. Also available on the File menu. |
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.
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.
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.
If you are already connected to the Internet through another means, skip this
section entirely.
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 -t option can also let you run in
interactive mode for debugging, but in most cases you use it with a script file.
A script file is basically a file that handles your login and setup for you. You
invoke /sbin/dip 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.
Let's look at the sample script file in Listing 61.1.
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:
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.
Normally, you run the SLIP script as root. You can set the permissions on the
files in /etc/dip for all user access and not have to run as root. For debugging
purposes, the -v option echoes all the script lines as they are executed.
The echo on and echo off commands in script files turn the echoing
on or off while executing. The -v option is like having the echo on
command set as the first line in the script file.
The modem command in the scripts for dip supports only the HAYES parameter.
You can set the speed with the speed command. For other parameters of your modem,
use the Hayes command set. For example, ate1v1m1q0\r sends the accompanying
string to the modem to initialize it.
You can send output to the modem (and remote host) with the send command.
To wait for a specific string, use the wait 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 sleep 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:
$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.
The get command is dip's way of setting a variable. The following line
requests the name of the remote host from the user. The ask parameter tells
dip to prompt the user for the input.
get $remote ask
The local address for this script is derived when you log into your service provider.
The remote host prints a string of the form Your IP address is zzz.yyy.xxx.www.
So the script waits for the Your 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:
#
# Get local address from this string.
#
wait Your 10
get $local remote
The default command tells dip to route all default message traffic points
to the SLIP link. The default command should be executed just before the
mode command.
The mode command recognizes either SLIP or CSLIP 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.
Finally, to kill an existing dip process, you can use /sbin/dip with
the -k option. You should do this when you turn off your machine or log
out to free up your phone line.
-
NOTE: Read Chapter 43,
"Networking," to set your /etc/hosts file. Also, if you are not
familiar with the ifconfig and traceroute commands, read the man
pages for them. The ifconfig program configures and maintains kernel resident network
interfaces. The traceroute 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.
The slattach file is used to connect on a dedicated line to a remote
server. If your modem is on /dev/cua2, the command to configure a CSLIP
connection is run as root:
# slattach /dev/cua2 &
You can put this in your rc.inet files if you like. If your service provider
does not support CSLIP, you can use the -p slip option to get the uncompressed
SLIP mode. Just make sure that you run the same mode as your service provider.
Then, you execute the following commands:
# ifconfig sl0 localhost pointtopoint myrichISP
# route add myrichISP
# route add default gw myrichISP
The first command connects you as a point-to-point to a SLIP connection. (The
sl0 is s ell zero.) The next two commands add the node myrichISP
(the Internet service provider) as the default route.
To kill this connection, you must issue the following commands:
# route del default
# route del myrichISP
# ifconfig sl0 down
# kill -9 (slAttachPID)
In this case, slAttachPID is the process ID of the slattach process.
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.
The following items were covered in this chapter:
- Where to get Netscape for Linux, which versions to use, and how to debug common
problems in Mosaic.
- How to install Netscape on your machine after you get the distribution via FTP.
- What alternatives you have to Netscape as far as browsers are concerned: Mosaic
or Lynx, to name two.
- A brief introduction to connecting your Linux node via SLIP to an Internet service
provider.
Happy surfin'.
Contact
[email protected] with questions or comments.
Copyright 1998
EarthWeb Inc., All rights reserved.
PLEASE READ THE ACCEPTABLE USAGE STATEMENT.
Copyright 1998 Macmillan Computer Publishing. All rights reserved.