Red Hat Fedora Linux 3 Bible

Connecting the computers in your organization via a LAN can save you a lot of time and money. The amount of money you put into networking hardware, even in a small configuration (less than five or six users), can save you from buying multiple printers, backup media, and other hardware. Add a single, shared Internet connection and you no longer need multiple modems and Internet accounts.

With a LAN, you don’t have to run down the hall anymore with your file on a disk to print it on your friend’s printer. Information that had to wait for the mailroom to make the rounds can be sent in an instant to anyone (or everyone) on your LAN.

With a LAN, you begin to open the greatest potential of Linux — its ability to act as a server on a network. Because Fedora is more robust and feature-rich than other computing systems (certainly for the price), adding it to your LAN can provide a focal point to workstations that could use Linux as a file server, a mail server, a print server, or a boot server. (Those features are described later in this book.)

Creating and configuring a LAN consists of these steps:

  1. Setting up LAN hardware — This entails choosing a network topology, purchasing the equipment you need, and installing it (adding cards and connecting wires or using wireless antennas).

  2. Configuring TCP/IP — To use most of the networking applications and tools that come with Linux, you must have TCP/IP configured. TCP/IP lets you communicate not only with computers on your LAN, but with any computers that you can reach on your LAN, modem, or other network connection (particularly via the Internet).

Setting up LAN hardware

Even with a simple LAN, you must make some decisions about network topology (that is, how computers are connected). You must also make some decisions about network equipment (network interface cards, wires, hubs, and so on).

LAN topologies

Most small office and home LANs connect computers together in one of the following topologies:

You can configure a wireless Ethernet LAN in several different topologies, depending on how you want to use the LAN. With a wireless LAN, each computer broadcasts in the air rather than across wires. Here are some examples of wireless topologies:

For our purposes, we focus on star (wired) and peer-to-peer (wireless) topologies. Common to both of these topologies is the protocol used to send data over those wired and wireless media — the Ethernet protocol.

LAN equipment

The equipment that you need to connect your LAN can include some or all of the following:

Cross-reference: 

For a complete description of wireless hardware, see the “Choosing wireless hardware” section later in this chapter.

One piece of equipment that I won’t go into yet is a router. A router is used to direct information from the LAN to other LANs or the Internet.

Cross-Reference: 

Machines that carry out routing functions are described in Chapter 16.

LAN equipment setup

With an Ethernet NIC, appropriate cables, and a hub (or switch), you are ready to set up your wired Ethernet LAN. If you don’t yet have an Ethernet card for your computer, refer to the sidebar “Choosing an Ethernet Card” for information on choosing a card that will work in Linux. The steps for setting up an Ethernet LAN are:

  1. Power down each computer and physically install the NIC card (following the manufacturer’s instructions).

  2. Using cables appropriate for your NIC cards and hub, connect each NIC to the hub.

  3. Power up each computer.

  4. If Fedora is not installed yet, install the software and reboot (as instructed). Chapter 2 tells you how to configure your Ethernet card while installing Linux.

  5. If Fedora is already installed, refer to the “Configuring TCP/IP for your LAN” section for information on configuring your Ethernet cards.

  6. When the system comes up, your Ethernet card and interface (eth0) should be ready to use. See the section "Checking your Ethernet connection" later in this chapter to learn how to determine whether your Ethernet connection is working.

Choosing an Ethernet Card

There are several ways to find out about supported Ethernet cards for Linux. Here are some suggestions:

Configuring TCP/IP for your LAN

When you install Fedora, you are given the opportunity to add your TCP/IP host name and IP address, as well as some other information, to your computer or choose to have that information automatically provided using DHCP, or Dynamic Host Configuration Protocol. You also can set up a way to reach other computers on your LAN. That’s typically done by adding computer names and IP addresses to your /etc/hosts file (as described here) or (often with more than a few machines) by using a DNS server.

Cross-reference: 

DNS is discussed in Chapter 16. Configuring your own DNS server is described in Chapter 25.

If you did not configure your LAN connection during installation of Linux, you can do so at any time using the Network Configuration window (neat command). The IP address and host names can be assigned statically to an Ethernet interface or retrieved dynamically at boot time from a DHCP server.

Note 

A computer can have more than one IP address because it can have multiple network interfaces. Each network interface must have an IP address (even if the address is assigned temporarily). So, if you have two Ethernet cards (eth0 and eth1), each needs its own IP address. Also, the address 127.0.0.1 represents the local host, so users on the local computer can access services in loopback.

To define your IP address for your Ethernet interface, follow this procedure:

  1. Start the Network Configuration. From the red hat menu, click System Settings ® Network or, as root user from a Terminal window, type neat. (If prompted, type the root password.) The Network Configuration window appears.

  2. Click the Devices tab. A listing of your existing network interfaces appears.

  3. Double-click the eth0 interface (representing your first Ethernet card). A pop-up window appears, enabling you to configure your eth0 interface. Figure 15-6 shows the Network Configuration window and the pop-up Ethernet Device window configuring eth0.

    Figure 15-6:   Configure your LAN interface using the Network Configuration window.

  4. On the Ethernet Devices window that appears, you can enter the following information:

    • Activate device when computer starts: Check here to have eth0 start at boot time.

    • Allow all users to enable and disable the device: Check to let non-root users enable and disable the network interface.

    • Enable IPv6 configuration for this interface: Check here if you are connected to an IPV6 network. (Most networks are still IPV4.)

  5. On the same window, you must choose whether to get your IP addresses from another computer at boot time or enter the adresses yourself:

    • Automatically obtain IP address settings with: Select this box if you have a DHCP or BOOTP server on the network from which you can obtain your computer’s IP address, netmask, and gateway. DHCP is recommended if you have more than just a couple of computers on your LAN. (See Chapter 23 for how to set up a DHCP server.) You can, optionally, set your own host name, which can be just a name (such as jukebox) or a fully qualified domain name (such as jukebox.linuxtoys.net).

    • Statically set IP addresses: If there is no DHCP, or other boot server, on your LAN, you can add necessary IP address information statically by selecting this option and adding the following information:

      Address: Type the IP address of this computer into the Address box. This number must be unique on your network. For your private LAN, you can use private IP addresses (see the section, “Understanding IP Addresses” later in this chapter).

      Subnet Mask: Enter the netmask to indicate what part of the IP address represents the network. (Netmask is described later in this chapter.)

      Default Gateway Address: If a computer or router connected to your LAN is providing routing functions to the Internet or other network, type the IP address of the computer into this box. (Chapter 16 describes how to use NAT or IP masquerading and use Fedora as a router.)

  6. Click OK in the Ethernet Device window to save the configuration and close the window.

  7. Click File ® Save to save the information you entered.

  8. Click Activate in the Network Configuration window to start your connection to the LAN.

Identifying other computers (hosts and DNS)

Each time you use a name to identify a computer, as when browsing the Web or using an e-mail address, the computer name must be translated into an IP address. To resolve names to IP addresses, Fedora goes through a search order (based on the contents of three files in /etc: resolv.conf, nsswitch.conf, and host.conf). By default, it checks:

You can use the Network Configuration window to add:

To add host names, IP addresses, search paths, and DNS servers, do the following:

  1. Start the Network Configuration. As root user from a Terminal window, type neat or from the red hat menu, click System Settings ® Network. The Network Configuration window appears.

  2. Click the Hosts tab. A list of IP addresses, host names, and aliases appears.

  3. Click New. A pop-up window appears asking you to add the IP address, host name, and aliases for a host that you can reach on your network. Figure 15-7 shows the Network Configuration window and the pop-up window for adding a host.

    Figure 15-7:   Add hosts to /etc/hosts using the Network Configuration window.

  4. Type in the IP address number, host name, and, optionally, the host alias.

  5. Click OK.

  6. Repeat this process until you have added every computer on your LAN.

  7. Click the DNS tab.

  8. Type the IP address of the computers that serve as your Primary and Secondary DNS servers. You get these IP addresses from your ISP or, if you created your own DNS server, you can enter that server’s IP address.

  9. Type the name of the domain (probably the name of your local domain) to be searched for host names into the DNS Search Path box.

  10. Click File ® Save to save the changes.

  11. Click File ® Quit to exit.

Now, when you use programs such as ftp, ssh, or other TCP/IP utilities, you can use any host name that is identified on your local computer, exists in your search path domain, or can be resolved from the public Internet DNS servers. (Strictly speaking, you don’t have to set up your /etc/hosts file. You could use IP addresses as arguments to TCP/IP commands, but names are easier to work with.)

Adding Windows computers to your LAN

It is likely that you have other types of computers on your LAN in addition to those running Linux systems (at least for a few more years). If there is a DHCP server available on your LAN (or if you have configured one yourself as described in Chapter 23), Windows and most other computer systems can simply start up and begin using the network. In cases where your network card is not properly detected, or you want to set static IP addresses, you need to do some extra configuration.

The following are general steps for doing some manual steps to add your Windows computers to the Ethernet LAN you just created:

  1. Power down your computer and install an Ethernet card. (Most PC Ethernet cards will run on Windows.)

  2. Connect an Ethernet cable from the card to your hub.

  3. Reboot your computer. If your card is detected, Windows will either automatically install a driver or ask you to insert a disk that comes with the card to install the driver.

  4. Open the window to configure networking. (Start ® Settings ® Control Panel; then double-click the Network icon. If you have Windows XP, you also need to click “Set up or change your Internet connection.”). A window to change network properties appears.

  5. What you do next depends on the version of Windows you are running:

    For Windows 98:

    • Find the Ethernet card you have just installed in the list and select it.

    • Click Add. The Select Network Component Type pop-up window appears.

    • Double-click Protocol. The Select Network Protocol window appears.

    • Click Microsoft, and then double-click TCP/IP. A new entry should appear in your Network window that looks similar to the following, depending on your card:

      TCP/IP -> 3Com Etherlink III ISA

    • Double-click on that new entry. The TCP/IP Properties window should appear, similar to the one in Figure 15-8 for Windows XP.

      Figure 15-8:   Configure TCP/IP on Windows XP for your Ethernet LAN.

    For Windows 2000 or XP:

    • Click “Switch to classic view.”

    • Double-click the Network connections.

    • Double-click Local Area Connection. The Local Area Connection Status window appears.

    • Click Properties. The Local Area Connection Properties window appears.

    • Select Internet Protocol (TCP/IP), and click the Properties button. The Internet Protocol (TCP/IP) Properties window appears as shown in Figure 15-8.

  6. Click “Use the following IP address” to configure your IP address manually.

    Note 

    If you are using a DHCP server to assign IP addresses, click “Obtain an IP address automatically” instead. See Chapter 23 for information on setting up Linux as a DHCP server.

  7. Add the IP address, Subnet mask, and Default Gateway for this computer.

  8. Add the IP addresses of up to two DNS servers.

  9. Click OK. You may need to reboot Windows for the settings to take effect.

At this point, your Windows computer knows to listen on the network (via its Ethernet card) for messages addressed to the IP address you have just entered.

Категории