EthicsComputerCourses
Join training +91 90532 10052

Wi-Fi, 4G & 5G

Computer Networks · Lesson 29 of 32 Advanced 8 min read Updated

By the end of this lesson you will be able to name the Wi-Fi generations and bands, pick non-overlapping channels, explain CSMA/CA and the hidden terminal problem, compare signal strength in dBm, and describe how 4G and 5G mobile networks are built.

Most people today reach the internet over radio: Wi-Fi at home and college, and 4G or 5G everywhere else. Radio is shared, noisy and limited by walls and distance, so wireless networks need extra rules that wired Ethernet does not.

Wi-Fi standards and generations

Wi-Fi is built on the IEEE 802.11 family of standards. The Wi-Fi Alliance gave the newer ones simple generation names:

GenerationIEEE standardBandsNotes
Wi-Fi 4802.11n2.4 and 5 GHzMIMO (several antennas) became common
Wi-Fi 5802.11ac5 GHzWider channels, faster in homes and offices
Wi-Fi 6802.11ax2.4 and 5 GHzOFDMA: serves many devices at once; better in crowded places
Wi-Fi 6E802.11axadds 6 GHzMuch more clean spectrum, where the country allows it
Wi-Fi 7802.11be2.4, 5 and 6 GHzVery wide channels and multi-link operation

The speeds printed on router boxes are total theoretical maximums across all bands and antennas. Real throughput for one device is far lower.

Bands and channels

The frequency band changes how far and how fast the signal goes:

  • 2.4 GHz: longer range and better through walls, but crowded (microwave ovens, Bluetooth and neighbours' Wi-Fi share it) and slower.
  • 5 GHz: much more channels and faster, but shorter range.
  • 6 GHz: the most room and the least interference, but the shortest range, and available only where regulators allow it.

In the 2.4 GHz band, channels are only 5 MHz apart but each Wi-Fi signal is about 20 MHz wide, so neighbouring channels overlap. Only 1, 6 and 11 do not overlap. Centre frequencies follow a simple rule: 2407 + 5 × channel MHz.

PythonRun it yourself
def centre(ch):
    return 2407 + 5 * ch

for ch in [1, 3, 6, 11]:
    print(f"Channel {ch:>2}: {centre(ch)} MHz")

def overlap(a, b, width=20):
    return abs(centre(a) - centre(b)) < width

for a, b in [(1, 3), (1, 6), (6, 11)]:
    print(f"Channels {a} and {b} overlap: {overlap(a, b)}")
Output
Channel  1: 2412 MHz
Channel  3: 2422 MHz
Channel  6: 2437 MHz
Channel 11: 2462 MHz
Channels 1 and 3 overlap: True
Channels 1 and 6 overlap: False
Channels 6 and 11 overlap: False

So in a hostel with three access points close together, set them to channels 1, 6 and 11.

How a device joins

  1. The access point broadcasts beacons with its network name, the SSID. Each AP radio also has a MAC address called the BSSID.
  2. The device chooses a network, then authenticates and associates with the AP.
  3. With WPA2 or WPA3, both sides prove they know the key and derive fresh encryption keys (the "4-way handshake").
  4. Then the device gets an IP address by DHCP, like any wired device.

Sharing the air: CSMA/CA

A radio cannot listen while it transmits, so Wi-Fi cannot detect collisions the way old Ethernet did. Instead it tries to avoid them with CSMA/CA (carrier sense multiple access with collision avoidance):

  1. Listen. If the channel is busy, wait.
  2. When it becomes free, wait a further random backoff time.
  3. Send the frame.
  4. The receiver sends an ACK. No ACK means something went wrong: back off for longer and retry.

Think of students in a quiet library who want to ask the librarian a question. Each waits until nobody is speaking, then waits a few random seconds more so that two students rarely start at the same moment.

The hidden terminal problem. Laptops A and C are on opposite sides of an AP. Both can hear the AP, but not each other. Each thinks the channel is free and transmits, and their frames collide at the AP. The fix is optional RTS/CTS: A sends a short "request to send"; the AP answers "clear to send", which C can hear, so C waits.

Signal strength in dBm

Wi-Fi signal strength is measured in dBm: decibels relative to 1 milliwatt. It is a logarithmic scale, so every 10 dB is a factor of 10, and every 3 dB is roughly a factor of 2. Values are negative because received signals are tiny: -50 dBm is excellent, -67 dBm is a common target for video calls, and below about -80 dBm the connection is weak.

Higher frequencies lose more strength over distance. The free-space path loss formula shows this: FSPL (dB) = 20 log10(d in km) + 20 log10(f in MHz) + 32.44.

PythonRun it yourself
from math import log10

def dbm_to_mw(dbm):
    return 10 ** (dbm / 10)

for dbm in [-50, -67, -80]:
    print(f"{dbm} dBm = {dbm_to_mw(dbm):.2e} mW")

def fspl(d_m, f_mhz):
    return 20 * log10(d_m / 1000) + 20 * log10(f_mhz) + 32.44

for f in [2437, 5500, 6200]:
    print(f"Loss over 10 m at {f} MHz: {fspl(10, f):.1f} dB")
Output
-50 dBm = 1.00e-05 mW
-67 dBm = 2.00e-07 mW
-80 dBm = 1.00e-08 mW
Loss over 10 m at 2437 MHz: 60.2 dB
Loss over 10 m at 5500 MHz: 67.2 dB
Loss over 10 m at 6200 MHz: 68.3 dB

At the same distance, 5 GHz loses about 7 dB more than 2.4 GHz even in free space, and walls make the gap bigger. That is why 2.4 GHz still reaches the far bedroom when 5 GHz does not.

Wi-Fi security

MethodStatus
Open networkNo encryption; avoid for anything private
WEPBroken; must never be used
WPA2-Personal (PSK)Acceptable with a long, random passphrase
WPA3-Personal (SAE)Current best choice; resists offline password guessing
WPA2/WPA3-Enterprise (802.1X)Each user logs in with their own account; used in colleges and companies

Also disable WPS on home routers, change the router's admin password, and put guests and smart devices on a separate network.

Mobile networks: cells and handover

A mobile network divides an area into cells, each served by a base station (the tower you see on rooftops). Neighbouring cells use different frequencies or coordinate carefully, so the same spectrum can be reused a few cells away. When you travel on a train from Pune to Mumbai, your phone moves from cell to cell; the network passes your connection along without dropping it. This is handover.

GenerationMain idea
2G (GSM)Digital voice and SMS
3GMobile data becomes usable
4G (LTE)All-IP network: data, and voice as VoLTE over IP
5G (NR)Higher speeds, lower latency, many more devices, network slicing

4G LTE

In 4G LTE, the base station is called an eNodeB. The core network, the EPC (Evolved Packet Core), handles sign-in, mobility and the connection to the internet. Everything is IP: even voice calls are IP packets (VoLTE). Your phone receives an IP address, often a private or CGNAT IPv4 address plus an IPv6 address.

5G

5G is standardised by 3GPP, starting with Release 15. The radio is called NR (New Radio), and the base station is a gNodeB. 5G targets three kinds of use:

  • eMBB (enhanced mobile broadband): faster phones and home broadband over radio.
  • URLLC (ultra-reliable low-latency communication): factory robots and other control systems.
  • mMTC (massive machine-type communication): huge numbers of sensors.

Bands range from low bands (wide coverage), through mid-band around 3.5 GHz (the main 5G band in India and many other countries), to millimetre-wave bands (very fast but very short range). Early 5G networks ran in non-standalone (NSA) mode, with a 4G core; standalone (SA) 5G uses the new 5G core. The 5G core can split one physical network into several virtual ones with different guarantees; this is network slicing, an idea closely related to the software-defined networking in the next lesson.

Common mistakes

  • Thinking 5 GHz Wi-Fi means 5G mobile. 5 GHz is a Wi-Fi band; 5G is the fifth mobile generation.
  • Using overlapping 2.4 GHz channels. Stick to 1, 6 and 11.
  • Reading -70 dBm as stronger than -50 dBm. Closer to zero is stronger.
  • Using WEP or open Wi-Fi for anything private. Use WPA3 or WPA2 with a strong passphrase, and HTTPS on top.

Key points

  • Wi-Fi is IEEE 802.11; Wi-Fi 4, 5, 6, 6E and 7 are 802.11n, ac, ax, ax (6 GHz) and be.
  • 2.4 GHz reaches further; 5 and 6 GHz are faster with more channels; in 2.4 GHz use channels 1, 6 and 11.
  • Wi-Fi uses CSMA/CA with random backoff and ACKs; RTS/CTS helps with hidden terminals.
  • dBm is logarithmic: 10 dB is 10 times, 3 dB is about 2 times; -50 dBm is strong, -80 dBm is weak.
  • Use WPA3 (or WPA2 with a strong passphrase); never WEP.
  • Mobile networks use cells and handover; 4G LTE is all-IP; 5G NR adds low latency, massive IoT and slicing.

Exercise

Write Python that prints the free-space path loss at 2437 MHz and 5500 MHz for distances of 1, 5, 10 and 20 metres. Then add an assumed 5 dB loss per wall and print the received signal after 2 walls at 10 m, if the access point transmits at +20 dBm.

Show solution
Python
from math import log10

def fspl(d_m, f_mhz):
    return 20 * log10(d_m / 1000) + 20 * log10(f_mhz) + 32.44

for d in [1, 5, 10, 20]:
    print(f"{d:>2} m: 2.4 GHz {fspl(d, 2437):.1f} dB, 5 GHz {fspl(d, 5500):.1f} dB")

for f in [2437, 5500]:
    received = 20 - fspl(10, f) - 2 * 5
    print(f"{f} MHz, 10 m, 2 walls: {received:.1f} dBm")
Output
 1 m: 2.4 GHz 40.2 dB, 5 GHz 47.2 dB
 5 m: 2.4 GHz 54.2 dB, 5 GHz 61.2 dB
10 m: 2.4 GHz 60.2 dB, 5 GHz 67.2 dB
20 m: 2.4 GHz 66.2 dB, 5 GHz 73.3 dB
2437 MHz, 10 m, 2 walls: -50.2 dBm
5500 MHz, 10 m, 2 walls: -57.2 dBm

Doubling the distance adds about 6 dB of loss. Real walls vary a lot (brick and concrete absorb more), so treat the 5 dB figure as an example only.

Quick Quiz

1. Which 2.4 GHz channels do not overlap?

2. Why does Wi-Fi use collision avoidance instead of collision detection?

3. Which signal is the strongest?

4. What is the 5G base station called?

Learn Computer Networks with a mentor

Free lessons get you started. Our Computer Science Fundamentals training adds real projects and code reviews from working developers.

  • Project-based learning
  • Mentor code reviews
  • Free counselling call