The link layer is responsible for sending data between two computers on the same network. Aside from transmitting chunks of data (known as Frames), the link layer is also the layer primarily charged with detecting corrupt data. Most link layer protocols append what is known as a Cyclic Redundancy Code (CRC) to each frame so that the receiver can be very sure that the bits were not corrupted during transmission. CRCs use highly sophisticated mathematics to detect the most likely errors. If an error is detected, the link layer either discards or retransmits the frame, depending on the protocol.
Ethernet is by far the most widespread link layer protocol. In fact, it is so ubiquitous that the creators of WiFi dubbed it 'Wireless Ethernet' and made its interface similar to Ethernet to encourage adoption. As such, Ethernet makes a good case study for link layer technologies, so we focus on it on Inside The Wires.
The Ethernet protocol was originally designed by Bob Metcalfe (and others) during his work at the Xerox Palo Alto Research Center (PARC) in the early 1970s. In its early form, each computer was connected to a large coaxial cable using a metal tap. As is common for link layer technologies, the computer communicated with the cable using an Adapter, a special hardware component that is plugged into a computer and allows external wires to be plugged into the computer. The computers would transmit their signal onto the cable, hoping that it would not collide with a signal from any other computer attempting to transmit at the same time. If a collision did occur, the signal would become corrupt and the error would be detected, causing the receiver to discard the frame. The sender would detect the collision as well and, after waiting a randomized interval of time, would try again.
The original Ethernet was a Broadcast technology because every computer would hear every message on the network. In order to send a message to a particular receiver, Ethernet needed a way to uniquely identify computers. To do this, the designers of Ethernet decided that every Ethernet adapter would be hard-coded with a unique, 48-bit identifying number when it was manufactured. This number is known as a Medium Access Control (MAC) Address, or occasionally just as a Hardware Address, and is usually represented as a Hexadecimal number separated by colons. For example, 15:a6:8d:95:ce:33 could be a valid MAC address. When a computer sends a frame, it places its own MAC address in the 'source' field and the MAC address of the receiver in the 'destination' field. When a computer sees an Ethernet frame on the wire, it ignores the frame unless the destination MAC address matches its own address. If a computer wishes to send a frame to every computer on the network, it uses a special address known as the Broadcast Address, which any Ethernet adapter will accept.
Eventually, people got tired of winding large coaxial cables through their offices. Since most buildings already had several extra phone cables going to each room, the industry quickly developed a standard for Ethernet over telephone cables. As time went on, these cable eventually evolved into the category 5 and category 6 cables that are commonplace today. At first, the cables were connected together at Hubs, which just tied the wires together. However, since each computer was no longer attached to the same wire, researchers realized that they could reduce the number of collisions on Ethernet networks by replacing the hubs with Switches. A switch is a device that connects multiple Ethernet cables but selectively transmits signals instead of blindly sending them out every port. By observing the traffic it receives, a switch learns which MAC addresses are reachable from each port. Thus, when it receives a frame destined for a certain address, it can send the frame out the proper port and nowhere else. This dramatically reduces the number of collisions on Ethernet networks, since switches partition the network into smaller chunks. If every hub is replaced by a switch, then each of these chunks only has two devices using it: a computer and a switch.
Category 5 cables introduced an enhancement over telephone cables known as a Full Duplex Connection, whereby two sets of wires are used to connect machines, one for sending in each direction. With this approach, the number of collisions is reduced to zero on a fully switched network. Thus, most Ethernet LANs today are fully switched and very efficient.