Sub topic 3
Layer 1: Physical, bits on the medium
This chapter assumes you know what a network and an IP address are, and that you can run simple terminal commands. It covers Layer 1 of the OSI model, the layer that turns bits into signals on a wire, a fiber, or the air.
What Layer 1 is responsible for
Layer 1 moves raw bits between two directly connected devices. It has no idea what the bits mean. It does not know about MAC addresses, IP addresses, or ports. Its job is narrow:
- Define the physical medium: copper cable, optical fiber, or radio spectrum.
- Define the connectors and pin layouts, such as RJ45 or LC.
- Define how a bit is represented as a signal: voltage levels, light pulses, or radio waveforms.
- Define timing: how fast bits are sent and how the receiver stays in step with the sender.
- Define the topology and the direction of transmission: simplex, half duplex, or full duplex.
Layer 2 hands Layer 1 a frame as a stream of bits. Layer 1 sends them and delivers the received bits upward. If a bit flips in transit, Layer 1 does not notice. Detecting that is the job of higher layers, such as the frame check sequence at Layer 2.
From bits to signals
A bit is an abstract 0 or 1. A signal is a physical quantity that changes over time, such as a voltage on a copper pair, a pulse of light in a fiber, or the phase of a radio wave. The transmitter converts bits to a signal (encoding or modulation), and the receiver converts the signal back to bits.
Line coding
A naive scheme would send 0 as low voltage and 1 as high voltage. This fails on long runs of identical bits. The receiver sees a flat line and cannot count how many bits passed, because it has no transitions to synchronize its clock against. Real link standards use line codes that guarantee transitions.
| Scheme | Idea | Where it appears |
|---|---|---|
| Manchester | Each bit has a mid-bit transition, so the clock is embedded in the data. | 10BASE-T Ethernet |
| 4B/5B | Every 4 data bits map to a 5-bit code with enough transitions. | 100BASE-TX Fast Ethernet |
| 8b/10b | Every 8 bits map to a 10-bit code that keeps the signal balanced. | 1000BASE-X fiber Gigabit Ethernet |
| 64b/66b | Every 64 bits get a 2-bit header that guarantees a transition. | 10 Gigabit Ethernet and faster |
| PAM-4 | Four voltage levels carry 2 bits per symbol. | 50, 100, and 400 Gigabit Ethernet |
Encoding costs bandwidth. With 4B/5B, a 100 Mbit/s data rate needs a 125 Mbaud signaling rate, which is 25 percent overhead. 64b/66b has only about 3 percent overhead, which is one reason it replaced earlier codes at high speeds.
The terms bit rate and baud rate differ. Bit rate counts bits per second. Baud rate counts signal changes (symbols) per second. When a symbol carries more than one bit, as with PAM-4, the bit rate is higher than the baud rate.
Modulation for radio
Wireless links cannot send raw voltage levels through the air. They modulate a carrier wave by changing its amplitude, frequency, or phase. Wi-Fi uses schemes such as QAM, which combines amplitude and phase changes. Higher-order modulation carries more bits per symbol, but it needs a cleaner signal. This is why Wi-Fi speed drops as you move away from the access point: the radio falls back to a simpler modulation that tolerates more noise.
Transmission media
Twisted pair copper
Twisted pair cable holds pairs of copper wires twisted together. The twisting makes outside interference affect both wires of a pair equally, so the receiver can cancel it out by comparing the two. Ethernet over twisted pair uses an RJ45 connector and has a standard maximum segment length of 100 meters.
| Category | Typical use | Max Ethernet speed over 100 m |
|---|---|---|
| Cat5 | Older networks | 100 Mbit/s |
| Cat5e | Common office cabling | 1 Gbit/s |
| Cat6 | Higher-quality office cabling | 1 Gbit/s (10 Gbit/s up to about 55 m) |
| Cat6a | Data centers and new builds | 10 Gbit/s |
Shielded variants (STP, S/FTP) reduce interference further. Unshielded cable (UTP) is cheaper and more common.
Optical fiber
Fiber carries data as pulses of light through a glass core. It is immune to electromagnetic interference and covers much longer distances than copper.
- Multimode fiber has a wide core. Light takes multiple paths, which spreads pulses out over distance. It suits short runs, typically up to a few hundred meters at 10 Gbit/s, such as inside a building or data center.
- Single-mode fiber has a very narrow core. Light takes essentially one path, so pulses stay sharp over tens of kilometers. It costs more in optics but is the standard for long links.
Wireless
Wi-Fi, cellular, and Bluetooth use radio. The medium is shared, so devices must take turns or use separate channels. Walls, distance, and other transmitters on the same frequency degrade the signal.
Duplex and shared media
Duplex describes the direction of transmission on a link.
- Simplex: data flows one way only.
- Half duplex: both directions are possible, but only one at a time.
- Full duplex: both directions at once.
Early Ethernet used shared coax cable or hubs. Every device heard every transmission, so two devices sending at once caused a collision. Ethernet handled this with CSMA/CD, where a sender listens, detects a collision, and retries after a random delay. Modern switched Ethernet gives each device its own link with separate transmit and receive paths, so it runs full duplex and has no collisions.
The duplex mismatch problem
If one end of a link is set to full duplex and the other end to half duplex, the link comes up but performs badly. The half-duplex side sees the full-duplex side's traffic as collisions and backs off, and it reports errors. Symptoms are very slow transfers and rising error counters even though the link light is green. Automatic negotiation normally prevents this. The problem appears when one side is hard-coded and the other negotiates, because the negotiating side cannot learn the other's setting and defaults to half duplex.
Devices that work at Layer 1
- Repeater: regenerates a weakened signal so it can travel farther.
- Hub: a multiport repeater. It copies every incoming signal to all other ports, so it creates one shared collision domain.
- Media converter: converts between media types, for example copper to fiber.
- Cables, connectors, patch panels, and transceivers (such as SFP modules).
None of these devices read frames. They handle signals only. This is why a hub wastes capacity: it cannot decide where a frame should go.
How Layer 1 fits the stack
The diagram shows two hosts. Data moves down the sender's stack, crosses the medium as signals, and moves back up the receiver's stack. Only Layer 1 touches the medium.
Common Layer 1 faults
Physical faults are frequent and are easy to miss because they produce symptoms at every higher layer. A dead cable looks like a dead application.
| Fault | Typical cause | Typical symptom |
|---|---|---|
| No link | Unplugged, broken, or wrong cable; dead port | Link light off; interface shows down |
| Intermittent link | Damaged connector, loose plug, bad crimp | Interface flaps up and down |
| High error counts | Interference, cable too long, poor termination | CRC errors, slow transfers, retransmissions |
| Speed or duplex mismatch | Mixed manual and automatic settings | Link up, very poor throughput |
| Dirty or bent fiber | Dust on the connector, tight bend | Low optical power, errors |
| Weak wireless signal | Distance, walls, interference | Low data rate, dropped connections |
Checking Layer 1 from a Linux host
The first step in bottom-up troubleshooting is to check the interface itself. Replace eth0 with your interface name, which ip link show lists.
ip link show eth0
ethtool eth0
ethtool -S eth0ip link showreports flags such asUPandLOWER_UP.LOWER_UPmeans the physical link is detected. An interface can be administrativelyUPwhile still lackingLOWER_UPbecause no cable is connected.ethtool eth0shows the negotiated speed, duplex mode, andLink detected: yesorno.ethtool -S eth0prints driver statistics. Counters such asrx_crc_errorsthat keep growing point to a physical problem.
You can also read the link state without extra tools. This Python script reads it from the Linux /sys filesystem:
from pathlib import Path
def link_info(interface):
base = Path("/sys/class/net") / interface
info = {}
for name in ("operstate", "speed", "duplex"):
try:
info[name] = (base / name).read_text().strip()
except OSError:
info[name] = "unavailable"
return info
for iface in sorted(p.name for p in Path("/sys/class/net").iterdir()):
print(iface, link_info(iface))On a wired interface with a working link it prints something like eth0 {'operstate': 'up', 'speed': '1000', 'duplex': 'full'}. Speed is in Mbit/s. A virtual or disconnected interface shows unavailable for speed and duplex, because the kernel returns an error when no link exists.
Edge cases and limits
- Maximum cable length is a limit on signal quality, not a hard cutoff. A 120 m run may work today and fail when the temperature changes or a nearby motor starts.
- Crosstalk is interference between pairs in the same cable. Poorly terminated connectors, where the pairs are untwisted too far, increase it. Cable category ratings assume proper termination.
- Auto-MDI/MDIX in modern ports detects and corrects a swapped transmit and receive pair, so crossover cables are rarely needed now.
- Power over Ethernet adds electrical power to the same twisted pair. This is a Layer 1 feature, and it adds heat and power limits to cable choice.
- Layer 1 has no addressing. On a point-to-point link, the other end is implied by the cable. On a shared medium such as Wi-Fi, addressing begins at Layer 2.
Summary
Layer 1 converts bits to physical signals and back, using a medium, a connector standard, a line code or modulation scheme, and timing. Its devices (cables, repeaters, hubs, transceivers) never read frames. Many faults that look like software problems start here, so check link state, speed, duplex, and error counters before looking higher.
Exercise
A server's interface shows UP in ip link show but no LOWER_UP, and ethtool reports Link detected: no. At which layer should you investigate first, and name two likely causes.
Show answer
Layer 1. The interface is enabled in software, but no physical link is detected. Likely causes are an unplugged or broken cable, a dead switch port, or a failed transceiver or network card.
Exercise
Two hosts are connected and the link light is green, but file transfers are very slow and the CRC error counter keeps rising. One port is hard-coded to 100 Mbit/s full duplex and the other is set to automatic negotiation. What is the likely problem, and how do you fix it?
Show answer
A duplex mismatch. The negotiating side cannot detect the hard-coded setting, so it falls back to half duplex and sees the full-duplex side's traffic as collisions. Fix it by setting both ends to automatic negotiation, or by setting both ends to the same fixed speed and duplex.
Exercise
Why does 100BASE-TX with 4B/5B coding use a 125 Mbaud signaling rate to carry 100 Mbit/s of data?
Show answer
4B/5B maps every 4 data bits to a 5-bit code. Five signal bits are sent for every four data bits, so the signaling rate is 100 × 5/4 = 125 Mbaud. The extra bits guarantee enough transitions for the receiver to stay synchronized.