Only one hour after I taught my wife, Lois, how to access the Internet with our Macintosh Quadra 605, I knew that my dream of having a Linux-based home network would be realized. Surely, I reasoned, it would now be unacceptable for me to "hog" our Internet connection and prevent Lois from tracking down Star Trek Collector's Cards online. Fortunately I had used Linux IP Masquerading in a previous life as a LAN administrator and knew that a Linux solution would allow us both to be on the Internet at the same time with only a single modem connection and IP address from our Internet Service Provider.
There were a couple of constraints, however. First, there was no space in my family room for another computer; any additional system would have to be set up in the basement. Second, our Mac did not have an Ethernet card, nor was I inclined to pull Ethernet cable through my house. Third, any solution would have to be achieved on a shoestring budget (Did you hear the one about the guy whose wife had her credit cards stolen, and the guy didn't report it because the thief spent less than the wife?)
This article describes the Linux networking solution I came up with - it consists of my Mac, a Linux Box and a low cost dos-based router. It is not "state of the art", but it is a solution that works within the constraints I imposed, it is relatively simple, and it is one that many people haven't heard about before. As you will see, it heavily leverages software and information available on the Internet. Mac, DOS, and Linux users will all find something of interest in the material presented herein.
The remainder of this article is organized as follows: Section II presents an overview of my home network; Section III describes the network hardware and software; Section IV addresses setting up; Section V describes operations; and Section VI presents final comments, including things to try.
Figure 1 presents a schematic of my home network. My Macintosh (family room) has connectivity to my Linux box (basement) through a low cost dos-based router (also basement). The Macintosh-router segment is LocalTalk and the router-Linux box segment is Ethernet (thinnet). The Linux box provides the dialup PPP connection to my Internet Service Provider (ISP) and runs IP Masquerading which allows the Macintosh and the Linux box to use the Internet at the same time through the single dialup connection.
LocalTalk seemed the best way to establish connectivity between my family room (Mac) and my basement (PC's) for two reasons:
Some people might say that LocalTalk, at 230 KB/sec is too slow to be useful for networking. (Ethernet, in comparison, is 10MB/sec). However, my modem connection is only 14.4 KB/sec (57.6 KB/sec maximum throughput) making LocalTalk seem more than adequate.
Having a LocalTalk connection from my Mac to my basement still didn't help me connect to my Linux box. Linux does offer AppleTalk support, but it does not yet offer support for LocalTalk (although I understand the hooks for LocalTalk are now built into the AppleTalk code).
That's where the free router software, PCROUTE by Vance Morrison, comes in. PCROUTE is dos-based software available on the Internet (PCRTE224.ZIP at http://www.nova.edu/Inter-Links/simtel/network.html) that routes TCP/IP packets between LocalTalk and Ethernet networks. PCROUTE can run on a PC XT or better ( and it doesn't require an AppleTalk - IP Gateway like the LocalTalk packet driver-based routers such as KA9Q). Once PCROUTE is set up correctly, you don't even need a keyboard or monitor if your computer can boot without them. I run PCROUTE on an old 386 PC with 1Meg of Ram and a 5.25 inch floppy drive.
PCROUTE comes with excellent instructions on how to compile and configure it as a LocalTalk/Ethernet router. Of course the router needs both a LocalTalk PC card and an Ethernet card. The latter I already had and the former I bought for $27 + shipping from MacResource Computers, a Texas-based company I found on the Internet (http://www.mac-resource.com/mac-resource/).
Some more comments about the LocalTalk connection between my Mac and the router. To use phone lines for LocalTalk, both my Mac and the router required LocalTalk/RJ-11 adapters. The 8 pin mini-din variety is available at any computer superstore, however, the LocalTalk PC board required the older 9 pin variety. Those are easy enough to find for sale on the Internet, but I found the circuit itself on the Internet instead (http://www.jura2.uni-hamburg.de/~kai/LAM_HTME/cap1.htm)! It turns out that you can build the 8 or 9 pin variety with only 5 resistors, 2 capacitors, and some miscellaneous parts - and it all fits in a 35mm film canister! I built one for my router and it works great. (One word of caution - the pinouts for the 9 pin adapter or left/right backward in the figure provided with the circuit.)
I have a single phone line in my house; it uses the inner red and green wires of the modular phone plug for the telephone connection. The outer black and yellow wires are available for LocalTalk. Fortunately, LocalTalk/RJ-11 adapters are already wired to use the outer wires.
My Linux box is a 486DX33 PC with 16Megs of Ram, a 270MB hard disk, and a 14.4 baud Modem. It uses a thinnet Ethernet connection to the router. The only unusual part of installing Linux was that my 486 does not have a CD-ROM drive. To load the Linux software, I decided I needed to get the software on the DOS partition of my 486 so I could install Linux from there.
To accomplish this I temporarily installed the LocalTalk PC card in the 486 and loaded the software that came with the card. The software allows you to mount Macintosh folders as letter drives (e.g. f:) on your PC. I simply copied the Linux installation software off the CD-ROM into a folder on my Macintosh hard disk, mounted that folder over the LocalTalk network as drive f: on the 486, and used XCOPY to move all the LINUX software to my 486 (e.g. XCOPY f:*.* c: /s /e).
I followed RFC 1597, which allocates certain IP addresses for private networks, and internally assigned 192.168.1.x for my LocalTalk segment and 192.168.2.x for my Ethernet segment. In the next three sections, I provide specific instructions for configuring the network.
The Macintosh setup is straightforward. Select MacTCP from the control panel. In the first MACTCP window, select the "More" button. In the second window, set the server to "Manual" and the gateway IP to 192.168.1.1 (This is the IP address for the router's LocalTalk PC card). I leave the DNS servers the same as I use to access the Internet directly with my Mac's modem.
Click "OK" to return to the first MacTCP screen. On the first screen, change the Mac's IP address to 192.168.1.2 and select the LocalTalk icon. Make sure that LocalTalk is turned on in the Chooser.
PCROUTE comes with excellent documentation which I will not repeat here. I set up the LocalTalk interface with an IP address of 192.168.1.1 and the Ethernet interface with an IP address of 192.168.2.1. For the Ethernet interface I have successfully compiled and run two different configurations of PCROUTE, one that uses a direct interface to an 8 bit WD8003 Ethernet card and one that uses an Ethernet packet driver interface. The nice feature of the packet driver interface is that it allows you to use any Ethernet card for which a packet driver exists. I have successfully used PCROUTE with both the WD8003 card and a 16-bit NE2000 compatible card using packet drivers.
In the router, I set a static default route to 192.168.2.2 (the Linux box) so that any IP address not recognized by the router (e.g. www sites from my Mac intended for the Internet) will be routed by default to the Linux box.
A neat feature of PCROUTE is that it allows you to designate the Linux box as a syslogd host that logs status messages from the router. When the router starts up, and approximately every 15 minutes thereafter, the router sends the Linux box a "Router is up" message that is recorded in a file on the Linux box that you specify.
I set the IP address for the Linux Ethernet interface to 192.168.2.2 and designated the router (192.168.2.1) as the gateway for packets addressed to the LocalTalk segment (192.168.1.x).
To log syslog messages from the router, edit the /etc/syslog.conf file as described in the PCROUTE documentation. Then reboot Linux or type kill -HUP <pid>, where pid is the syslogd process id obtained by typing ps -x.
As stated earlier, I use IP Masquerading to give my Mac and Linux box simultaneous access to the Internet through a single PPP connection to my ISP. However, because I use Linux 1.2.13, the IP Masquerading capability has to be built into the kernel as a patch. Fortunately, IP Masquerading comes with excellent instructions for applying the patch.
To configure IP masquerading, I use:
ipfw a m all from 192.168.2.0/24 to 0.0.0.0/0 ipfw a m all from 192.168.1.0/24 to 0.0.0.0/0
These steps will automatically masquerade my Mac and any future computer I add to either my LocalTalk segment or my Ethernet segment. If you don't want to retype these lines each time you reboot your computer, add the steps to one of the startup scripts executed from the /etc/rc.d directory.
I will not describe setting up a PPP connection from my Linux box to my ISP; good instructions are already provided in the Linux How-To documents. When the PPP link is up and running and IP Masquerading is set up as described, my routing table (obtained by typing "route -n") looks like:
Destination Gateway Genmask Iface 18.104.22.168 * 255.255.255.255 ppp0 192.168.2.0 * 255.255.255.0 eth0 192.168.1.0 192.168.2.1 255.255.255.0 eth0 127.0.0.0 * 255.0.0.0 lo default 22.214.171.124 * ppp0
My setup works great! I can initiate a PPP connection to my ISP by logging into my Linux box, either by walking down the basement, or telnetting to the Linux box from my Mac. Best of all, thanks to IP Masquerading, my wife and I can now both use the Internet at the same time!
With my new LAN setup, my Internet programs (e.g. my web browser) run slightly faster now because my Mac no longer has to simultaneously maintain a modem connection and run MacPPP. Further, when I have to reboot my Mac (yes, it does happen occasionally with Macs) I don't have to redial my ISP because the connection is maintained by my Linux box; as soon as I reboot, I'm back online.
I have not tried to optimize the performance of my Mac-Linux LAN. However, since Ethernet packets can be almost 3 times larger than LocalTalk packets, one thing to try is to move the burden of reducing the packet size from the router to the Linux box by reducing the MTU parameter of the Linux Ethernet interface. (For example, to change the MTU size to 500, type "ifconfig eth0 mtu 500.") Another interesting thing to try is IRQTUNE which lets you give the serial port on the Linux box higher processing priority so that it has less chance of dropping packets (http://www.best.com/~cae/irqtune). I have not tried IRQTUNE yet, but it might be a good thing to run for anyone using a modem with a Linux box.
One of the things I'd like to try is accessing my Linux box using X-server software on my Mac. I'll have to make sure that the X-server software can run over LocalTalk.
This article has described a low cost way of creating a Mac - Linux network at home. I hope that Mac, DOS, and Linux users have all found something of interest in the setup I've described.
I would be happy to hear from anyone with comments or questions.