Physical layer: cables, fiber, Ethernet and the NIC
The Physical layer (Layer 1) turns a frame's bits into real signals: voltage on copper, light on fiber, radio on Wi-Fi. Cable type, distance limits, the NIC, speed and duplex all live here, and most "link down" or "slow link" problems start here.
4.1 What Layer 1 does
- The frame is just ones and zeros; Layer 1 converts the bits into a signal and puts it on the medium.
- Copper: electrical voltage. Fiber: light pulses. Wi-Fi: radio waves.
- Layer 1 only cares about bits and signals, not MAC or IP.
- Step 1
1.PC 192.168.24.10: NIC turns the frame into bits 10110010
- Step 2
2.Bits travel as voltage on the Cat6 cable
- Step 3
3.Switch receives the signal and forwards it
- Step 4
4.Server 192.168.24.20: NIC turns the signal back into bits
On fiber the same bits are light pulses, on Wi-Fi radio waves
4.2 Twisted pair copper cable
- 8 wires twisted into 4 pairs; the twist cancels noise (EMI) and crosstalk.
- UTP (Unshielded Twisted Pair) is the normal cable; STP adds foil shielding for noisy places like factories.
- One copper run can be at most 100 meters; after that the signal fades.
- RJ45 connector: 8 pins, one wire per pin in a fixed color order (T568A or T568B; offices mostly use T568B).
- Auto MDI-X on modern NICs adjusts the pairs automatically, so PC-to-PC crossover cables are no longer needed.
4.3 Categories: Cat5e, Cat6, Cat6a
| Category | Speed | Distance | Bandwidth |
|---|---|---|---|
| Cat5e | 1 Gbps | 100 m | 100 MHz |
| Cat6 | 1 Gbps (10 Gbps up to ~55 m) | 100 m | 250 MHz |
| Cat6a | 10 Gbps | 100 m | 500 MHz |
- Cat5e is today's minimum; Cat6a is used in new offices and data centers for full 10 Gbps at 100 m.
4.4 Beyond 100 m: repeater or fiber
- Two buildings 300 m apart: a direct copper run gets so weak that the Building B switch cannot understand it.
- Repeater (Layer 1): regenerates the weak signal at full strength and sends it on; it ignores MAC and IP.
- Fiber: bits travel as light pulses in a thin glass core; the better solution for distance.
- Step 1
1.Server in the data center
- Step 2
2.Multi mode fiber to the core switch (~300-550 m)
- Step 3
3.Core switch to the Delhi router
- Step 4
4.Single mode fiber, Delhi router to Noida router (40 km)
- Step 5
5.Light pulses arrive, the receiver turns them back into bits
4.5 Comparison: single mode vs multi mode fiber
| Point | Multi mode (MMF) | Single mode (SMF) |
|---|---|---|
| Core size | ~50 µm | ~9 µm |
| Light | Bounces along many paths | Laser, one straight path |
| Distance | 300-550 m (about 400 m at 10 Gbps) | 10-80+ km |
| Cost | Cheaper | Costlier optics |
| Used for | Inside a data center / building | ISP and long links between cities |
4.6 NIC, speed, duplex and autonegotiation
- NIC (Network Interface Card): converts the frame into a signal and the signal back into bits.
- Autonegotiation: when the cable is plugged in, the NIC and switch port exchange the speeds/duplex they support and pick the highest common one (e.g. 1 Gbps full).
- Half duplex: one side talks at a time, like a walkie-talkie (hubs, Wi-Fi).
- Full duplex: both sides send and receive together, like a phone call; twisted pair has separate pairs for each direction.
- Duplex mismatch: one side full, the other half: errors and a slow link.
- Step 1
1.Cable plugged in: PC NIC and switch port 1 detect the link
- Step 2
2.NIC sends: I can 10/100/1000 Full
- Step 3
3.Switch replies: me too, 1000 Full
- Step 4
4.Both pick the highest common mode
- Step 5
5.Link up: 1 Gbps Full on both ends
4.7 Hub and repeater: Layer 1 devices
- Hub: repeats bits from one port out of every other port; PC A's data for PC B is also seen by PC C and PC D (wasted bandwidth, security risk).
- All hub ports share one medium, so a hub runs half duplex.
- If PC B and PC D send together, the signals collide; both follow CSMA/CD, wait a random time and retry.
- More devices on a hub = more collisions = slower. A switch has full duplex ports, so no collisions.
| Device | Layer | What it does |
|---|---|---|
| Repeater | 1 | Regenerates a weak signal |
| Hub | 1 | Repeats bits out of all ports, half duplex, collisions |
| Switch | 2 | Forwards by MAC to one port, full duplex, no collisions |
4.8 Practical: speed and duplex with ethtool
Docker LAN: PC 192.168.24.10, server 192.168.24.20. ethtool is the Linux tool for NIC details.
ethtool eth0ethtool -i eth0ethtool -s eth0 speed 1000 \ duplex full autoneg offip link set eth0 downethtool eth0 | grep Linkip link set eth0 upethtool eth0 | grep Linkping -c 2 192.168.24.20$ ethtool eth0Settings for eth0: Speed: 10000Mb/s Duplex: Full Auto-negotiation: off Port: Twisted Pair Link detected: yes$ ethtool -i eth0driver: vethversion: 1.0supports-statistics: yes- Speed 10000Mb/s (10 Gbps), Duplex Full, Link detected: yes.
- driver: veth = Docker's virtual NIC; it reports a fixed speed with autonegotiation off.
$ ethtool -s eth0 speed 1000 duplex full autoneg offnetlink error: Not supported$ ip link set eth0 down$ ethtool eth0 | grep Link Link detected: no$ ip link set eth0 up$ ethtool eth0 | grep Link Link detected: yes$ ping -c 2 192.168.24.2064 bytes from 192.168.24.20: icmp_seq=1 ttl=64 time=6.96 ms64 bytes from 192.168.24.20: icmp_seq=2 ttl=64 time=0.122 ms- Forcing 1 Gbps full gives Not supported: a virtual NIC has no physical chip.
- On a real server ethtool -s fixes the speed, but both ends must then have the same setting.
- ip link set eth0 down -> Link detected: no (like unplugging the cable); up -> yes, and ping works again.
4.9 Practical: Get-NetAdapter on Windows
Get-NetAdapter -Name "Ethernet","Wi-Fi" | Select-Object Name, Status, LinkSpeed, FullDuplex | Format-Table -AutoSize$p = Get-NetAdapterAdvancedProperty -Name ` "Ethernet" -DisplayName "Speed & Duplex"$p.DisplayValue$p.ValidDisplayValuesName Status LinkSpeed FullDuplex---- ------ --------- ----------Ethernet Disconnected 0 bpsWi-Fi Up 150 Mbps False$ $p.DisplayValueAuto Negotiation$ $p.ValidDisplayValuesAuto Negotiation10 Mbps Half Duplex10 Mbps Full Duplex100 Mbps Half Duplex100 Mbps Full Duplex1.0 Gbps Full Duplex- Ethernet: Disconnected, 0 bps (no cable plugged in).
- Wi-Fi: Up at 150 Mbps, FullDuplex False: Wi-Fi is a shared radio medium, half duplex.
- Speed & Duplex is on Auto Negotiation; the other values are fixed speed/duplex options.
- Get-NetAdapter only reads, it changes nothing.
4.10 Common mistakes
- Myth: a Cat6 cable makes your internet faster. The slowest link decides the speed; on a 100 Mbps plan you get 100 Mbps with Cat5e or Cat6.
- A better cable matters only when you need more than 1 Gbps inside the LAN.
- Running copper beyond 100 m.
- Forcing speed/duplex on one end only: causes a duplex mismatch.
- 800 m at 10 Gbps: not copper (100 m), not multi mode (~400 m); choose single mode fiber.
4.11 Interview tips
- Half vs full duplex: half = one side at a time (hub, Wi-Fi), collisions and CSMA/CD; full = both together, no collisions, 2x bandwidth.
- Mention duplex mismatch for bonus points: one side full, one half, errors and slow link.
- Cat5e/Cat6 = 1 Gbps, Cat6a = 10 Gbps, copper max 100 m.
- MMF for short runs (hundreds of meters), SMF for kilometers.
- Hub and repeater are Layer 1; switch is Layer 2.