Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > 965e33040dd61030a94f0eb89877aee8 > files > 3387

howto-html-en-20080722-2mdv2010.1.noarch.rpm

<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="Author" CONTENT="Friedemann Baitinger">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (Win95; I) [Netscape]">
   <TITLE>Linux Modem sharing mino-HOWTO</TITLE>
</HEAD>
<BODY>

<H1>
Linux Modem sharing mini-HOWTO</H1>


<P>Author:&nbsp; Friedemann Baitinger,&nbsp; <A HREF="mailto:baiti@toplink.net">baiti@toplink.net</A>
<BR>last update:

<P><TT>v1.01, 11 February 1997 source now in HTML format, added a reference on
where</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
to get 'cu', also added a reference on where to get</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
mserver. '-s' parameter added to 'cu' example.</TT><TT></TT>

<P><TT>V1.00, 06/12/97 Initial release</TT>
<H2>

<HR WIDTH="100%"></H2>

<H2>
<U></U></H2>

<H2>
<U>1. Introduction</U></H2>
This mini-HOWTO describes how to setup a Linux system in order to share
a modem attached to this system&nbsp; with other systems over a TCP/IP
network.
<H2>
<U></U></H2>

<H2>
<U>2. The Server Side</U></H2>
It is assumed that the server is a Linux system with either:

<P>&nbsp; a)&nbsp; a modem attached to a <TT>/dev/ttyS<I>x</I></TT> device

<P>&nbsp; b)&nbsp; an 'isdn4linux'-emulated modem mapped to a <TT>/dev/ttyI<I>x</I></TT>
device

<P>The easiest setup I can think of uses a five lines perl script to implement
a 'modem demon':

<P><TT>&nbsp;&nbsp;&nbsp; $ cat /usr/sbin/modemd</TT>

<P><TT>&nbsp;&nbsp;&nbsp; #!/usr/bin/perl</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; select((select(STDOUT), $| = 1)[$[]);</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; select((select(STDIN), $| = 1)[$[]);</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; exec 'cu -s 115200 -l /dev/ttyS1';</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; die '$0: Cant exec cu: $!\n';</TT>

<P>The modem demon is started by the <TT>INETD</TT> process if a client
connects to the appropriate port as described below. The 'modemd simply
connects the socket handle with <TT>STDIN</TT> and <TT>STDOUT</TT> of the
<TT>'cu'</TT> command and lets <TT>'cu'</TT> handle the actual modem device.
In case you don't have <TT>'cu'</TT> on your system, please install the
<TT>'UUCP'</TT> package, <TT>'cu'</TT> is usually part of <TT>'UUCP'.</TT>

<P>The existence of the modem demon must be made known to the <TT>INETD</TT>
process by updating its configuration file, usually <TT>/etc/inetd.conf</TT>
like:<TT></TT>

<P><TT>&nbsp;&nbsp;&nbsp; #</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; # modem daemon</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; #</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; modem stream tcp nowait root /usr/sbin/tcpd
/usr/sbin/modemd /dev/ttyS1</TT>

<P>In order to make this work, an entry to <TT>'/etc/services'</TT> needs
to be added like:

<P><TT>&nbsp;&nbsp;&nbsp; modem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2006/tcp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; modemd</TT>

<P>This associates a symbolic name with an explicit port, <TT>2006</TT>
in the example. The portnumber could be any number not already assigned
to an existing service. After these changes have been made, a signal must
be sent to the inetd process in order to let inetd re-read and process
its configuration file:

<P><TT>&nbsp;&nbsp;&nbsp; $ ps |grep inetd</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; 194&nbsp; ?&nbsp; S&nbsp;&nbsp;&nbsp;&nbsp;
0:00 /usr/sbin/inetd</TT>

<P><TT>&nbsp;&nbsp;&nbsp; kill -HUP 194</TT>
<BR>&nbsp;

<P>Now the server side is ready to accept requests from clients. The correct
function can be verified by:

<P><TT>&nbsp;&nbsp;&nbsp; $ telnet localhost modem</TT>

<P><TT>&nbsp;&nbsp;&nbsp; Trying 127.0.0.1...</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; Connected to localhost.</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; Escape character is '^]'.</TT>

<P>You are now connected to the modem. You can now issue <TT>'AT'</TT>
command in order to verify the setup:
<BR>&nbsp;
<BR><TT>&nbsp;&nbsp;&nbsp; atz</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; atz</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; OK</TT>

<P><TT>&nbsp;&nbsp;&nbsp; ati1</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; ati1</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; Linux ISDN</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; OK</TT>

<P><TT>&nbsp;&nbsp;&nbsp; ^]</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; telnet>quit</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; $</TT>&nbsp;

<P>Instead of using the Perl script as a modem server, there is also a
program named <TT>'mserver'</TT> available on <A HREF="ftp://ftp.innet.be/pub/staff/carl/">ftp://ftp.innet.be/pub/staff/carl/</A>
. In case it is not there anymore, you may want to use <TT>'archie'</TT>
or any other search engine in order to locate the mserver archive. I haven't
had the opportunity yet to install and use mserver.
<H2>
<U></U></H2>

<H2>
<U>3. The Client Side</U></H2>
At this time, only Windows client setups are described here.&nbsp; On the
client PC, a COM-port redirector for TCP/IP is required. The best program
for this purpose I have found is '<TT>DialOut/IP</TT>' from 'Tactical Software'
for Windows 3.1 and Windows 95.&nbsp; (The Windows 3.1 version can be used
under Windows NT for 16-bit applications only.&nbsp; A 32-bit version for
Windows NT is due late summer 1997.)

<P><TT>DialOut/IP</TT> presents the shared modem on a new virtual COM port
that it adds to Windows.&nbsp; This virtual COM port can be used by Windows
programs as if the shared modem is directly connected.&nbsp; Most client
applications (including Windows 95 dial-up networking) accept this and
work as if there were a real COM port and modem, with the general exception
being fax applications or any others that need access to UART control lines.
<TT>DialOut/IP</TT> can be configured to provide Telnet protocol processing,
but that feature applies to certain modem pool products and not to the
Linux setup described in this file.&nbsp; Note that, despite its name,
<TT>DialOut/IP</TT> can be used also by applications that wait for incoming
calls.

<P>On <A HREF="http://www.tactical-sw.com">www.tactical-sw.com</A> there
is a page for downloading a fully functional evaluation version that times
out in 1-2 weeks. Installation and configuration is handled by a setup
program, with installation details in the README.TXT file.&nbsp; When you
run <TT>DialOut/IP</TT>, you enter the IP address and port number of the
shared modem.

<P>DialOut/IP is a commercial product that is licensed on a per-modem basis,
that is, the price depends on the number of modems that you are sharing.
The license states that you can install the software on any number of PC's
that access the shared modems.
<H2>
<U></U></H2>

<H2>
<U>4. Security Considerations</U></H2>
If you have only one modem for all your hosts in your local area network,
there is probably no reason to worry about security here. However, if any
one or more of the hosts in your LAN are connected to the internet by other
means than using the modem we have just setup as a modem server, then security
considerations are required, otherwise anybody can do a 'telnet your_host
modem' and dial out long distance or even international calls at his will.

<P>I suggest to install and configure tcp-wrappers in order to protect
the modem sevrer against unauthorized access.
<H2>
<U></U></H2>

<H2>
<U>5. Examples</U></H2>
I am using the setup as described in (2) and (3) to run Quicken on my Windows
95 ThinkPad and do homebanking with the modem attached to my Linux machine.
The 'modem' in my case is not even a real modem, it is an emulated modem
on an ISDN-So card. Quicken just sees a COM port, it doesn't know that
the device attached to the COM port is actually at the other end of my
Ethernet LAN, nor does it know that it is not a standard analog modem but
an ISDN device which happens to understand 'AT' commands.
<BR>&nbsp;
<BR>&nbsp;
</BODY>
</HTML>