Small Office/Home Networking Howto, Part 1

Setting up a LAN (Local Area Network)

by James R. Williams Zavada, March 2002

Hardware simply does not work like the manual says and no amount of Zen contemplation will ever make you at one with a 3c905B ethernet card."
- Alan Cox            
(Linux Kernel Developer)

Table of Contents


Disclaimer:

This information is provided in the hopes that you will find it useful and instructive. However, it is provided with ABSOLUTELY NO WARRANTY OF ANY KIND.

Any and all trademarks mentioned in this text are property of their respective owners.

Introduction:

The goal of this Howto is to provide the basic information needed to create a small office/home network using ethernet. It assumes that you have a basic understanding of how to install adapter cards in each computer you wish to add to your new network, and it only covers the bare minimum of a temporary manual Linux configuration for ethernet. The reader is responsible for learning how his or her particular Linux distribution expects to be configured for a permanent ethernet configuration, including the driver for the ethernet card. The reader is also responsible for installing and configuring ethernet cards in any non-Linux computer that will be added to the network.

It is also important to keep in mind that networking, although possible for mere mortals, can be fraught with frustration and problems. When all goes well, it can be quite easy to set up a small network, and life is grand. Bear in mind that there are many people who do network consulting or administration for a living. This is true precisely because installing, configuring and troubleshooting a network can sometimes be an extremely difficult task. If you find yourself having significant problems setting up your own network, you may very well want to consider paying someone to do it for you.

Finally, this part of the Howto (Part 1) will only show you how to set up a basic network. In other words, when we have finished, you will have a group of computers that are all connected to the same network. Part 1 will not cover how to set up any network services, however, so your new network may not do very much when we've finished. Later parts (Part 2 and later) will cover how to set up various network services, such as an Internet gateway, a file, print or web server, or a wireless access point, etc.

Prerequisites:

Hardware Requirements

In order to set up a network, you will need an ethernet hub, an ethernet adapter for each computer you want to add to the network, and cables. If you are buying all new equipment, it is highly recommended that you use 100baseT equipment. If you already have 10baseT adapter cards, you should buy a dual-speed 10/100 hub, to maintain backward compatibility with older equipment, and to be forward compatible with new equipment.

Ethernet Hub

As far as hubs go, any brand should work. The key is to get one that has enough ports to support the number of computers you plan on adding to the network. If you think you may add computers in the near future, it is easier to buy a hub with more ports than it is to cascade hubs, so you may want to consider buying a hub with more ports than you need. The only other thing to be concerned with when buying your hub is whether or not it is a 10baseT, 100baseT or both. If you may be plugging older equipment into your network, you may want to get a dual-speed hub. Otherwise, you should get a 100baseT hub.

Adapter Cards

You'll need an adapter card for each computer you want to connect to your network. When you buy the cards, make sure that each one is compatible with the hardware and operating system for the computer in which it will be installed. For Linux, the easiest adapters to install are PCI adapters that are NE2000 clones. Examples are Allied Telesyn's AT2400, D-Link's DE-528, Novell's NE2000-PCI, as well as several generic vendor cards. Keep in mind that although these are very easy to install, they do not provide the best performance. Regardless of the brand of card you buy, make sure that the ones you use for your Linux computers are compatible. You should check out the section on more information below, specifically the Ethernet Howto prior to buying, to make sure you get an adapter that works well with Linux. As a reminder, any new adapter cards you buy should be the faster 100baseT cards. For the purposes of this Howto, I'm assuming you already know how to open your computer and install new adapter cards.

Cables

Cables are a necessary element in order for an ethernet network to work properly. You'll need one for each computer you are connecting to the network. The maximimum allowed length for 10baseT and 100baseT ethernet cables is 100 meters (328 feet). Although I've yet to find an official specification for the minimum length, I've come across sources that say very short cables can cause problems, so I recommend that the shortest cable you buy should be no less that three feet long. Make sure that the cables are rated as Category 5 or better (often referred to as Cat 5). Although you can make your own cables, I recommend against it. It is much easier for a small office/home network user to buy cables at a local computer store. The added advantage is that if it turns out to be a bad cable, you can bring it back to the store and may get them to exchange it for a good one.

Software Requirements

For software, you'll need to make sure you have appropriate drivers for the ethernet adapter cards you install in each computer. For the purposes of this Howto, we will only cover the software setup for Linux. We will discuss the basic driver setup and installation for an easily configured Linux compatible adapter card. However, we will only discuss how to manually set up the IP address configuration in a temporary fashion. For permanant IP address configuration, you will need to consult the documentation for your particular Linux distribution.

IP Addresses

For this Howto, we will use an IP address range that is reserved for private networks, 192.168.128.1-254. Connecting a private network to the public Internet will be covered in Part 2 or later. You need to assign an IP address to each computer on your network. Make a note of which IP address you assign to which computer, because each computer must have a unique IP address. Because very few small office/home networks are likely to have more than 254 computers, we are going to limit your network to that by using a netmask of 255.255.255.0. Then, even though you won't be using it until you connect your network to the Internet, reserve 192.168.128.1 as your gateway address, and do not assign it to any of your computers. The network address for your new network will be 192.168.128.0, and the broadcast address will be 192.168.128.255, so do not assign them to any of your computers either. The only other IP addresses you need to be concerned with are those of your Internet Service Provider's DNS servers (or your own). However, we won't be connecting your network to the Internet until Part 2, so DNS won't function when you first set up your network.

Installation:

First, we need to find a spot to locate your hub. It needs to be a site that is centrally located for all the computers that will be added to the LAN. Connect the power cables to the hub, and turn it on if it has a power switch (most do not). All the following steps, including configuration and troubleshooting, should be done one computer at a time. In other words, we want to successfully install an ethernet adapter, configure it, and connect it to the network on one computer before moving on to the next.

The first step is to physically install the new ethernet card in your computer. If your card has jumpers (most new cards do not), write down all the jumper settings for future reference (just in case). When the card is installed, start up the computer, and if it is a Linux machine, you are now ready for the configuration step. If it is not a Linux box, refer to the documentation that came with the card as to how to configure it.

Configuration:

Once you have the ethernet card installed in your Linux computer, you will have to load the appropriate driver. Remember, this is a temporary manual configuration. To determine how to permanently load the driver, you will have to refer to your distributions documentation. Assuming you are using a NE2000 PCI clone, you run

modprobe ne2k-pci

From the command line. To make sure the driver loaded properly, run

ifconfig -a

If you see an entry for eth0, the driver successfully loaded.

The next step is to configure the ethernet interface with the appropriate IP address information. Remember that we decided to use 192.68.128.1-254 as our address range. We are going to assume that you assigned 192.168.128.2 as an IP address for this computer. The command line to configure the ethernet interface with our new address is:

ifconfig eth0 192.168.128.2 netmask 255.255.255.0 broadcast 192.168.128.255 up

To test that our ethernet interface is up and running properly, we now run

ping -w 1 -c 1 192.168.128.2

If our ethernet interface has been configured correctly, you should see output similar to the following:

PING 192.168.128.2 (192.168.128.2) from 192.168.128.2 : 56(84) bytes of data. 64 bytes from 192.168.128.2: icmp_seq=1 ttl=255 time=0.182 ms --- 192.168.128.2 ping statistics --- 1 packets transmitted, 1 received, 0% loss, time 0ms rtt min/avg/max/mdev = 0.182/0.182/0.182/0.000 ms

If there is a problem at this point, it may mean that you need to go back and work with the driver (there may be configuration options that need to be set), or it may mean you have a bad ethernet card. Either way, it is now time to go find someone with more experience that can help.

If, on the other hand, all is well, you are now ready to connect an ethernet cable from your computer to the hub. Make sure that if your hub has a dedicated uplink port (sometimes referred to as a crossover port), that you do NOT use the uplink port. If your hub has a port that can be switched between uplink and normal mode, and you are going to connect the cable to that port, make sure it is switched to normal mode. Most hubs and ethernet cards have a led that will light up when you have a successful connection. If both the light on the hub and the one on the card are not lit at this point, you have a problem, and you may want to go find some experienced help. Or, if you're brave and lucky, you can try another cable. If the other cable works, you've a bad cable that you can bring back to the store and complain about. If not, go find the experienced help we just mentioned.

If you have made it this far, congratulations. You've just successfully installed a node on your new network! Now you only have to do this with the rest of the computers you are adding to the network. If the rest of the computers are Linux computers, follow these same steps (with a different IP address, of course) for the rest. Otherwise, follow the documentation that came with your computer and ethernet card. Do this until all the computers have an ethernet card installed and configured, and are successfully connected via cable to the hub.

Testing:

If you've gotten this far, it means you've successfully added all your computers to the network and are ready to make sure they can all communicate with each other.

Because this Howto is set from a Linux perspective, we will now test your new network by using your Linux computer. Remember the ping command we used earlier? Well, now we need to ping the IP address of each computer you believe you have successfully connected to the network. Use the same ping command as before, once for each IP address of all the computers you have connected to the hub. In other words, if you have four computers on your new network, and assuming you used consecutive IP addresses starting at 192.168.128.2, you'll want to run the follow sequence of commands:

ping -w 1 -c 1 192.168.128.2 ping -w 1 -c 1 192.168.128.3 ping -w 1 -c 1 192.168.128.4 ping -w 1 -c 1 192.168.128.5

Naturally, you may have more or less than four computers, and you may have decided not to number them consecutively. However, just remember to ping the IP addresses of all the computers you believe are successfully connected to your network. If there is a problem with a particular IP address, you will get an error message that includes the statement "host unreachable". If this happens, 'tis time to speak to your preferred network guru.

I'm hoping, though, that all your newly assigned IP addresses will respond without problems, and that you'll be the proud owner of a new network. However, as a fledgling network administrator, your job is far from over. It is now time to make the configurations on your Linux boxes permanent, and thus to RTFM (Read The Fine Manual), so that each distribution of Linux on each computer is set up as a permanent member of your network.

Now that you have a network, the next step is to make it a useful in some way. Because all the computers can now communicate with each other, there are myriads of things you can do to share resources. Perhaps you want a single, easy to backup storage source for your files? Now you can set up a file server. You want to share a single printer with all the computers? No problem: set up a print server. Or how about connecting your new network to the Internet? Let's set up a gateway. You want to share files between MS-Windows, Macs and Linux? Try a Samba/Appletalk server. You can even set up your own local web server. With your own network, the choices are endless, and the power to configure it as you please is without bounds.

To quote a popular animated action hero, "To infinity and beyond!..."

More Information: