Data Link Layer
This layer addresses two main questions:
- How will the data be trasmitted? Framing.
- How should a shared communication channel be accessed? Multiplexing.
1. Ethernet
Ethernet is a standard of communication for LANs, MANs, and WANs. Data is transmitted over cables (commonly fibre optic), at high speeds. Cables are often shielded and foiled to protect against electromagnetic interference. It comes in three forms:
- Straight Through (MDI) - used to communicate between devices of different OSI layers (e.g. switch to router).
- Crossover (MDIX) - used to communicate between devices of the same OSI layer (e.g. switch to switch).
- Rollover - used to directly tap into a networking device (e.g. to troubleshoot).
Connecting a computer to a router requires a straight through cable, as even though a computer and router are both Layer 3 devices, you are actually connecting to a switch port on the router, which is a Layer 2 device.
Internally, the different cable types change the order in which the wires are connected to the pins on the RJ45 connector.

Some devices allow you to fake-swap between straight through and crossover cables, by using an Auto-MDIX feature. This is common in modern devices.
1.1 Ethernet Frames
Ethernet frames provide a well-defined interface to the Network Layer for sending / receiving packets. It identifies errors using a Cyclid Redundancy Check (CRC) checksum. The ethernet header contains:
- Destination Address
- Source Address
- EtherType (e.g. IPv4, ARP, etc.)
The ethernet footer contains the CRC checksum.
1.2 MAC Addresses
Each Network Interface Card (NIC) has a MAC address, a 48 bit address that is unique to each device. The first 24 bits are the Organizationally Unique Identifier (OUID), which identifies the manufacturer of the NIC. The last 24 bits are the Device Identifier. The MAC address also tells us if its an individual or group address, and if it is universally or locally administered.
A MAC address can be changed / faked.
2. Switches
Switches allow you to connect many devices to the same network. It is a smart wired-repeated. It only forwards messages out of the right port. It's goal is to connect you to other computers, by remembering which port your MAC address is connected to using a Forwarding Information Base (FIB).
You can connect hubs to switches or switches to switches, connecting many networks together. Switching has many methods:
- Store & Forward - the whole frame must be received first, and is then forwarded. Larger frames take longer to forward.
- Cut-Through - the frame is forwarded as soon as the destination MAC address is read. This is faster, but can forward corrupted frames. This means the recipient must check the CRC checksum.
3. WAPs
A wireless access point (WAP) goes by the name 802.11. It is not a router, merely a wireless repeater. It can connect you to other computers wirelessly, sometimes used to extend the range of networks.
4. Topologies
A typical switched ethernet toplogy has a single machine connected to each switch port, and avoids collisions by separating collision domains. This is ideal, but usually impossible.
4.1 Bus Topology
The bus topology uses a main coaxial cable to connect to call hosts. Data travels up and down the cable, called the bus. At the end of each cable, a BNC terminator is added to signify the end of the bus. This is a simple and cheap topology, but is slow and unreliable.
4.2 Ring Topology
The ring topology connects all hosts in a physical ring. Each hosts needs two NICs. Data flows around the ring. However, if one host fails, the whole network fails. It is also slow and unreliable.
4.3 Token Ring
The token ring topology connects all hosts in a logical ring by using an intermediate device called a Multistation Access Unit (MSAU). Data flows around by passing a token from one host to the next. When data is returned to the original sender, the token is released. This is faster and more reliable than a ring topology. This could adapt to dead hosts. However, it is expensive and complex.
This protocol uses a custom header which contains the token, and a trailer which contains the CRC checksum. It also contains the frame status, which tells the sender if the frame was received correctly, and the interframe gap, which is a pause between frames to separate them.
This protocol also supports a Priority Scheme, which allows hosts to send data with different priorities. This is useful for real-time data. It also supports a Reservation Scheme, which allows hosts to reserve the token for a certain amount of time. This may cause low proirity data to be delayed indefinitely.
The protocol supports acknowledgements with the frame status (FS), changed by the receiver.
Maintenance on a token ring network is complex, due to the different control frames and the need for a token. It is also difficult to troubleshoot.
4.4 FDDI
The Fiber Distributed Data Interface (FDDI) is a high-speed token ring network. It uses a dual ring topology, with one ring as a backup. It is used for high-speed data transfer, and is very reliable. It is also expensive and complex.
Hosts may short circuit the ring, causing the network to fail. This is fixed by a wrapback feature, which allows the network to continue running on a single ring.
4.5 Star Topology
Eventually, most networks started using switches. Hosts can connect directly to the switch, but there is no token to pass around. Anyone can communicate with anyone else without waiting for a token. Most modern networks use a star topology.
However, the central device is a single point of failure (SPoF).