Setting up a Local Area Network
Using Red Hat Linux to connect two or more computers
Linux is increasingly popular in the computer networking/telecommunications industry. Acquiring the Linux operating system is a relatively simple and inexpensive task since virtually all of the source code can be downloaded from several different FTP or HTTP sites on the Internet. In addition, the most recent version of Red Hat Linux can be purchased from computer retail stores for between $25 and $50, depending on whether you purchase the standard or full version. The retail brand is indeed a worthwhile investment (vs. the free FTP or HTTP versions) since valuable technical support is included directly from the Red Hat Linux engineers for at least a year. This can be very helpful if, for instance, you can not resolve an installation/configuration problem after consulting the Red Hat Linux manuals.
This article describes how to put together a Local Area Network (LAN) consisting of two or more computers using the Red Hat Linux 6.2 operating system. A LAN is a communications network that interconnects a variety of devices and provides a means for exchanging information among those devices. The size and scope of a LAN is usually small, covering a single building or group of buildings. In a LAN, modems and phone lines are not required, and the computers should be close enough to run a network cable between them.
For each computer that will participate in the LAN, you'll need a network interface card (NIC) to which the network cable will be attached. You will also need to assign a unique hostname and IP address to each computer in the LAN (described later in this article), but this requires a basic understanding of TCP/IP (Transmission Control Protocol/Internet Protocol).
Introduction to TCP/IP
TCP/IP is the suite of protocols used by the Internet and most LANs throughout the world. In TCP/IP, every host (computer or other communications device) that is connected to the network has a unique IP address. An IP address is composed of four octets (numbers in the range of 0 to 255) separated by decimal points. The IP address is used to uniquely identify a host or computer on the LAN. For example, a computer with the hostname Morpheus could have an IP address of 192.168.7.127. You should avoid giving two or more computers the same IP address by using the range of IP addresses that are reserved for private, local area networks; this range of IP addresses usually begins with the octets 192.168.
LAN network address The first three octets of an IP address should be the same for all computers in the LAN. For example, if a total of 128 hosts exist in a single LAN, the IP addresses could be assigned starting with 192.168.1.x, where x represents a number in the range of 1 to 128. You could create consecutive LANs within the same company in a similar manner consisting of up to another 128 computers. Of course, you are not limited to 128 computers, as there are other ranges of IP addresses that allow you to build even larger networks.
There are different classes of networks that determine the size and total possible unique IP addresses of any given LAN. For example, a class A LAN can have over 16 million unique IP addresses. A class B LAN can have over 65,000 unique IP addresses. The size of your LAN depends on which reserved address range you use and the subnet mask (explained later in the article) associated with that range (see Table 1.).
Table 1. Address ranges and LAN sizes
|Address range||Subnet mask||Provides||Addresses per LAN|
|10.0.0.0 - 10.255.255.255.255||255.0.0.0||1 class A LAN||16,777,216|
|172.16.0.0 - 172.31.255.255||255.255.0.0||16 class B LANs||65,536|
|192.168.0.0 - 192.168.255.255||18.104.22.168||256 class C LANs||256|
Network and broadcast addresses
Another important aspect of building a LAN is that the addresses at the two extreme ends of the address range are reserved for use as the LAN's network address and broadcast address. The network address is used by an application to represent the overall network. The broadcast address is used by an application to send the same message to all other hosts in the network simultaneously.
For example, if you use addresses in the range of 192.168.1.0 to 192.168.1.128, the first address (192.168.1.0) is reserved as the network address, and the last address (192.168.1.128) is reserved as the broadcast address. Therefore, you only assign individual computers on the LAN IP addresses in the range of 192.168.1.1 to 192.168.1.127:
|Individual hosts:||192.168.1.1 to 192.168.1.127|
Each host in a LAN has a subnet mask. The subnet mask is an octet that uses the number 255 to represent the network address portion of the IP address and a zero to identify the host portion of the address. For example, the subnet mask 255.255.255.0 is used by each host to determine which LAN or class it belongs to. The zero at the end of the subnet mask represents a unique host within that network.
The domain name, or network name, is a unique name followed by a standard Internet suffixes such as .com, .org, .mil, .net, etc. You can pretty much name your LAN anything if it has a simple dial-up connection and your LAN is not a server providing some type of service to other hosts directly. In addition, our sample network is considered private since it uses IP addresses in the range of 192.168.1.x. Most importantly, the domain name of choice should not be accessible from the Internet if the above constraints are strictly enforced. Lastly, to obtain an "official" domain name you could register through InterNIC, Network Solutions or Register.com. See the Related topics section later in this article for the Web sites with detailed instructions for obtaining official domain names.
Another important step in setting up a LAN is assigning a unique hostname to each computer in the LAN. A hostname is simply a unique name that can be made up and is used to identify a unique computer in the LAN. Also, the name should not contain any blank spaces or punctuation. For example, the following are valid hostnames that could be assigned to each computer in a LAN consisting of 5 hosts: hostname 1 - Morpheus; hostname 2 - Trinity; hostname 3 - Tank; hostname 4 - Oracle; and hostname 5 - Dozer. Each of these hostnames conforms to the requirement that no blank spaces or punctuation marks are present. Use short hostnames to eliminate excessive typing, and choose a name that is easy to remember.
Table 2 summarizes what we have covered so far in this article. Every host in the LAN will have the same network address, broadcast address, subnet mask, and domain name because those addresses identify the network in its entirety. Each computer in the LAN will have a hostname and IP address that uniquely identifies that particular host. The network address is 192.168.1.0, and the broadcast address is 192.168.1.128. Therefore, each host in the LAN must have an IP address between 192.168.1.1 to 192.168.127.
Table 2. Sample IP addresses for a LAN with 127 or fewer interconnected computers
|Network address||192.168.1.0||Same for all hosts|
|Domain name||www.yourcompanyname.com||Same for all hosts|
|Broadcast address||192.168.1.128||Same for all hosts|
|Subnet mask||255.255.255.0||Same for all hosts|
|Hostname||Any valid name||Unique to each host|
|Host addresses||192.168.1.x||x must be unique to each host|
Assigning IP addresses in a LAN
There are two ways to assign IP addresses in a LAN. You can manually assign a static IP address to each computer in the LAN, or you can use a special type of server that automatically assigns a dynamic IP address to each computer as it logs into the network.
Static IP addressing
Static IP addressing means manually assigning a unique IP address to each computer in the LAN. The first three octets must be the same for each host, and the last digit must be a unique number for each host. In addition, a unique hostname will need to be assigned to each computer. Each host in the LAN will have the same network address (192.168.1.0), broadcast address (192.168.1.128), subnet mask (255.255.255.0), and domain name (yourcompanyname.com). It's a good idea to start by visiting each computer in the LAN and jotting down the hostname and IP address for future reference.
Dynamic IP addressing
Dynamic IP addressing is accomplished via a server or host called DHCP (Dynamic Host Configuration Program) that automatically assigns a unique IP address to each computer as it connects to the LAN. A similar service called BootP can also automatically assign unique IP addresses to each host in the network. The DHCP/ BootP service is a program or device that will act as a host with a unique IP address. An example of a DHCP device is a router that acts as an Ethernet hub (a communications device that allows multiple host to be connected via an Ethernet jack and a specific port) on one end and allows a connection to the Internet on the opposite end. Furthermore, the DHCP server will also assign the network and broadcast addresses. You will not be required to manually assign hostnames and domain names in a dynamic IP addressing scheme.
The LAN hardware
Assigning hostname and IP addresses will be useless if there is no hardware available to connect all the computers together. There are several different types of hardware schemes such as Ethernet, Token Ring, FDDI, Token Bus, etc. Since Ethernet is the most widely used hardware scheme, we will focus our attention on it. Ethernet is available from several different computer vendors, and it is relatively inexpensive. Ethernet is a 10-Mbps baseband LAN specification developed by Xerox, Intel, and Digital Equipment. In order to build an Ethernet hub you need the following: an Ethernet Network Interface Card (NIC) for each computer, an Ethernet compatible hub with at least the same number of ports as there will be computers in the LAN, and Ethernet cables (or 10BaseT cables) to connect each computer's NIC to the Ethernet hub.
Also make sure that the hardware of choice is compatible with the Red Hat Linux operating system. This hardware/software compatibility information is usually found in the Requirements section on the back of the box of each product. Alternatively, you could ask a computer sales person about hardware/software requirements. You can usually save money by purchasing LAN cards as a package vs. purchasing them individually.
When choosing an Ethernet hub ensure that it contains at least as many ports as there are computers that will participate in the LAN. It is always best to choose a hub with additional ports to allow for expansion.
If you plan to use all of the computers in the LAN to access the Internet via a local Internet Service Provider (ISP), the router/Ethernet combo is an ideal choice. The router/Ethernet unit is normally configured using any computer that is connected to the LAN. Assuming that all computers in the LAN will be running the Red Hat Linux operating system, a router will be required that can be configured using a Linux configuration program such as LinuxConf.
Finally, choose network cables to allow for expansion. Typically, most Ethernet networks use 10BaseT cables with RJ45 jacks at each end. It's always a good idea to purchase cables that are 1 or 2 times longer than the required length in case the structure (topology) of the LAN changes in the future.
Installing the hardware
Assuming that all LAN hardware is available, the next step is to install it. First turn off all the computers that will participate in the LAN. Next, open the case on each computer and install each NIC in the appropriate slot on the motherboard, being careful to follow the manufacturer's instructions.
Find a convenient but safe location for the Ethernet hub, preferably a centralized location in the same building or room along with the computers. Next, run the cable from the NIC in each computer to the Ethernet hub ensuring all cables are out of the way of users who will need physical access to each computer in the LAN. Moreover, make sure you follow all instructions provided with the LAN hardware before starting up any of the computers that will participate in the LAN.
If you are using a router to connect the LAN to the Internet or using a DHCP server, you will need to do some configuration as required by the user's manual. Lastly, assuming all computers are attached to the Ethernet hub via the NIC and a specific port on the hub, you can now begin the software configuration process using the Red Hat operating system.
Configuring the LAN
How you configure the computers on the LAN will depend on whether the Red Hat OS was installed before or after the LAN hardware. If you installed the LAN hardware before installing Red Hat you will be prompted for network configuration during the Red Hat installation process. However, if you installed the Red Hat OS after the LAN hardware, a program called "Kudzu" will detect the newly installed Ethernet card and initiate the configuration process automatically. Follow these steps when configuring each Ethernet card using the "Kudzu" program:
- During the bootup process look for a dialog box titled "Welcome to Kudzu." Press Enter to begin the configuration process.
- Next, you should see another dialog box that displays the brand name for the installed Ethernet card. Press Enter again to continue.
- After a brief delay you should see "Would You Like to Set up Networking".
- Select the NO option using the Tab key and then press Enter. I will describe setting up networking using a utility called LinuxConf later in this article.
At this point, the bootup process should continue normally and you will be required to log on to the computer as the root user. You should have been given the opportunity to create a root account during the initial installation of Red Hat.
Using LinuxConf to configure your Ethernet card
You can use an application program called LinuxConf to configure or reconfigure the NIC of each computer in the LAN. You can launch the LinuxConf utility by typing
linuxconf at the command prompt
of any terminal window in the KDE or GNOME desktop environment. Another
way to start the LinuxConf utility is to click the Main menu button,
select System, then LinuxConf. When the LinuxConf application is
displayed, follow the steps below to configure the Ethernet card:
- From the LinuxConf tree structure, select Config, Networking, Client Tasks, Basic Host Information.
- Type the fully qualified hostname that you assigned to this computer on the Host name tab.
- Next, click the Adaptor 1 tab, which displays your Ethernet card settings.
- Verify that the Enabled button is selected to ensure that the Ethernet card will be accessible.
- Choose the Manual option if you will not be using a DHCP or BootP server on your LAN and continue to step 6. Otherwise, if you will be using a DHCP or BootP server, choose either DHCP or BootP accordingly and continue to step 12.
- Enter this computer's hostname followed by a period and the domain name of the LAN for the Primary name + domain option.
- Enter the computer's hostname in addition to any aliases separated by a blank space under the Aliases option.
- Enter the IP address assigned to this computer next to IP Address (such as 192.168.1.1).
- Type in 255.255.255.0 for the Netmask.
- For net device, type eth0, which represents the first Ethernet card located inside the computer.
- The driver or Kernel Module option for the Ethernet card should automatically be filled in upon exiting LinuxConf.
- Click the Accept button to activate all changes.
- Repeat steps 1-12 for each computer in the LAN, verifying that you've entered the correct hostname and the corresponding IP address.
Another important step in setting up LAN is to configure the Nameserver specification, which is used by Linux to look up IP addresses when only the computer's hostname is given. There are two methods that are used by Red Hat Linux to resolve hostnames into IP addresses. One method is via Domain Name Services (DNS), and the other is by means of a local file at /etc/hosts. Locate the hosts file by typing
cd /etc to change to the /etc directory. The
/etc directory is where most system configuration files are found for each
computer. Next, follow the steps below to resolve hostnames into IP
address using the /etc/hosts file:
- In the left column of LinuxConf, open the Nameserver specification (DNS) category.
- Left-click the DNS Usage option. (The button should be pushed in.)
- Enter localdomain next to the Search Domain 1 category.
- If you know the primary and secondary IP addresses for the nameserver, which should be available for this Ethernet card, enter those in the IP of nameserver 1 and IP of nameserver 2 categories. Otherwise, you can leave those categories blank.
- Left-click the Accept button to activate all changes.
Hostname search path
The hostname search path is used by Red Hat Linux to search for IP addresses assigned to hostnames. To configure the hostname search path so that the local host (/etc/hosts) file is used to resolve local hostnames, and the ISP domain services to resolve Internet domain services, follow these steps:
- In the left column of LinuxConf, open the Routing and Gateways category.
- Select the Host Name Search path option.
- In the right column of LinuxConf, select the Multiple IPs for One Host option.
- Select the hosts, dns option in the right portion of LinuxConf.
- Left-click the Accept button to activate all changes.
Setting up /etc/hosts
The Red Hat Linux OS needs some way to find IP addresses within the LAN based on the each computer's hostname. I described earlier in the article that the Domain Name Service (DNS) is one method of resolving hostnames into IP addresses. In a DNS configuration the hostnames and IP addresses should already be listed in a pre-existing nameserver. Consult your local ISP to obtain those IP addresses. On the other hand, if there is a centralized nameserver, as with small LANs, a host file will need to be configured on each computer that was assigned a hostname, IP address, and any aliases. This configuration process involves editing a text file located at /etc/host. You will need to go to one of the computers in the LAN and follow the below steps in order to create and configure the /etc/hosts file:
- In the left column of LinuxConf, open the Misc category.
- Open the Information about hosts category. You should see an entry for this computer that includes the IP address, hostname, and any aliases.
- Left-click the Add button once to add an entry for another host in the LAN.
- Type the Primary + Domain Name for another host in the LAN in the dialog box that appears (such as trinity.yourcompanyname.com).
- Type one or more aliases for this computer next to the Alias option (such as tank).
- Enter the IP address for the hostname that you've assigned for this computer next to IP number.
- Left-click the Accept button to activate all changes.
- Repeat steps 1-7 for each computer in your LAN.
After you have done steps 1-7 for all computers, the /etc/hosts tab of LinuxConf should list one entry for every computer in your LAN, in addition to the local host's loopback interface. The local host name should appear as localhost. Finally, you can save all changes and exit the LinuxConf application by following the steps below:
- Left-click the Quit button in the /etc/host screen after all hostnames and IP addresses have been entered.
- To exit the LinuxConf application, left-click the Quit button at the bottom-left corner.
- Left-click the Activate the Changes button to activate all changes and exit LinuxConf.
Repeat for every host
Now that you have configured one computer in you LAN, you will need to go back and repeat all the above steps for each computer starting with the section "Configuring the LAN". If you would prefer a less time-consuming procedure of configuring each computer, you can modify the /etc/hosts file on each computer manually using a copy method.
You can copy the /etc/hosts file that you have just created to a floppy
disk or CD-ROM (if you have a writeable CD-ROM drive) and copy that file
to the /etc directory of each computer in your LAN. To copy the /etc/hosts
file to a floppy disk, type the command
cp /etc/hosts /mnt/floppy at the command prompt. Do this on
the computer where you configured the initial /etc/hosts file using the
Next, take the floppy to each computer in the LAN and type the command
/mnt/floppy hosts /etc/host in a
terminal window. This will copy the hosts file to the /etc directory on
each host. If you are using a CD-ROM, replace the
/mnt/floppy/ in the above commands with
//mnt/cdrom/ to copy files to and from a writeable CD-ROM.
The /etc/hosts file, as you probably noticed, is just a text file with a
list of hostnames and IP addresses separated into three columns. Lastly,
make sure that the local computer and its associated IP address are listed
twice and all the other computers in the LAN are listed only once.
Testing the LAN
To test the completely configured LAN, make sure that the computers are
able to communicate with each other after the bootup process. You can
start by typing
reboot at the command prompt at a command
terminal on each computer. This allows you to monitor the testing
information that scrolls down the screen as a standard procedure during
the Linux boot process. Look for the following information:
|Setting hostname:||<hostname you assigned to this computer>|
|Bringing up Interface lo:||<OK> or <FAILED>|
|Bringing up interface eth0||<OK> or <FAILED>|
The Setting hostname field should display the hostname that you assigned for this computer. The lo and eth0 interfaces should display [OK] to indicate that both tests were successful.
To determine whether each computer can communicate with every other
computer in the LAN, use the ping command. Open any terminal window on the
current host and type the command
ping <IP address> or <hostname>, where <IP
address> or <hostname> is the IP address and/or the hostname that
you assigned to this computer. Note that you must type either the IP
address or the hostname in order for the ping command to work
If you have configured the DNS nameserver specification properly, the
<hostname> command should
resolve the hostname into a corresponding IP address. Otherwise, you will
need to use the IP address that you should currently already have listed
for all computers in the LAN. The ping command will send messages across
the LAN to the designated IP address or computer. You should see several
messages or packets (consisting of bytes of information) if the computers
are "talking" or communicating with each other. These packets look similar
to the following:
64 bytes from 192.168.1.x : icmp_seq=0 ttl=255 time=0.8ms 64 bytes from 192.168.1.x : icmp_seq=0 ttl=255 time=0.8ms 64 bytes from 192.168.1.x : icmp_seq=0 ttl=255 time=0.8ms
Note that the "192.168.1" represents the LAN that this particular host is a member of and the x indicates the specific host number that you are attempting to ping (e.g. such as Oracle) which jointly makes up the IP address. You can press the Ctrl+C to terminate the test and you should see the following basic information about the entire ping test:
hostname.yourcompanyname.com ping statistics 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max = 0.3/0.4/0.8 ms
Verify that the packet loss is 0%, which is an immediate indication that the test was successful. However, there is a problem if the ping command results in the following message:
From hostname.comanyname.com (192.168.1.1): Destination Host Unreachable
This is an immediate indication that the two computers are not communicating at all. If the computers are not communicating, see the next section, "Troubleshooting the LAN". Otherwise, when you can successfully ping all other computers in the LAN from one designated computer, the overall basic communications functionality is indeed a success. At this point, you can consider this LAN to be a fully functional network that you can install and on which you can configure various network services as desired.
Troubleshooting the LAN
If you are unable to ping another computer in the LAN, here's how to get
to the source of the problem. First of all, it's a good idea to shut down
every computer in the LAN using the halt command. At the command prompt on
each computer, type
halt. The main reason for shutting down
all computers is to monitor feedback from the boot process when each
computer is started up again.
Check all cable connections between every computer, making sure that all RJ45 jacks are connected properly. After verifying that all the cables are secured properly, start each computer one at a time and look for the following response during the boot process:
Setting hostname: hostname.networkname [OK]
You can turn on the interactive mode by typing I at the LILO boot prompt during the initial bootup process of Red Hat to get a closer view of the feedback. Ensure that the hostname and network name that was assigned to this computer is spelled correctly. If this is not the case, you will need to return to the Basic Host Information section of LinuxConf. In interactive mode you will be prompted to start several services. Respond to each question with Yes and pay close attention to results of various tests. If the Kudzu program detects an Ethernet card, then this an indication that the card was not properly configured the first time around. Proceed to let Kudzu configure the card. When you are prompted to configure the network, choose "Yes" and type the correct IP address and other related information for this particular computer.
Another important response to examine carefully is the following:
Bringing up interface eth0 [OK]
This line indicates whether the Ethernet card is working properly. If this test fails you should check all network settings using LinuxConf to ensure that the card was configured properly. If the network settings are correct, there is probably a defect in the Ethernet card itself. In order to verify this, consult the manufacturer of the Ethernet card or a computer technician to determine whether or not the card is defective. Repeat the preceding troubleshooting procedures on each new Ethernet card installed.
The process of setting up a LAN using Red Hat Linux is a relatively straightforward task even for users with little or no LAN background when the preceding steps are carefully understood and performed. Moreover, there are vast resources available on the Web that describe in more detail the topics covered in this article. A good start would be to feed keywords (like LANs, configuring LANs, Linux network configuration, and TCP/IP) into your favorite Web search engine. You will be amazed at the wealth of information that is available on configuring LANs, building networks, Red Hat Linux network installation/configuration, the TCP/IP protocol suite, and on and on. Good luck!
- The InterNIC, Network Solutions site uses a search engine for checking official domain name availability on the Internet and registering that unique domain name solely for your business or personal Web site. It also gives you the ability to build your own Web site. They will even walk you through it and preview your design before you buy. Check out their listings of registered domain names "for sale". Network solutions will also provide you with id-Names used for worldwide registration and management of domain names. Register your name in over 50 countries online.
- Register.com also uses a search engine for checking official domain name availability on the Internet. In addition, the site features a trademark search engine, business resources, corporate services, Web site hosting, e-mail services, and more. The Web site shows you the 6 steps involved in registering your official domain name.
- Special Edition Using Red Hat Linux, by Alan Simpson with John Ray (Que, 2000), helps new users learn about Linux. It gives all computer users including those without UNIX system administration and network administration experience the skills and knowledge to use Linux to its fullest advantage whether in the home, small office, medium-sized business, or corporation.
- Local & Metropolitan Area Networks, Fifth Edition, by William Stallings (Prentice-Hall, Inc., 1997), focuses the technology, architecture, performance, internetworking, and network management of LANs.
- The Official Red Hat Linux Installation Guide (Red Hat Software Inc, 1999) is organized to guide users through the process of installing Red Hat Linux quickly and easily. It contains information on new functionality in Red Hat Linux 6.0, tasks you should perform prior to starting the Red Hat Linux installation, and detailed instructions for the Red Hat Linux installation process.
- Visit Red Hat for information about the company, as well as documentation and online technical support for the latest-and-greatest Red Hat Linux OS, training resources, and information about products and services offered at Red Hat Software Inc.