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
|
<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<title>Mac-Linux Networking Issue 26</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#A000A0"
ALINK="#FF0000">
<!--endcut ============================================================-->
<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H2>Low Cost Macintosh-Linux Networking at Home</H2>
<H4>by <A HREF="mailto:rld@erols.com">Dr. Richard L. Dubs</A></H4>
</center>
<P> <HR> <P>
<H3>Contents:</H3>
<ul>
<li><a HREF="./dubs.html#intro">I. Introduction</A>
<li><a HREF="./dubs.html#network">II. Network Overview</A>
<li><a HREF="./dubs.html#hardware">III. Network Hardware and Software</a>
<li><a HREF="./dubs.html#setup">IV. Setting Up</A>
<li><a HREF="./dubs.html#oper">V. Operations</A>
<li><a HREF="./dubs.html#final">VI. Final Comments</A>
</ul>
<A name="intro"></A>
<H3>I. Introduction</H3>
<P>
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.
<P>
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?)
<P>
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.
<P>
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.
<A name="network"></A>
<H3>II. Network Overview</H3>
<P>
<center><img src="./gx/dubs/schematic.gif"></center>
<P>
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.
<A name="hardware"></A>
<H3>III. Network Hardware and Software</H3>
<H4>LocalTalk</H4>
<P>
LocalTalk seemed the best way to establish connectivity between my family
room (Mac) and my basement (PC's) for two reasons:
<ul>
<li>LocalTalk support is already built into every Macintosh. I didn't have
to buy additional hardware for my Mac.
<li>A LocalTalk network can be run over ordinary phone lines. I used the
free pair of wires in the existing telephone line in my house for the
localtalk segment of my LAN.
</ul>
<P>
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.
<H4>Router</H4>
<P>
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).
<H4>Figure 1. Schematic of My Mac-Linux Home Network</H4>
<P>
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.
<P>
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
(<A
HREF="http://www.mac-resource.com/mac-resource/">http://www.mac-resource.com/mac-resource/</A>).
<P>
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.)
<P>
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.
<H4>Linux</H4>
<P>
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.
<P>
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).
<A name="setup"></A>
<H3>IV. Setting Up</H3>
<P>
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.
<H4>Macintosh Setup</H4>
<P>
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.
<P>
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.
<H4>Router Setup</H4>
<P>
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.
<P>
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.
<P>
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.
<H4>Linux Setup</H4>
<P>
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).
<P>
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.
<H4>IP Masquerading</H4>
<P>
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.
<P>
To configure IP masquerading, I use:
<pre>
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
</pre>
<P>
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.
<P>
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:
<pre>
Destination Gateway Genmask Iface
207.96.96.102 * 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 207.96.96.102 * ppp0
</pre>
<A name="oper"></A>
<H3>V. Operations</H3>
<P>
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!
<P>
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.
<A name="final"></A>
<H3>VI. Final Comments</H3>
<H4>Things to Try</H4>
<P>
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.
<P>
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.
<H4>Summary</H4>
<P>
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.
<P>
I would be happy to hear from anyone with comments or questions.
<!--===================================================================-->
<P> <hr> <P>
<center><H5>Copyright © 1998, Dr. Richard L. Dubs <BR>
Published in Issue 26 of <i>Linux Gazette</i>, March 1998</H5></center>
<!--===================================================================-->
<P> <hr> <P>
<A HREF="./lg_toc26.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
ALT="[ TABLE OF CONTENTS ]"></A>
<A HREF="../lg_frontpage.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A>
<A HREF="./kapok/kapok-nonote.html"><IMG SRC="../gx/back2.gif"
ALT=" Back "></A>
<A HREF="./ayers.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
<!--startcut ==========================================================-->
</BODY>
</HTML>
<!--endcut ============================================================-->
|