"The Linux Gazette...making Linux just a little more fun!"


(?) The Answer Guy (!)


By James T. Dennis, tag@lists.linuxgazette.net
LinuxCare, http://www.linuxcare.com/


(?) Setting up a Personal/Home LAN

From DrDave on Tue, 09 Mar 1999

Hi!

You may remember me from a couple of months ago, when I wrote you in my first weeks of using Linux, asking about the correct way to put together a bash script to remove spaces from filenames being copied from a Win98-generated CD. Since then, I've fallen for Linux like a stone, and I only return to Win98 when I need to do something with minimal or no support under Linux. (I'm working on the C chops, but they're nowhere near close to solving many of my problems elegantly. Grrrr.)

One of these things is the operation of a WebCam. Now, I've been through the bttv etc. sites and tried a number of things, but I'm forced to face the fact that my capture card is not supported under Linux.

[ Did you try WebCam World? Their developer's area seems to be trying to track all software that supports webcams, including Linux based apps, at http://developers.webcamworld.com/slist.html

With our fast pace of development it's also worthwhile to keep checking. I found this by feeding "+webcam software +linux" to Yahoo! -- Heather ]

My first thought was that I'd put together a driver in C for the card. After the laughter quieted to a dull roar, I dropped that idea. My second thought was that I'd just have to buy a new capture card. Not bad, but I do like a fair amount of the software I have that works with my current card. Hmmm.

Third thought: Build a mini-LAN. Rehab the old 90MHz Pentium in the closet, throw an ethernet card in it, and run the webcam/software on that box, but get access to the images/clips it produces from my "main system" running Linux. I like this idea because it seems like it will work well for most things I like to do with my cam, and because I can learn a ton about networking in the process.

Pardon my circumlocution. I'll get to the point: (hehe)

I've done some looking at the most available docs, including the networking HOWTO and a couple of books I bought on general Linux things, but none of them address my situation directly, and I'm a complete novice to networking, so I'm having trouble bridging the gaps. Perhaps you can help...

Question 1: What networking protocol should I aim for? A friend who runs a major NT based network suggested setting things up with NetBEUI, since I'd have next to zero configuration to do before getting things running. I haven't seen this addressed anywhere directly.

(!) NetBIOS/NetBEUI "native" protocols are not supported under Linux. They probably won't be supported under future versions of NT. They are non-routable and extremely "noisy" (involving many broadcasts which force the software on all hosts to sift through many of the packets that would be more targeted and handled in ethernet hardware on other protocols).
You want TCP/IP. In a real pinch you might use IPX (the Novell protocols). However, the whole Internet uses TCP/IP and even the latest versions of Netware and Windows prefer TCP/IP.

(?) Question 2: I need to be able to access the mini-LAN and my PPP connection from my linux box concurrently so, for example, I can have the webcam generate and stamp a .jpg image on my w98 box, and have a background job on the linux box ftp'ing the files to my ISP's web server. What are my major concerns here? If I can't avoid a using an IP-based protocol on my LAN (so my w98 box needs an IP address), how do I make this work?

(!) You can have multiple interfaces on a Linux system. Each interface will have it's own IP address. Typically, on small home LANs you'll have one IP address from your ISP --- usually a dynamically generated one like 206.123.234.56 --- and you'll use "reserved/private net" addresses (as defined by RFC 1918) for all of your other systems.
Thus your PPP interface will use the "real" IP address and all of your other systems will speak to the Internet through that one system (which is then your "router" and/or your "proxy").
There is a technical, though somewhat blurred, distinction between a "router" and a "proxy host." Linux can act as either or both concurrently.
One feature that's built into Linux is "IP masquerading" a particular form of "NAT" (network address translation). This allows it to re-write packet headers as it routes packets. When properly configured this will allow a whole network LAN to look like a single, busy, system to the rest of the Internet.
So, let's assume that you set up an ethernet. You decide to use 192.168.99.* for your IP addresses. According to RFC 1918 you can use any of the 192.168.*.* addresses, and/or you can use 10.*.*.* and/or you can use 172.16.*.* through 172.31.*.* (now you don't have to read the RFC --- since that's all of the most important notes from it right there).
So, your Linux system sees that as eth0 (the first, and probably only ethernet interface on your host). So you'd have a script that looked something like:
ifconfig eth0 192.168.99.1 netmask 255.255.255.0 broadcast 192.168.99.255
route add -net 192.168.99.0 eth0
ipfwadm -F -a acc -m -S 192.168.0.0/16 -D 0/0
... which would configure the interface, add the route (automatically done in 2.2.x --- but necessary in 2.0.x and earlier), and add a special entry to the "forwarding" table for the kernel's IP packet filtering (so-called "firewall").
Your PPP configuration would set the default route (out to the Internet). You might use manual dialing or a program like 'diald' to automatically dial your ISP whenever packets get directed for it (dial on demand). I've heard that newer versions of the PPP daemon (pppd) support dial-on-demand directly --- though I haven't tried it.
Search through the back issues of my column. I've described IP masquerading, diald, PPP, and routing in considerable detail and on a number of occasions.
There are also HOWTOs on these subjects --- look at the canonical LDP (Linux Documentation Project) website at: http://metalab.unc.edu/LDP
In particular you might want to look at these:
Networking Overview HOWTO, by Daniel Lpez Ridruejo
http://metalab.unc.edu/LDP/HOWTO/Networking-Overview-HOWTO.html
ISP Hookup HOWTO, by Egil Kvaleberg
http://metalab.unc.edu/LDP/HOWTO/ISP-Hookup-HOWTO.html
ISP Connectivity mini-HOWTO, by Michael Strates
http://metalab.unc.edu/LDP/HOWTO/mini/ISP-Connectivity.html
PPP HOWTO, by Robert Hart
http://metalab.unc.edu/LDP/HOWTO/PPP-HOWTO.html
Diald mini-HOWTO, by Harish Pillay
http://metalab.unc.edu/LDP/HOWTO/mini/Diald.html
IP Masquerade mini-HOWTO, by Ambrose Au
http://metalab.unc.edu/LDP/HOWTO/mini/IP-Masquerade.html
... those are a good start.
SMB HOWTO, by David Wood
http://metalab.unc.edu/LDP/HOWTO/SMB-HOWTO.html
... this will give you an idea of how to use your Linux system as a file/print server for your Windows boxes --- using Samba. That may be necessary or at least helpful for your application.
IPCHAINS HOWTO, by Paul Russell
http://metalab.unc.edu/LDP/HOWTO/IPCHAINS-HOWTO.html
... the 2.2.x kernels use this instead of ipfwadm --- so you may need to read this if you've upgraded your kernel.

(?) Question 3: Am I getting in way over my head here?

(!) How else would you learn to swim?

(?) I realize this is a pretty broad question for this forum, but any advice you can send my way would be greatly appreciated. I also figure there are probably a fair number of people out there making the Windows->Linux transition who might be interested in a similar solution for a multitude of problems.

Thanks again, David

(!) Look back through my back issues. It's all there, somewhere. Then again, maybe I've consolidated enough (by linking to the related HOWTOs) to obviate all that.


Copyright © 1999, James T. Dennis
Published in The Linux Gazette Issue 39 April 1999


[ Answer Guy Index ] 2 3 4 5 6 7 8 9 10 11
12 13 15 16 18 19 21 22 23


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Next Section ]