Depending on whether you are using a hub or not, your network topology will differ slightly. I am only covering networking with RJ45 cabling (the stuff that looks like phone cables on steroids) and not covering thin coax. With thin coax you can network multiple machines without requiring a hub, but have to be more careful about terminating connections and so on. If you know networking already, these instructions will be largely redundant.
If you have a hub, your network will look like this.
eth0 card on the Linux box to the cable modem or ADSL box using the cable supplied by the service provider during their install (or one you know works in that configuration. This is important because sometimes cable modems like to be connected with a crossover and sometimes they like a straight-through through cable: the one the company gives you is the one you want to use.
eth1 card on the Linux box to the hub with a straight-through cable. Connect all your other computers to the hub with straight-through cables.
If you do not have a hub, you can still connect one computer to your Linux box, using a crossover cable. Your topology will look like this.
eth0 card on the Linux box to the cable modem or ADSL box using the cable supplied by the service provider. Connect the
eth1 card on the Linux box to the other computer with a crossover cable.
This is not a recommended configuration (in this configuration your internal and external networks are on the same physical network, and are therefor theoretically more susceptible to cracking; in reality, the risk is probably very low), but it can be done. Your mileage may vary.
The Linux kernel includes support for "IP aliasing", which allows an ethernet card to service two different IP addresses simultaneously. The stock kernels shipped with Red Hat and Mandrake include support for IP aliasing by default. To set up your gateway with only one ethernet card, in all the subsequent code examples, simply replace
In a single-card situation, running a DHCP server is not recommended.
Plug all your machines and your cable modem or ADSL box into the hub. Cross your fingers and continue.