Setting Up a Basic Ethernet LAN on a Linux PC
You can set up a basic Ethernet LAN on a Linux PC. Ethernet is a standard way to move packets of data among two or more computers connected to a single hub, router, or switch. (You can create larger networks by connecting multiple Ethernet segments with gateways.) To set up an Ethernet LAN, you need an Ethernet card for each PC. Linux supports a wide variety of Ethernet cards for the PC.
Ethernet is a good choice for the physical data-transport mechanism for the following reasons:
- Ethernet is a proven technology that has been in use since the early 1980s.
- Ethernet provides good data-transfer rates — typically, 100 million bits per second (100 Mbps), although Gigabit Ethernet (1,000 Mbps) is now common.
- Ethernet hardware is often built into PCs or can be installed at a relatively low cost. (PC Ethernet cards cost about $10 to $20.)
- With wireless Ethernet, you can easily connect laptop PCs to your Ethernet LAN without having to run wires all over the place.
How Ethernet works
What makes Ethernet tick? In essence, it’s the same thing that makes any conversation work: listening and taking turns.
In an Ethernet network, all systems in a segment are connected to the same wire. A protocol is used for sending and receiving data because only one data packet can exist on the single wire at any time. An Ethernet LAN uses a data-transmission protocol known as Carrier-Sense Multiple Access/Collision Detection (CSMA/CD) to share the single transmission cable among all the computers. Ethernet cards in the computers follow the CSMA/CD protocol to transmit and receive Ethernet packets.
The way that the CSMA/CD protocol works is similar to the way in which you have a conversation at a party. You listen for a pause (that’s sensing the carrier) and talk when no one else is speaking. If you and another person begin talking at the same time, both of you realize the problem (that’s collision detection) and pause for a moment; then one of you starts speaking again. As you know from experience, everything works out.
In an Ethernet LAN, each Ethernet card checks the cable for signals; that’s the carrier-sense part. If the signal level is low, the Ethernet card sends its packets on the cable; the packet contains information about the sender and the intended recipient. All Ethernet cards on the LAN listen to the signal, and the recipient receives the packet. If two cards send out a packet simultaneously, the signal level in the cable rises above a threshold, and the cards know that a collision has occurred. (Two packets have been sent out at the same time.) Both cards wait for a random amount of time before sending their packets again.
Ethernet sends data in packets (discrete chunks also known as frames). You don’t have to hassle much with the innards of Ethernet packets except to note the 6-byte source and destination addresses. Each Ethernet controller has a unique 6-byte (48-bit) address at the physical layer; every packet must have one.
What is Ethernet?
Ethernet was invented in the early 1970s at the Xerox Palo Alto Research Center (PARC) by Robert M. Metcalfe. In the 1980s, Ethernet was standardized by the cooperative effort of three companies: Digital Equipment Corporation (DEC), Intel, and Xerox.
Using the first initials of the company names, that Ethernet standard became known as the DIX standard. Later, the DIX standard was included in the 802-series standards developed by the Institute of Electrical and Electronics Engineers (IEEE). The final Ethernet specification is formally known as IEEE 802.3 CSMA/CD, but people continue to call it Ethernet.
Ethernet cables and Linux PCs
Any time you hear experts talking about Ethernet, you’ll also hear some bewildering terms used for the cables that carry the data. Here’s a quick rundown.
The original Ethernet standard used a thick coaxial cable nearly half an inch in diameter. This wiring is called thicknet, thickwire, or just thick Ethernet although the IEEE 802.3 standard calls it 10Base5. That designation means several things: The data-transmission rate is 10 megabits per second (10 Mbps); the transmission is baseband (which simply means that the cable’s signal-carrying capacity is devoted to transmitting Ethernet packets only), and the total length of the cable can be no more than 500 meters. Thickwire was expensive, and the cable was rather unwieldy. Unless you’re a technology-history buff, you don’t have to care one whit about 10Base5 cables.
Nowadays, several other forms of Ethernet cabling are more popular, and the days of thickwire, and even thinwire, have given way to Ethernet over unshielded twisted-pair cable (UTP), known as 1xxBaseT where the xx represents the speed such as 100BaseT4, 100BaseT2, and 100BaseTX for 100-Mbps Ethernet and 1000BaseT for Gigabit Ethernet. The Electronic Industries Association/Telecommunications Industries Association (EIA/TIA) defines the following categories of shielded and unshielded twisted-pair cables:
- Category 1 (Cat 1): Traditional telephone cable.
- Category 2 (Cat 2): Cable certified for data transmissions up to 4 Mbps.
- Category 3 (Cat 3): Cable that can carry signals up to a frequency of 16 MHz. Cat 3 was the most common type of wiring in old corporate networks, and it normally contains four pairs of wire. As network speeds pushed the 100 Mbps speed limit, Category 3 became ineffective; it’s now considered to be obsolete.
- Category 4 (Cat 4): Cable that can carry signals up to a frequency of 20 MHz. Cat 4 wires aren’t common and are now considered to be obsolete.
- Category 5 (Cat 5): Cable that can carry signals up to a frequency of 100 MHz. Cat 5 cables normally have four pairs of copper wire. Cat 5 UTP is the most popular cable used in new installations today. This category of cable was superseded by Category 5e (enhanced Cat 5).
- Category 5e (Cat 5e): Similar to Cat 5 but with improved technical parameters to mitigate communication problems. Cat 5e cables support 10BaseT, 100BaseT4, 100BaseT2, and 100BaseTX and 1000BaseT Ethernet. Nowadays, Cat 5e is the minimum acceptable wiring.
- Category 6 (Cat 6): Similar to Cat 5e but capable of carrying signals up to a frequency of 250 MHz. Category 6 twisted-pair uses a longitudinal separator, which separates each of the four pairs of wires. This extra construction significantly reduces the amount of crosstalk in the cable and makes the faster transfer rates possible. Cat 6 cables can support all existing Ethernet standards as well as the Gigabit Ethernet standard 1000BaseTX.
- Category 6a (Cat 6a): Also called augmented 6. This category offers improvements over Category 6 by offering minimum 500 MHz of bandwidth. It specifies transmission distances up to 100 meters with 10 Gbps networking speeds.
- Category 7 (Cat 7): The newest in wide use as of this writing. The big advantage to this cable is that shielding has been added to individual pairs and to the cable as a whole to greatly reduce crosstalk. Category 7 is rated for transmission of 600 MHz and is backward-compatible with Category 5 and Category 6. Category 7 differs from the other cables in this group in that it isn’t recognized by the EIA/TIA and that it’s shielded twisted-pair. (All others listed as exam objectives are unshielded.)
To set up a Gigabit Ethernet network, you need either an Ethernet hub — a hardware box with RJ-45 jacks. (This type of jack looks like a big telephone jack) or an Ethernet switch — like a hub, but smarter. You build the network by running twisted-pair wires (usually, Category 5 cables) from each PC’s Ethernet card to this switch/hub. You can get an eight-port switch for about $40.
When you install most the Linux distributions on a PC connected with an Ethernet card, the Linux kernel automatically detects the Ethernet card and installs the appropriate drivers. The installer also lets you set up TCP/IP networking.
The Linux kernel loads the driver for the Ethernet card every time it boots. To verify that the Ethernet driver is loaded, type the following command in a terminal window:
dmesg | grep eth0
On a Linux PC, you could get the following output when you type that command:
eth0: RealTek RTL8139 at 0xf0e20000, 00:0c:76:f4:38:b3, IRQ 161 eth0: Identified 8139 chip type ‘RTL-8101’ eth0: link up, 100Mbps, full-duplex, lpa 0x45E1 eth0: no IPv6 routers present
You should see something similar showing the name of your Ethernet card and related information.