Using a null modem cable with Freesco

Freesco has integral support for dial-in modems but this can be perverted to allow you to “dial-in” with a null modem, thus allowing simple, cheap TCP/IP networking for up to two computers or adding up to two computers temporarily to an established Ethernet network.

Using null-modem cables it is possible, by clever use of Windows Dial-up Networking and some changes to the default Freesco configuration, to allow you to take advantage of such a system.

Advantages of such a system are:

  • Cheap.
    It needs only a null-modem cable for each computer (up to a maximum of two per Freesco machine, maybe more in the next version). It does not require expensive network hardware on the client machines (only a simple standard serial port), making it ideal for connecting laptops without having to buy expensive PCMCIA cards.
  • Easy.
    A few simple programs on the router let you use Windows' built-in DUN to connect to the network without need of specialist software on the client.
  • Quick.
    Needs little configuration of client machines (only a dummy modem driver which is supplied with all versions of Windows and a dummy DUN connection using that driver) and can be simply and quickly installed and removed without compromising the existing configuration of the client.
  • Temporary.
    The client computer needs no special drivers or setup making it perfect for quickly adding a foreign machine to the network for short periods. Leaving the configuration on client machines will not harm them, either.
  • Standard.
    The Freesco machine will pretend to be a “Standard Modem” to the client machine, which will login as a usual PPP connection, allowing any TCP/IP compatible program to be used (e.g. allows network shares to be accessed, Internet routing to the client machine and any other program that uses TCP/IP)
  • Reasonable speed.
    Although the dummy modem driver is the “Standard 28,800 bps Modem” driver in Windows, the speed of the connection is actually the speed of the serial port, allowing connections at 115,200 bps (approx 14 KBytes / second or twice the speed of the average 56Kbps modem connection), more than enough for web browsing, small file transfers or network printing. Faster speeds may be possible by tweaking some settings, up to the maximum speed of the serial ports on the Freesco machine / client.

Some uses for this would be:

  • Adding computers (e.g. laptops) temporarily to an established network to use, for example, network printers, network drives, Internet access, file synchronization, multiplayer games etc.
  • Setting up a cheap home network, which is TCP/IP-based, for gaming, file sharing etc. without needing to buy a single Ethernet card (just a Freesco machine to act as go-between and two null-modem cables).
  • Testing applications using modem-speed access (by tuning the serial port speed) without disturbing networks or running up phone costs.
  • (With some tweaking) Allowing unusual Internet access devices (e.g. Sega Dreamcast, Playstation 2, set-top boxes etc.) to access the Internet through your existing / cheaper dial-up / Ethernet connection.

So. How do we do this ?

The Freesco machine already should have one spare serial port. Connect the null-modem cable between this and your client machine. Firstly, we should run through how to configure the Freesco machine.

The entire process works by making Freesco “pretend” it is a modem which is achieved by answering the Windows modem drivers AT commands until such time as the PPP process starts, after which Windows and Freesco communicate directly and allow TCP/IP access across the cable.

For this, we need to have a script which simulates the replies to such commands that a real modem would send back.

We will call this script nullscript :

connect '/sbin/chat -v ATH OK AT OK ATE0V1 OK AT OK ATDT CONNECT'
-detach
persist
modem
crtscts
:192.168.10.97

(A downloadable version is available here: nullscript )

The various AT and OK commands in the script are the send / expect pairs that will negotiate us through the Windows modem initialisation far enough to satisfy Windows that what it is connecting to is a modem.

The IP address at the bottom is the IP that the remote client will be given once it is connected (this should not conflict with any IP addresses on your network). /bin/spawnnull is the script below.

Now we need to run the PPP server on the Freesco machine that will use the above script to connect and then take over and use PPP over the connection. We will call this script spawnnull:

#!/bin/sh
fork pppd /dev/cua1 115200 file /bin/nullscript

(A downloadable version is available here: spawnnull )

Note that the /bin/nullscript should be the location of the above script, /dev/cua1 should be the serial port of the Freesco machine that the null-modem is on (in this case cua1, a.k.a. COM2) and 115200 is the speed that that serial port will operate at. Now execute this program.

Now we need to set up the client machine. Basically, this involves adding a driver for a “Standard 28,800 bps Modem” on the port that the null-modem is connected to on the client machine, then creating a new Dial-Up Networking connection which uses this modem. This new connection can dial any phone number (it will be ignored) and can use any username and password (they will be ignored too, unless you wish to have authentication. See below).

If the machines are connected, the above scripts working, and the client machine configured, double-clicking the DUN connection for the null-modem should have you up and running! The standard Windows “flashing green boxes” item will appear in your taskbar, showing a 115200 connection (and, incidentally, providing you with a handy transmit / receive status indication).

You'll now be able to access the network as if it were local. Network machines should be able to access you as if you were connected to the network in the usual way and all TCP/IP programs should work.

If your network is connected to the Internet (e.g. using the same Freesco machine to dial-out or route an Ethernet connection), you should also be able to run any standard Internet program and connect to the Internet as normal.

If you are using just Ethernet (i.e. not the usual dial-out modem which would take up the second serial port of the Freesco machine), you can create copies of both of the above scripts with different names, different serial ports and different IP addresses to connect two computers to the Freesco machine over null-modem cables, both of which will be able to access each other and the network (for a quick blast of Quake, maybe?).

Authentication of the connecting user can be added by putting the line:

login

inside the nullscript. This will authenticate users against the standard system password database


Now that we've successfully tested the system, if you need to make it permanent a few changes may need to be made. Firstly, the scripts should be put where they can survive a reboot (e.g. /mnt/router/fix, /mnt/router/packages /pkg, etc.). Secondly, the spawnnull script will need to be run on startup, by placing it's command into /rc/rc_user.

This HOWTO isn't yet finished. There are still several problems to iron out, apart from the above. Firstly, it needs to be properly integrated so that it doesn't get affected by the firewall. Sometimes, if you have made the null-modem connection before your usual modem dial-out connection, it will steal ppp0 and so will be subject to a Freesco firewall between the Freesco machine and the client (and when the modem does dial-out, it will not be subject to the firewall. A dangerous situation!).

Sometimes, it may be necessary to add a:

netmask 255.255.255.0

line (or similar) to the nullscript, to prevent the null-modem receiving every packet sent across the network.

Also, some Windows modem drivers don't use the same initialization sequence and these will need to be manually inserted into the nullscript (the minicom program supplied with Freesco is a great tool for finding out the Windows' AT command- sequence for a particular modem, along with the modem's .INF files). Future developments might include an .INF file for a dummy modem which does not require specialist scripts to dial-in to the Freesco machine.

If you can solve any of these problems, or add comments to make this sequence easier to follow, please contact ledow

 
freesco/howtos/null_modem.txt (106822 views) · Last modified: 2006/03/26 00:35 (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki