IceWalkers.com - Linux Software downloads and news
Name : Password :
Linux SoftwareLinux RPMLinux HowtosLink UsAboutAdvertise

HOWTOs

Search Howtos :Match :

2. The Server Side

It is assumed that the server is a Linux system with either:

  • a modem attached to a /dev/ttySx device

  • an 'isdn4linux'-emulated modem mapped to a /dev/ttyIx device

The easiest setup I can think of uses a five lines perl script to implement a modem daemon in /usr/sbin/modemd:

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

The modem daemon is started by the inetd process if a client connects to the appropriate port as described below. The modemd simply connects the socket handle with STDIN and STDOUT of the cu command and lets cu handle the actual modem device.

The existence of the modem daemon must be made known to the inetd process by updating its configuration file, usually /etc/inetd.conf like:

#
# modem daemon
#
modem stream tcp nowait root /usr/sbin/tcpd /usr/sbin/modemd /dev/ttyS1

In order to make this work, an entry to /etc/services needs to be added like:

   
modem           2006/tcp        modemd

This associates a symbolic name with an explicit port, 2006 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:

   
bash# ps | grep inetd
194  ?  S     0:00 /usr/sbin/inetd

bash# kill -HUP 194

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

bash$ telnet localhost modem

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

You are now connected to the modem. You can now issue AT commands in order to verify the setup:

   
atz
atz
OK

ati1
ati1
Linux ISDN
OK

^]
telnet>quit
bash$

Instead of using the Perl script as a modem server, there is also a program named Masqdialer available at http://w3.cpwright.com/mserver/.

With Masqdialer you can export any number of modems connected to your server to any host that can connect the server via TCP/IP on a given port with a binary data stream.

2.1. Masqdialer Installation

Before compiling check config.h for compile time options:

  • set the path for the config file to your liking

  • set the path for the lock file to your liking

Do make all.

Copy the binaries (mserver and tcpconn) into a suitable directory such as /usr/local/sbin/. Copy mserver.conf into the path that you specified in config.h.

Masqdialer could be started from one of your system startup scripts. A simple /usr/local/sbin/mserver will run it as a daemon.

2.2. Masqdialer Configuration

A line in mserver.conf could look like this:

5800 /dev/ttyS1      115200,8,N,1    *.foo.org,192.168.2.1

which would mean that a modem connected to /dev/ttyS1 can be connected via port 5800 from anywhere in the domain foo.org and from host 192.168.2.1. Any other hosts are rejected. Pitfall: If you don't specify hosts then ANY host will be allowed to connect. The serial line settings are fixed and cannot be changed from the client side. You can export several modems on a single port. Masqdialer only locks the modem devices by use of UUCP style lock files when they are actually in use thus allowing other programs to take advantage of them.

Search Howtos :Match :
Transmission 1.41 beta 2
Lightweight, yet powerful BitTorrent client
X-Moto 0.5.0
2D motocross platform game
Gdm 2.25.1
Reimplementation of the well known xdm program.
Linux Kernel 2.6 2.6.28-rc7
Linux Kernel
Linux Kernel 2.4 2.4.37
Linux Kernel
RIP 7.3
Small linux system for the purpose of system booting or repairing
GEdit 2.25.1
Small but powerful text editor
VLC media player 0.9.7
Cross-platform media player and streaming server
GNOME 2.25.2
GNOME desktop environment
WebGUI 7.6.5
A fully featured content management system.
Free IT Magazines, White Papers, eBooks, and more !
Dr. Dobb's Journal

Dr. Dobb's Journal enables programmers to write the most efficient and sophisticated programs and help in daily programming quandaries.

The 7 Things that IT Security Professionals MUST KNOW!

Gain key insight into security problem and find the safest means to protect your technological assets.

Database Trends and Applications

Provides timely coverage of the technology, intelligence and insight needed to plan, implement and manage information-rich projects.

Linux Software Map
Find Linux RPM
Best Rated Linux Software
Most Rated Linux Software
Linux Distributions
Linux Howtos
Quick Survey

Please take our survey and help us improve our website to serve you better.

Thank you.
Linux Software
Linux / IT Resources
Site Resources
Google
Privacy Policy
Contact Us
Submit Software
Advertising info