Physical Layer & Media
The physical layer (OSI layer 1) moves raw bits from one device to the next as electrical voltages, light pulses or radio waves. It defines cables, connectors, signal levels, timing and speeds. It knows nothing about addresses or meaning: just ones and zeros.
Transmission media
| Medium | How bits travel | Typical speed | Max distance | Notes |
|---|---|---|---|---|
| Twisted pair copper (Cat5e/6/6A) | voltage changes on twisted wire pairs | 1–10 Gbit/s | 100 m | most office and home LANs; RJ45 connector |
| Coaxial cable | voltage on a shielded core | up to ~10 Gbit/s (DOCSIS) | km | cable TV and cable Internet |
| Multimode fibre | light from LEDs/lasers, many paths | 10–400 Gbit/s | 100–500 m | inside buildings and data centres |
| Single-mode fibre | laser light, one path | 10–800 Gbit/s+ | 10–100+ km | campus links, ISPs, undersea cables |
| Radio (Wi-Fi, 4G/5G) | modulated radio waves | 0.1–several Gbit/s | metres to km | shared medium, interference |
| Satellite | radio to/from orbit | 0.05–0.5 Gbit/s | global | high latency for geostationary orbits |
The twisting in twisted pair cancels electrical interference. Fibre is immune to it, much harder to tap, and can run far longer, which is why every long-distance link is fibre.
Encoding bits as signals
A cable can't send "1" directly; it sends a changing signal, and both sides agree on how to read it. A simple historic scheme is Manchester encoding (used by 10 Mbit/s Ethernet): every bit has a transition in the middle, low→high for 1 and high→low for 0. The guaranteed transition lets the receiver keep its clock in sync.
def nrz(bits):
return "".join("‾" if b == "1" else "_" for b in bits)
def manchester(bits):
# IEEE 802.3 convention: 0 = high then low, 1 = low then high
return "".join("_‾" if b == "1" else "‾_" for b in bits)
bits = "10110001"
print("bits: ", " ".join(bits))
print("NRZ: ", " ".join(c + " " for c in nrz(bits)))
print("Manchester:", " ".join(manchester(bits)))bits: 1 0 1 1 0 0 0 1
NRZ: ‾ _ ‾ ‾ _ _ _ ‾
Manchester: _ ‾ ‾ _ _ ‾ _ ‾ ‾ _ ‾ _ ‾ _ _ ‾
Look at the NRZ line for 000: a long flat signal with no transitions. With a long enough run, the receiver can lose count of how many bits passed. Modern Ethernet uses smarter codes (such as 8b/10b and 64b/66b) that add a few extra bits to guarantee transitions:
for name, data_bits, line_bits in [("8b/10b (1G fibre)", 8, 10), ("64b/66b (10G)", 64, 66)]:
overhead = (line_bits - data_bits) / line_bits
print(f"{name:<18} {line_bits - data_bits} extra bits per {data_bits}: overhead {overhead:.1%}")
# 10GBASE-R signals at 10.3125 Gbaud to carry exactly 10 Gbit/s of data
print(10.3125 * 64 / 66, "Gbit/s of data")8b/10b (1G fibre) 2 extra bits per 8: overhead 20.0%
64b/66b (10G) 2 extra bits per 64: overhead 3.0%
10.0 Gbit/s of data
Bandwidth, delay and the "pipe"
Two delays add up for every packet on a link:
- Transmission delay: the time to push all the packet's bits onto the link = size / bandwidth.
- Propagation delay: the time for a bit to travel the length of the link = distance / signal speed.
Their product with bandwidth, the bandwidth-delay product, tells you how many bits are "in flight" inside the cable at once. It matters a lot for TCP, as you will see later.
def delays(packet_bytes, bandwidth_bps, distance_m, speed_mps=2e8):
transmission = packet_bytes * 8 / bandwidth_bps
propagation = distance_m / speed_mps
return transmission, propagation
cases = [
("1 Gbit/s LAN, 100 m", 1e9, 100),
("10 Mbit/s DSL, 5 km", 10e6, 5_000),
("100 Gbit/s undersea, 6000 km", 100e9, 6_000_000),
]
for name, bw, dist in cases:
t, p = delays(1500, bw, dist)
in_flight = bw * p / 8
print(f"{name:<30} transmit {t * 1e6:9.3f} us propagate {p * 1e6:9.1f} us "
f"in flight {in_flight:,.0f} bytes")1 Gbit/s LAN, 100 m transmit 12.000 us propagate 0.5 us in flight 62 bytes
10 Mbit/s DSL, 5 km transmit 1200.000 us propagate 25.0 us in flight 31 bytes
100 Gbit/s undersea, 6000 km transmit 0.120 us propagate 30000.0 us in flight 375,000,000 bytes
On the LAN the bits leave the card slower than they cross the cable. On the undersea cable, 375 MB of data is travelling inside the fibre at any moment.
Duplex and the link light
- Simplex: one direction only (a TV broadcast).
- Half duplex: both directions, but one at a time (old hubs, walkie-talkies, a single Wi-Fi channel).
- Full duplex: both directions at once. Switched Ethernet uses separate wire pairs or fibres for each direction, so there are no collisions.
When you plug in a cable, the two ends auto-negotiate speed and duplex. A classic layer-1 fault is a duplex mismatch (one side full, the other half), which "works" but is painfully slow with many errors.
ethtool eth0Sample output:
Settings for eth0:
Supported link modes: 10baseT/Full 100baseT/Full 1000baseT/Full
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: on
Port: Twisted Pair
Link detected: yesTip: Troubleshooting always starts at layer 1. Is the link light on? Is the cable seated? Does
ethtool(Linux) or the adapter status (Windows) report the expected speed and duplex? Surprisingly many "network problems" are a bad cable.
Test yourself
What is the standard maximum length of a twisted-pair Ethernet segment?
- 10 m
- 100 m
- 1 km
- 10 km
Which medium is used for long-distance and undersea links?
- Cat6 copper
- Coaxial cable
- Single-mode fibre
- Wi-Fi
How long does it take to transmit a 1500-byte packet onto a 12 Mbit/s link?
- 0.125 ms
- 1 ms
- 8 ms
- 12 ms