facebook rss twitter

Building a Hardware Modem

by David Ross on 27 July 2000, 00:00

Tags: HEXUS

Quick Link: HEXUS.net/qacx

Add to My Vault: x

Building a Hardware Modem

Building the Ultimate Hardware Modem.

Once upon a time, I had a softmodem in my PC. It sucked CPU time, but I didn't mind too much. When it came to sharing the Modem, I had to run various bits of software and of course, the connection was only up while I had my PC on and connected, and with every reboot the connection was dropped. It wasn't really ideal. When a spare motherboard and CPU came along, I couldn't resist making my very own Internet Proxy/Router ... the Ultimate Hardware Modem.

Now, I know a lot of you won't have used Linux before. Please do not expect this to be all you need to get running. You need a little linux experience first, but brave newbies are welcome to have a bash. Remember, it's all fun and it's all harmless. If it all goes AWOL just reformat and reinstall. OK? Im not going to go into how to install all this stuff either, thats what instructions are for :) Seriously though, what I am going to do is point out various bits and pieces and anything I got stuck on. Its not going to be easy, just painless.

Before we continue, there are two ways of designing this modem (and I am really using 'modem' very loosely here, meaning the thingie you plug into the phone line with).

  1. As a 'proxy' server. Client PC asks for webpage from proxy, proxy fetches webpage and delivers it.
      Limitations:
    • Only delivers certain material, eg: HTTP, FTP
    • IRC requires extra software (a port mapper)
      Advantages:
    • Can 'cache' webpages providing insanely fast access to any user on the network and lowering bandwidth usage
    • Is easier to set up
  2. IP masquerading. Now im still a little fuzzy on this, but the 'masquerading' means local IP nos (192.168.x.x) are swapped for the 'real' internet IP you have been assigned on dial up, and then (cue drum roll) the numbers are magically swapped back when the packets return.
      Limitations:
    • Can be a pain to set up
    • Doesn't cache webpages
      Advantages:
    • You can run just about everything through it (including Quake, FTP, HTTP, IRC, VideoConferencing, ICQ)

Now, because of my mind-numbing stupidity, this thought has only just occured to me. Why not do both?? Some one slap me down and call me a haddock. This is how we are going to setup our box. Lots of webcache for all the client webrowsers to share and easy access for everyone else too. Wicked.

Step One: Assembling the Hardware

I am using the following setup. You can build what you like, from a Dual-Celeron Monster to a humble 486DX/50. Just remember, the faster the CPU the more distributed.net keys you crunch!

  • Celeron 300A (Slot-1, not overclocked)
  • PC-Chips BXcel Motherboard w/ Sound and Modem onboard (PS: I LOVE THIS MOTHERBOARD)
  • 64Mb SDRAM
  • 420Mb and 210Mb Conner Hard Drives
  • Quad Speed Panasonic PD-CD - which is know duff. Pfft.
  • Cheap £9 Realtek PCI 10base-T network card
  • 4Mb PCI Voodoo Rush
  • AT Case with a quieter fan fitted to the PSU
  • PCchips/PCtel Modem Riser card and Sound Plate

As you can see, I just rumaged in the cupboard to see what I could find! The VoodooRush overheats in 3D mode, but seen as it never has a monitor plugged in and will never run in 3D mode again, thats OK. 600Mb of Hard Drive space is just about enough, if you are careful with your Linux install. It really is much easier to install everything (approx 1Gb of space needed). Much easier.

Step Two: Setting Up

First up, I assembled my kit. Then, in the BIOS, I set it to boot from CD, as well as turning off all the COM and LPT ports. Then it was on to boot from the RedHat CD.

This is what I intend to put on the typical Linux proxy/router:

  • SQUID - http proxy server for turbo web access - Supplied with RedHat
  • pdnsd - a mini DNS server with cache to stop those DNS lookup pauses - http://home.t-online.de/home/Moestl
  • IPchains - IP routing and masquerading for general TCP/IP traffic - Supplied with RedHat
  • Samba - to share your diskspace for say, MP3s :) - Supplied with RedHat
  • DHCPd - no more TCP/IP setting on the other PCs ... just click 'auto' and this program will sort everything out over the network. Magic! - Supplied with RedHat

Now linux comes in as many flavours as there are flavours in a sweetie shop. A lot of people will have personal favourites. Some people always go for one sort, some people like a mixed bag. I use RedHat 6.1 because thats the CD I have lying around. I also know I can get any stray files from the UK Mirror Service RedHat.com mirror which I know to be rather quick. It has all redhat versions available as seperate files or as ISOs ready to burn to CD. Use whatever you like, this config is fairly universal (I think).

Now as much as I would love to guide you step by step through installing Linux, a lot of people have done it already, a lot better than I can. If you are an utter linux newbie, hunt around at linux.com and linux.org for 'HOW-TOs' on just about everything.

The install process should have setup your network card (they are quite good at that). If it didn't try swapping it for one that is autodetected (I'll say it again, the cheapo £9 Realtek 8029 cards work great). You want to set the box's IP address to 192.168.0.250 or something similar. Note: 192.168.0.x are what are known as 'private' IP addresses. These will never clash with traffic on the internet. Also, you need a subnet mask (splits up network number and machine number) of 255.255.255.0

Oh, by the way. You can unplug your monitor and keyboard from the server now. Set the BIOS to not stop on keyboard errors or VGA errors and do a dry run to check your box reboots happily. Now check you can 'telnet' into the box. At your windows PC, run 'telnet servernumber' (where servernumber is the IP address of the server you set at install time). Oh a login screen. Now, you cannot log in as the root user for security reasons but you can log in as a normal user. Once you have done this, you can transfer over to 'superuser' (aka root) with the 'su' command. No monitor or keyboard needed. You can shutdown and reboot with the 'shutdown' and 'reboot' commands. You will however, have to specify more path names, mainly '/sbin' and '/usr/sbin'. Oh well, its a trade off.

My first step on the road to fun-ness having installed bits of redhat it winged about not having, was making the modem work. Now when I first did this, the driver was *ahem* taken from the PC-Chips website during their server upgrade. There was no manual and I had to work out the /dev/ttyS** entries myself. Later on, with my next motherboard, I got a newer version of the driver and an instruction manual (and I *did* do it right first time around).

  • Use tar -xvzf modem.tar.gz -C /tmp/modem to unpack the driver. That is Verbose as it Xpands a gZipped File. If it is a zip file, use 'unzip'
  • Compile the driver ... type 'make' in the /tmp/modem/src directory
  • copy the pctel.o file from /tmp/modem/lib to /lib/modules/
  • run depmod -a to settle everything in
  • in /dev, enter mknod ttyS15 c 69 72 - 62 is the Major Device Number, 79 corresonds to Serial Port No. 15
  • edit /etc/conf.modules to include alias char-major-62 pctel
  • again in /dev, enter ln -s ttyS15 modem so any linux program can default to /dev/modem and be pointed at the correct serial port
  • Put the source code somewhere more permanent such as /usr/modemdriver. You will need it again every time you change kernel versions. No you cant just use the old one!

It looks complicated but it does work, honest! I have done this about six times now on various PCs with the same PCtel/C-Media 8738AM modem and sound chip combo. This is used on Elitegroup and PC-Chips motherboards so check em out. This chip rocks!

When it comes to setting up the internet connection, I use the RedHat supplied LinuxConf. This utility lets you set up just about everything, and although its not perfect, its damned handy. Under PPP/SLiP config, create a new interface (ppp0) and set up the details. You will need:

  • Telephone Number
  • Your username and password
  • Set the DNS to 127.0.0.1 - this refers to itself (also know as loopback). You will be running a mini DNS server later

Now Linuxconf has been setup, you can start the internet connection by entering (as the root user) /etc/sysconfig/network-scripts/ifup ppp0. Woah you all cry! Thats massive! Yes it is, but judicious use of the tab key (it completes commands, ala Quake console) makes it much shorter :). Try pinging an IP number like, 212.49.224.3. If it works hurrah! If it doesn't, try try again (no not the ping, just fiddle with some settings). There are hundreds of places on the internet where you can get help on this kind of thing. Im a busy guy, but if you get totally stuck you could always try mailing me :).

Seen as you have no ability to resolve internet names into numbers, I think we ought to install the mini DNS server. I use pdnsd. Its small, its fairly easy to set up. You did download it earlier didn't you? Well, unpack it, follow the instructions and get it installed. Remember, /usr/sbin/setup allows you to set what you want loaded on startup - make sure this is included! I turn off things like sendmail (the email deliverer) and apmd (power management) for an easy life.

You did read the pdnsd docs didn't you? Tsk tsk tsk. Go and read them. Now, in the /etc/pdnsd.conf file you need to specify you ISP's DNS servers. The easiest way to find them is either a) Telephone them or b) Run ipconfig /all in a DOS box on a Windows PC. Now start pdnsd with /etc/rc.d/init.d/pdnsd start and away we go. When the connection is up you should be able to turn www.hotmail.com into an IP number, etc. If you tell the other PCs this linux box is your DNS server a) Netscape wont crash on start up like it can do and b) You can ping stuff from a DOS box! Now for some internet connectivity.

Next up, we are going to set up the SQUID proxy. Once this is going you can use your nice Windows PC to download all the IP_MASQ helpfiles and instructions :). Open up the /etc/squid/squid.conf config file. I always use 'joe' as my text editor, use whatever you fancy (joe, emacs, *ewwww* vi, etc..). Scroll down to the 'acl' section and add a line like:

acl localnet src 192.168.0.0/255.255.255.0

Oh look, there's that IP number again. This line means 'when I say localnet, I mean all accesses coming from 192.168.0.something'. A little further down, add:

http_acccess allow localnet

Add this as the one-from-last http_access line. The last one should deny access from all (other) people. Excellent. Fire up SQUID (with /etc/rc.d/init.d/squid start), wait for it to build the cache directories (in /var/spool/squid - 64 x 256 dirs, up to 100Mb). If you dont want the cache there (say, you have a seperate hard drive like me), edit squid.conf again. You did read the manual didn't you?

Now to be perfectly honest with you, IP Masquerading was a bit of a blur. I read this and muddled my way through. I made the rc.firewall script, as it suggests, ran it and it worked. Try it. If lots of people have problems, mail me and I'll work out exactly what I did.

Above all have fun and experiment. I reinstalled RedHat about five times in the course of doing all this. Its all good fun. As for help, there's linux.com and linux.org, as well as the HOW-TOs. If you are really stuck try