File: communications.texinfo

package info (click to toggle)
linuxcookbook 1.2-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 10,816 kB
  • ctags: 1
  • sloc: makefile: 40
file content (591 lines) | stat: -rw-r--r-- 21,420 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
@c $Id: communications.texinfo,v 1.19 2001/06/04 15:28:57 m Exp m $
@node Communications, Email, Networking, Networking
@comment  node-name,  next,  previous,  up
@chapter Communications
@cindex communications
@cindex @cite{Linux Network Administrator's Guide, The}

@noindent
You will almost certainly want to go ``online,'' or otherwise
communicate with other systems. Most systems today are sold with the
necessary hardware that you need in order to be able to connect to other
systems, such as a modem or a network card. You connect this hardware to
the outside world via a telephone line or network connection.

This chapter includes recipes for connecting your Linux system to the
Internet with an ISP, using fax services, and making serial connections
with a modem.

For more information on this subject, see
@uref{http://metalab.unc.edu/mdw/LDP/nag/nag.html, @cite{The Linux
Network Administrator's Guide}}.

@menu
* PPP::                         Connecting to the Internet.
* Faxing::                      Faxing.
* Modem Dialout::               Dialing out on a modem.
@end menu


@node PPP, Faxing, Communications, Communications
@comment  node-name,  next,  previous,  up
@section Connecting to the Internet
@cindex connecting to the Internet
@cindex Internet, connecting to the 
@cindex PPP
@cindex Point-to-Point Protocol
@cindex @cite{ISP Hookup HOWTO}
@cindex Kvaleberg, Egil
@cindex @cite{DSL HOWTO for Linux}
@cindex Fannin, David
@cindex @cite{Cable Modem Providers HOWTO}
@cindex Vuksan, Vladimir

@flushleft
@sf{Debian}: @file{ppp}
@sf{WWW}: @url{ftp://cs.anu.edu.au/pub/software/ppp/}
@end flushleft
@*
@noindent
There are several ways to connect a Linux box to the Internet. Digital
Subscriber Line (DSL) service, cable modems, and dial-up connections
with ISDN or analog modems are currently the most popular methods. Each
of these services have their own hardware and software requirements.

For up-to-date, detailed instructions for using these services on
Linux-based systems, the relevant HOWTOs published by the
@uref{http://www.linuxdoc.org/, Linux Documentation Project} remain the
definitive guides (@pxref{HOWTOs, , Reading System Documentation and
Help Files}):

@itemize @bullet
@item
@cite{ISP Hookup HOWTO}, by Egil Kvaleberg
@*@uref{http://www.linuxdoc.org/HOWTO/ISP-Hookup/}

@item
@cite{DSL HOWTO for Linux}, by David Fannin
@*@uref{http://www.linuxdoc.org/HOWTO/DSL-HOWTO/}

@item
@cite{Cable Modem Providers HOWTO}, by Vladimir Vuksan
@*@uref{http://www.linuxdoc.org/HOWTO/Cable-Modem/}
@end itemize

The following recipes show how to set up and use a PPP (``Point-to-Point
Protocol'') dial-up connection, long the @emph{de facto} means of
connecting a computer to the Internet over a dial-up line.

@menu
* PPP Setup::                   Setting up PPP.
* PPP Control::                 Controlling PPP connections.
@end menu


@node PPP Setup, PPP Control, PPP, PPP
@comment  node-name,  next,  previous,  up
@subsection Setting Up PPP
@cindex setting up PPP
@cindex PPP, setting up

@noindent
To configure PPP for a regular dial-up connection, where your system is
assigned a dynamic IP address (the norm for home Internet access), you
need to be @code{root} (the superuser) to edit the PPP configuration
files, and you'll need the standard connection information from your
ISP: the dial-up number to use, the IP addresses for their nameservers,
and your username and password for accessing their system.

Use this information to customize the file
@file{/etc/chatscripts/provider}:

@example
@group
ABORT        BUSY
ABORT        "NO CARRIER"
ABORT        VOICE
ABORT        "NO DIALTONE"
""           "\p\p+++\p\p"
""           "at"
""           "at"
OK           "ath0"
""           atdt@var{5551010,,}
ost          @var{ppp}
ogin         @var{smith}
word         \q@var{secret}\q
@end group
@end example

In this example, after eight lines of modem initialization strings, the
modem is instructed to dial the ISP dial-up number, @samp{5551010}. Some
systems need one or two commas after the number to signify pauses for
the modem; only do this if you can't get a good connection with just the
telephone number in this space.

Next is the ``host'' line: this is an optional line used by some ISPs
whose connection line contains a choice of services from which you must
make a selection before entering your username and password (some ISPs
offer SLIP and shell access along with the standard PPP, for example);
customize this and the following lines as instructed by your ISP.

Finally, the username @samp{smith} is given, and then the password of
@samp{secret}. The password appears between two @samp{\q} strings,
which---for security purposes---instruct @code{ppp} to display the
question mark (@samp{?}) characters instead of the actual password in
system log files or other places where an intruder might see it.

Next, edit the file @file{/etc/ppp/peers/provider} so that it contains
these lines:

@example
connect "/usr/sbin/chat -v -f /etc/chatscripts/provider"
defaultroute /dev/modem 115200 persist
@end example

The last line in this file should include the device name of the modem
you are using and the maximum connect speed to try; the preceding
example uses @file{/dev/modem} as the device name of the modem, and
115,200 bps as the maximum connect speed, which is a good value for a
typical 56K modem (a rule of thumb is to use the highest connect speed
your modem supports; you can always go lower when a connection is made,
but you can never raise the speed above what is given here).

Finally, edit the file @file{/etc/resolv.conf} so that it contains the
following, using the two nameserver IP addresses given to you by your
ISP: 

@example
search .
nameserver      @var{nameserver address 1}
nameserver      @var{nameserver address 2}
@end example

For the two @var{nameserver address} values, use the IP address of the
nameserver machines, as given to you by your ISP. The second is
optional---most ISPs have more than one designated nameserver as a
backup in the event that the first system becomes unavailable.

Make sure that your user account has membership to the @code{dialout}
group; otherwise, you'll have to have the superuser account start and
stop PPP, which is not recommended (@pxref{Hardware Access, , Letting
Users Access Hardware Peripherals}).

Once you've done these things, you should be able to start and stop PPP
connections to the Internet. Complete documentation for setting up PPP
is in the @file{/usr/share/doc/ppp} directory.


@node PPP Control, , PPP Setup, PPP
@comment  node-name,  next,  previous,  up
@subsection Controlling a PPP Connection
@cindex controlling a PPP connection
@cindex PPP, controlling a connection
@pindex pon
@pindex plog
@pindex poff

@noindent
After PPP has been installed and configured, use the @code{pon} tool to
start a PPP connection to the Internet. It calls the number of your ISP
with your modem, sends the appropriate login information, and starts the
PPP connection.

@itemize @bullet
@item
To start a PPP connection, type:

@example
$ @kbd{pon @key{RET}}
@end example
@end itemize

Once you have a PPP connection, you can connect to other systems on the
Internet via the WWW or other network services, as described in the
following chapters.

To make PPP automatically start when the system first boots, rename the
file @file{/etc/ppp/no_ppp_on_boot} to @file{/etc/ppp/ppp_on_boot}.
(you must be @code{root}, the superuser, to do this.)

To output the last few lines of the PPP log file, type @code{plog}. This
is useful for checking the progress of your PPP connection when it first
dials.

Use the @code{poff} tool to stop a PPP session. It disconnects your
computer from your ISP and hangs up the modem.

@itemize @bullet
@item
To stop a PPP session, type:

@example
$ @kbd{poff @key{RET}}
@end example
@end itemize


@node Faxing, Modem Dialout, PPP, Communications
@comment  node-name,  next,  previous,  up
@section Faxing
@cindex faxing
@pindex efax

@flushleft
@sf{Debian}: @file{efax}
@sf{WWW}: @url{http://casas.ee.ubc.ca/efax/}
@end flushleft
@*
@noindent
If you have a Class 1 or 2 fax modem, you can send and receive fax
(``facsimile'') messages with your Linux system. The following
subsections show how to do this with the @code{efax} package, which is
designed for single user systems or relatively simple fax configurations
(more complicated tools for faxing exist, but they are beyond the scope
of this book).

To set up @code{efax} for faxing, edit the file @file{/etc/efax.rc} (you
must be @code{root} to do this). The important things to specify in this
file are the value for @samp{DEV}, which is the device name in
@file{/dev} of the fax or modem device (this should almost always be
@samp{modem}), and the values for @samp{FROM} and @samp{NAME}---the fax
number and organization name to appear on outgoing faxes.

@sp .25
@noindent
@strong{NOTE:} Unless you have membership to the @code{dialout} group,
you must ask your system administrator for access to the modem hardware
before you can use it (@pxref{Hardware Access, , Letting Users Access
Hardware Peripherals}).

More information on faxing is contained in the @cite{Fax Server
mini-HOWTO} (@pxref{HOWTOs, , Reading System Documentation and Help
Files}).

@menu
* Fax Sending::                 Sending a fax.
* Fax Receiving::               Receiving a fax.
* Auto Faxing::                 Receiving faxes automatically.
* Fax Converting::              Converting fax files.
@end menu


@node Fax Sending, Fax Receiving, Faxing, Faxing
@comment  node-name,  next,  previous,  up
@subsection Sending a Fax
@cindex sending a fax
@cindex fax, sending a
@pindex efax

@noindent
Use @code{efax} to send a fax. It dials the telephone number you give
and faxes the contents of the file or files you specify. You can send
plain text files or files in TIFF Group 3 format as they are. You can
also send files in other formats, but you must convert them to
@file{tiffg3} first---see @ref{Fax Converting, , Converting to and from
Fax Format}.

Use the @samp{-d} option to specify the full path name of the fax device
(usually @file{/dev/modem} if you are using the modem connected to your
system) and the @samp{-t} option followed by a telephone number to
specify the number you are to send the fax to. To specify DTMF tone
dialing, precede the phone number with a @samp{T}; specify pauses in the
dialing sequence with a comma (@samp{,}) character---this is useful for
dialing out from a PBX or office phone system.

@itemize @bullet
@item
To fax a copy of the file @file{resume.txt} to the number
@file{555-9099}, using DTMF tone dialing, type:

@example
$ @kbd{efax -d /dev/modem -t T555-9099 resume.txt @key{RET}}
@end example
@end itemize

To send more than one file, specify them as arguments in the order they
are to be sent. You can also specify them with a wildcard character, but
be careful---they are sent in the order in which the shell expands the
file names, which is alphabetical order. If you have a lot of files that
should be sent in a particular order, rename them so their file names
begin with the number of the page they correspond to.  But be sure to
number them with the @emph{same number of digits} for each file---for
example, if you have eleven files to fax, don't name them @file{1.fax},
@file{2.fax}, and so on, to @file{10.fax} and @file{11.fax}, because the
shell will expand them in the order of @file{1.fax}, @file{10.fax},
@file{11.fax}, @file{2.fax}, @file{3.fax}, and so on up to
@file{9.fax}. In this case, you would number them as @file{01.fax},
@file{02.fax}, and so on, so that files one through nine contain the
same number of digits in their name as do @file{10.fax} and
@file{11.fax}.

@itemize @bullet
@item
To fax all of the files with the @file{.fax} extension in the current
directory to the number @file{555-9099}, using DTMF tone dialing, type:

@example
$ @kbd{efax -d /dev/modem -t T555-9099 *.fax @key{RET}}
@end example
@end itemize

Another way to do this is to make a text file containing the list of
files to fax, one file name per line, in the order you want them
sent. If the files you want to send are not in the current directory, be
sure to write the file names with path names relative to the current
directory---so for example, if you want to send the file
@file{header.fax}, which is in your home directory, and the current
directory is @file{~/documents/faxes}, the file should be specified as
@file{~/header.fax}.

@itemize @bullet
@item
To fax all of the files listed in the file @file{fax.list} to the number
@file{555-9099}, dialing @samp{9} first to obtain an outside line, and
using DTMF tone dialing, type:

@example
$ @kbd{efax -d /dev/modem -t T9,555-9099 $(cat fax.list) @key{RET}}
@end example
@end itemize

@sp .25
@noindent
@strong{NOTE:} @code{efax} doesn't delete the files it faxes.


@node Fax Receiving, Auto Faxing, Fax Sending, Faxing
@comment  node-name,  next,  previous,  up
@subsection Receiving a Fax
@cindex receiving a fax
@cindex fax, receiving a
@pindex display

@noindent
To receive a fax, use @code{efax} with the @samp{-w} option. You may
also have to use @samp{-iSO=1} to send an @samp{S0=1} command to the
modem to set it to auto answer, and use @samp{-kZ} to send an @samp{ATZ}
reset request to the modem after @code{efax} exits.

As with sending a fax, specify the full path name of the device file to
use with the @samp{-d} option. 

By default, @code{efax} outputs a ``session log'' to the standard error,
containing information on the status of the fax messages received; use
redirection to redirect it to a file (@pxref{Standard Error, ,
Redirecting Error Messages to a File}). 

@itemize @bullet
@item
To set up @code{efax} to receive an incoming fax, saving the session log
to a file, @file{faxlog}, type:

@example
$ @kbd{efax -d /dev/modem -kZ -w -iS0=1 2>&1 >> faxlog @key{RET}}
@end example
@end itemize

This command starts @code{efax} and sets up the modem to wait for an
incoming fax. After a fax is received, @code{efax} exits. You can stop
@code{efax} before it receives a fax by typing @code{C-c} or by killing
the @code{efax} job (@pxref{Stopping Jobs, , Stopping a Job}).

When a fax is received, it is written to a file in the current directory
whose base name consists of the current numeric date and a session
number generated by @code{efax}; each page is written to a separate file
whose three-digit file extension is the page number. The received fax
files are in TIFF Group 3 fax format; use @code{display} to view them
(@pxref{Display, , Viewing an Image in X}), or convert them to
PostScript or another format for printing (@pxref{Fax Converting, ,
Converting to and from Fax Format}).


@node Auto Faxing, Fax Converting, Fax Receiving, Faxing
@comment  node-name,  next,  previous,  up
@subsection Receiving Faxes Automatically
@cindex receiving faxes automatically
@cindex faxes, receiving automatically
@pindex faxon

@flushleft
@sf{WWW}: @url{http://dsl.org/comp/tinyutils/}
@end flushleft
@*
@noindent
The command described in the previous recipe can only receive one fax;
once the fax is received, @code{efax} exits.  To set up your system so
that you automatically receive all incoming fax messages continually,
until you interrupt it, use @file{faxon}, part of the @code{tinyutils}
package. It starts @code{efax} for receiving an incoming fax, as
explained previously, but after a fax is received, it starts @code{efax}
again and continues until you interrupt it.

@itemize @bullet
@item
To automatically receive any incoming fax messages, type:

@example
@cartouche
$ @kbd{faxon @key{RET}}
efax: Wed Feb 24 08:38:52 1999 efax v 0.8a (Debian release 08a-6)
Copyright 1996 Ed Casas 
efax: 38:52 opened /dev/modem
efax: 38:53 waiting for activity
@end cartouche
@end example
@end itemize

Each time a fax is received and then saved, @code{efax} restarts,
waiting for another fax. A session log is written to the file
@file{faxlog} in your home directory. 

Should an incoming facsimile message arrive, @code{efax} will receive it
and write the message in files in the current directory, with a file
name convention as described previously; then @code{efax} restarts,
ready to receive another fax. Type @kbd{C-c} to stop the script and exit
@code{efax}.


@node Fax Converting, , Auto Faxing, Faxing
@comment  node-name,  next,  previous,  up
@subsection Converting to and from Fax Format
@cindex converting to and from fax format
@cindex fax format, converting to and from 
@cindex PostScript
@pindex efix
@pindex display
@pindex gs

@noindent
In order to view or print a received fax, or to fax a file that you
have, you must first convert the file to or from the TIFF Group 3
(@samp{tiffg3}) fax format, which is the standard format for sending fax
files. (You can, however, view @samp{tiffg3} files with the GIMP, or
with @code{display}---@pxref{Display, , Viewing an Image in X}).

Use @code{efix} to convert (or ``fix'') files for faxing; it will
convert a file you want to fax @emph{to} the @samp{tiffg3} format. You
can also use it to convert received fax files to another format you can
view or print. @code{efax} outputs to standard output, but you can
redirect its output to a file to save it.

To convert a file for faxing, type @code{efix} followed by the name of
the file to convert, and redirect standard output to the file you want
to contain your fax image. @code{efix} can read plain text, PBM, and
TIFF files. 

@itemize @bullet
@item
To convert the file @file{chart.pbm} for faxing, type:

@example
$ @kbd{efix -i pbm chart.pbm > chart.fax @key{RET}}
@end example
@end itemize

This command converts a copy of the file @file{chart.pbm} to the
@samp{tiffg3} fax format, writing it to a file called @file{chart.fax}.
The original PBM file is not altered.

To convert a PostScript file to fax format, use @code{gs} and specify
@code{tiffg3} as the output device to write to---see @ref{Preparing PS,
, Preparing a PostScript File for Printing}.

@itemize @bullet
@item
To convert the PostScript file @file{resume.ps} to fax format, type:

@example
$ @kbd{gs -q -sDEVICE=tiffg3 -dSAFER -dNOPAUSE
-sOutputFile=resume.fax resume.ps < /dev/null @key{RET}} 
@end example
@end itemize

This command (typed all on one line) writes a copy of the file
@file{resume.ps} to the file @file{resume.fax} in @samp{tiffg3} format,
which you can then send as a fax. The original PostScript file is not
altered.

To convert a received fax file to a PostScript file that you can then
preview (@pxref{Previewing PS, , Previewing a PostScript File}) or print
(@pxref{Sending Print Jobs, , Sending a Print Job to the Printer}), use
the @samp{-o ps} option.

@itemize @bullet
@item
To convert @file{19990325.001}, a received fax file, to a PostScript
file, type:

@example
$ @kbd{efix -o ps 19990325.001 > received.ps @key{RET}}
@end example
@end itemize

This command converts the fax file into a PostScript file called
@file{received.ps}.


@node Modem Dialout, , Faxing, Communications
@comment  node-name,  next,  previous,  up
@section Calling Out on a Modem
@cindex calling out on a modem
@cindex modem, calling out on a
@cindex BBS, connecting to a
@cindex Bulletin Board System (BBS)
@cindex Procomm
@cindex Telix
@pindex minicom

@noindent
Use @code{minicom} to dial out with the modem and connect with another
system---such as when you want to connect to a BBS (``Bulletin Board
System''). It's a serial communications tool for X or the console; it
resembles some of the communications tools of the DOS world, such as
Telix and Procomm.

When you start @code{minicom}, the connection screen looks like this:

@cartouche
@image{communications-minicom-01, 5 in}
@end cartouche

The bottom line contains a status bar showing a message describing how
to get help, the current modem settings (in this case, 57,600 bps, 8
data bits, no parity, one stop bit), whether or not cursor keys work
(the mysterious @samp{NOR} message), the version of the program
(@samp{1.82}), the kind of terminal emulation currently set
(@samp{VT102}), and whether or not an online connection is currently
established.
 
To get a help menu, type @kbd{C-a z}; from this menu, you can press
@key{P} to set the communications parameters, @key{T} to set the
terminal settings, @key{O} to configure @code{minicom}, or @key{D} to
enter the dialing directory.

To dial a number from the main screen, type @kbd{ATDT} followed by the
number to dial.

@itemize @bullet
@item
To dial the number @samp{368-2208}, type:

@example
@kbd{ATDT3682208 @key{RET}}
@end example
@end itemize

When you type @key{RET}, @code{minicom} will begin dialing the number;
type any key to interrupt the dialing and hang up the line. Once
connected, type @kbd{C-a h} to hang up the line and type @kbd{C-a x} to
hang up the line and exit the program.

@sp .25
@noindent
@strong{NOTE:} @code{minicom} isn't really a way to connect your system
to the Internet; to do that, you normally start a PPP connection, as
described earlier in this chapter.@footnote{Technically, you can use
@code{minicom} to dial a computer that @emph{is} connected to the
Internet, like a local Free-Net system, but your access to the net will
be restricted to inside this @code{minicom} window; with a traditional
Internet connection, such as PPP, your whole system has direct access to
the net, including your Web browsers, email software, and other
networking tools.}