Cyber Security Basics
📂 Foundation
· 1 of 15
75 min read
Networking Foundations — A Complete Walkthrough
A 20-section walkthrough of computer networking fundamentals: the five core components (sender, receiver, message, medium, protocol), six classic topologies (bus, star, ring, mesh, tree, hybrid), the OSI 7-layer and TCP/IP 4-layer models, PDUs at each layer, the TCP three-way handshake, encapsulation, and which devices and protocols live at every layer — with animated diagrams.
Section 01
What Is a Computer Network?
📖 Working Definition
Any Two Devices That Can Talk to Each Other
A computer network is a collection of two or more devices —
computers, phones, printers, servers, routers, sensors — connected together so
they can exchange data. Connection can be physical (copper cable,
fibre optic) or wireless (Wi-Fi, Bluetooth, cellular, satellite). The data
can be text, voice, video, sensor readings, control signals, or anything else
that can be encoded as bits.
Every network ever built exists to do one of four things: share
resources (printers, files, an Internet connection),
communicate (email, video calls, messaging),
centralise information (a database many people access), or
distribute computation (cloud services, AI training).
🔌
Connected Devices
~30 Billion
More than three connected devices per human alive. Phones, laptops, sensors, cars, appliances, industrial equipment.
🌐
Networks on Earth
~75,000+ AS
Autonomous Systems registered with the regional internet registries. Each one is an independently-run network.
📥
Daily Email Volume
~360 Billion
Emails sent globally every day. Each one a small networking transaction across SMTP, DNS, TCP, and IP.
📢
Mobile Data Traffic
~140 EB / month
Exabytes of mobile data globally per month. Cellular networks carry a substantial share of human communication.
📐
Why Study Networking?
Everything you build today runs on a network: web apps, mobile apps, cloud
services, AI systems, IoT devices, payments. The performance, security,
and reliability of any modern system is bounded by the network it depends
on. Networking is no longer optional knowledge for software engineers
— it is foundational.
Section 02
The Five Core Components of Any Network Communication
Every act of communication — from a phone call to a video stream to a database
query — involves the same five components. Memorise them and the rest of
networking becomes legible.
📧 The Five-Part Communication Model — Animated
💻
1. Sender (Source)
where the message originates
The device that creates and transmits the message. Could be a laptop sending
an email, a CCTV camera streaming video, an IoT sensor reporting a reading,
or a server pushing a notification. The sender encodes data into a form the
medium can carry.
📱
2. Receiver (Destination)
where the message arrives
The device that receives and decodes the message. Symmetric to the sender —
in most modern protocols, every device plays both roles many times per
second. Your laptop is a sender when you click "Send Email" and a receiver
when the reply arrives.
📝
3. Message (Data)
what's being sent
The actual information: text characters, audio samples, video frames,
binary file bytes, sensor readings, control commands. Eventually all data
becomes a sequence of bits (1s and 0s) for transmission.
🔗
4. Medium (Channel)
the physical path
What physically carries the message: guided media (twisted
pair copper, coaxial cable, fibre-optic glass) or unguided
(radio waves over Wi-Fi, Bluetooth, cellular 4G/5G, satellite microwaves).
The medium determines speed, distance, and interference characteristics.
📚
5. Protocol (Rules)
how they agree to talk
The agreed-upon set of rules: what bit-pattern means what, how to detect
errors, how to acknowledge receipt, how to handle losses. Without a shared
protocol the two devices are like people speaking different languages —
they hear the sounds but understand nothing.
🎯
Bonus: Direction
simplex / half / full duplex
Simplex — one direction only (TV broadcast).
Half-duplex — both directions but not at once (walkie-talkie).
Full-duplex — simultaneous both ways (phone call, Ethernet).
Most modern networks are full-duplex.
Section 03
Types of Networks — Classification by Geography
Networks are categorised by the geographic area they span. Each category has
its own typical technologies, speeds, and use cases.
Type
Range
Typical Speed
Example
Technologies
PAN (Personal Area)
~1–10 m
Up to 3 Gbps
Phone ↔ earbuds ↔ watch
Bluetooth, NFC, USB
LAN (Local Area)
~1 km
1–100 Gbps
Office, school, home network
Ethernet, Wi-Fi (802.11)
MAN (Metropolitan Area)
~5–50 km
1–100 Gbps
City-wide cable provider, university campus across districts
Fibre rings, WiMAX, Metro Ethernet
WAN (Wide Area)
100s–1000s km
1 Mbps – 100s Gbps
Bank's national branch network, ISP backbone, the Internet itself
MPLS, leased lines, SD-WAN, satellite
SAN (Storage Area)
Within a data centre
16–128 Gbps
Database servers ↔ shared storage arrays
Fibre Channel, iSCSI
CAN (Campus Area)
~1–5 km
1–100 Gbps
University campus, corporate office park
Fibre + Ethernet
VPN (Virtual Private)
Any (uses other networks)
Depends on underlay
Remote employee ↔ office over the public Internet
IPsec, WireGuard, OpenVPN
💡
The Internet Is Not a Single Network
The Internet is a network of networks — an interconnection
of roughly 75,000 independently-operated Autonomous Systems (AS) that have
agreed to exchange traffic with each other. When you load a website,
your packet typically traverses 8–15 different AS networks operated by
different companies on its way to the destination.
Section 04
Network Topologies — The Physical Shapes Networks Take
Topology describes how devices are physically (or logically)
arranged and connected. The choice of topology affects cost, performance,
fault tolerance, and ease of expansion. Six classic topologies dominate.
🏘️ The Six Classic Network Topologies
Topology
Pros
Cons
Real Use
Bus
Cheap, simple, easy to extend by tapping in
One cable break disconnects everyone; collisions limit performance
Legacy Ethernet 10BASE-2; rarely used today
Star
Easy to add/remove devices; one device failure does not affect others
Central hub is a single point of failure; cabling cost
One break breaks the whole ring (unless dual-ring); adding a node disrupts service
Older Token Ring LANs; modern fibre rings in MAN deployments
Mesh
Highest fault tolerance; multiple redundant paths
Expensive: a full mesh of n nodes needs n(n-1)/2 links
Backbone Internet routing; military networks; Wi-Fi mesh systems at home
Tree
Hierarchical, easy to manage at scale
Root failure cascades; performance degrades down the tree
Most corporate office networks; ISP distribution networks
Hybrid
Combine strengths of multiple topologies
Complex to design and troubleshoot
How every real-world enterprise actually looks at scale
Section 05
Why Layered Architecture? — The Power of Separation of Concerns
📖 The Insight
Solving Networking by Breaking It Into Layers
Imagine trying to build a single program that handles everything from
deciding which copper wire to energise, to formatting an HTTP response. Such
a program would be unmaintainable. So the early networking pioneers split
the problem into layers, where each layer:
✅ Does one job well — moving bits, finding routes, ensuring delivery, formatting data
✅ Talks only to adjacent layers — clean interfaces
✅ Can be replaced without breaking the others — swap copper for fibre at L1, the rest is unaffected
✅ Adds its own header as data passes through it
🧹
Abstraction
hide the complexity
The HTTP server doesn't care about Wi-Fi vs Ethernet vs fibre. The browser
doesn't care which 12 routers a packet traverses. Each layer abstracts away
what the layer above shouldn't have to think about.
⚙️
Interoperability
vendors can mix and match
Cisco routers route packets from Apple laptops over Huawei switches to AWS
servers running Linux — because every vendor implements the same layered
protocols. Layering is what made the heterogeneous Internet possible.
🛠️
Easier Troubleshooting
isolate the failing layer
"Is it a physical problem (L1)? A switching problem (L2)? A routing problem
(L3)? A TCP problem (L4)? An app problem (L7)?" Layers let engineers
systematically narrow the failure rather than guess.
Section 06
The OSI Seven-Layer Reference Model
The Open Systems Interconnection (OSI) model, standardised
by ISO in 1984, defines seven conceptual layers. While the modern Internet
actually runs on the simpler TCP/IP model (next section), OSI remains the
reference vocabulary every networking engineer uses to discuss
communications. "That's a Layer 3 problem" means routing.
"Layer 7 firewall" means it inspects application data.
📚 The OSI 7-Layer Stack — Animated Data Flow
What Each Layer Does (Top-Down)
📚 The Seven Layers
L7 Application
What the user sees. The protocol your application speaks: HTTP for web, SMTP for email, DNS for name lookups, FTP for file transfer. This is where your software lives.
L6 Presentation
Data translation, encryption, compression. Converts between formats (ASCII / Unicode / EBCDIC), encrypts (TLS lives here in OSI), compresses (gzip). Often merged into the Application layer in real implementations.
L5 Session
Opens, manages, and closes conversations. Tracks who is talking to whom, manages dialogue control, handles checkpointing for long sessions. Examples: NetBIOS, RPC, SIP.
L4 Transport
Reliable end-to-end delivery. Breaks data into segments, numbers them, retransmits lost ones (TCP), or sends fast and best-effort (UDP). Provides ports so multiple applications can share one IP.
L3 Network
Routing across networks. Assigns logical addresses (IP), finds paths between source and destination across many networks, handles fragmentation. The Internet works at this layer.
L2 Data Link
Node-to-node delivery on the local segment. Frames the bits, uses MAC addresses, detects errors. Handles getting a packet from one hop to the next on the same LAN. Ethernet and Wi-Fi (802.11) live here.
L1 Physical
Bits on the wire. Defines voltage levels, light pulses, radio frequencies, connector shapes. The actual electrical / optical / radio signal moving across the medium.
💡
Two Mnemonics Every Network Engineer Knows
Top-down: "All People Seem To Need Data Processing" (Application, Presentation, Session, Transport, Network, Data Link, Physical).
Bottom-up: "Please Do Not Throw Sausage Pizza Away" (Physical, Data Link, Network, Transport, Session, Presentation, Application).
You will hear both in interviews and certification exams. Pick one and stick with it.
Section 07
The TCP/IP Four-Layer Model — What the Internet Actually Runs On
📖 The Practical Model
The Model Vint Cerf and Bob Kahn Actually Built
While OSI was being designed by committee in Europe, two engineers in the US —
Vint Cerf and Bob Kahn — were quietly building
a simpler four-layer model that became the actual Internet. Standardised in
RFC 1122 (October 1989), the TCP/IP model collapses OSI's seven
layers into four pragmatic ones.
Today, every router, every operating system, every server, every phone speaks
TCP/IP. OSI's 7 layers remain the textbook reference, but TCP/IP's 4 layers
are the deployed reality.
⚙️ The TCP/IP Model (and How It Maps to OSI)
TCP/IP Layer
Maps to OSI
Role
Key Protocols
Application
L5 + L6 + L7
What applications speak — formatting, sessions, end-user protocols
HTTP/HTTPS, DNS, SMTP, FTP, SSH, MQTT, gRPC
Transport
L4
End-to-end delivery between two hosts; reliability or speed trade-off
TCP, UDP, QUIC, SCTP
Internet (Network)
L3
Routing packets across many interconnected networks (the Internet itself)
IPv4, IPv6, ICMP, ARP, OSPF, BGP
Network Access (Link)
L2 + L1
Putting bits on the local medium; node-to-node delivery
Data PDUs — What the "Packet" Is Actually Called at Each Layer
At each layer, the unit of data has a different name. Calling a Layer-4 unit
a "packet" sounds fine in casual conversation but will flunk you in a network
certification exam. Here is the precise vocabulary every engineer uses.
In casual conversation, "packet" is loosely used for everything. In
networking exams, papers, and RFCs, use the precise term for the layer
you are discussing.
Section 09
Encapsulation — How Data Wraps Down the Stack
When your browser sends an HTTP request, the data doesn't just appear on the
wire. It travels down the sender's stack, with each layer adding its
own header (and sometimes a trailer). At the receiver, the data travels
up the stack, with each layer stripping its peer's header. This
wrapping process is called encapsulation; the unwrapping
process is decapsulation.
📦 Encapsulation — Building a Frame From an HTTP Request
Section 10
The Physical Layer (L1) — Bits on the Wire
The physical layer is where the abstraction of bits meets the reality of
physics. Voltages, light pulses, radio waves — the medium that physically
carries 0s and 1s between devices.
🔗
Guided Media (Wired)
cables
Twisted Pair (Cat5e/6/6a/8) — most office Ethernet, 1–40 Gbps.
Coaxial — cable TV, legacy networks.
Fibre optic — single-mode (long-distance) and multi-mode (data centre),
up to terabits per second.
📡
Unguided Media (Wireless)
radio waves
Wi-Fi (802.11a/b/g/n/ac/ax/be) — 2.4/5/6 GHz.
Bluetooth — short-range PAN.
Cellular — 3G/4G/5G/6G across licensed spectrum.
Satellite — geosynchronous and LEO (Starlink).
⚡
Signal Encoding
turning bits into signals
Modulation schemes like NRZ, Manchester, 8b/10b (Gigabit Ethernet),
OFDM (Wi-Fi 6, LTE) encode binary into changes in voltage, light, or
radio. The choice trades off speed vs error resilience vs range.
Section 11
The Data Link Layer (L2) — Local Hop, Frames, MAC Addresses
Layer 2 takes the raw bits from L1 and groups them into frames.
It uses MAC addresses (Media Access Control — a 48-bit
hardware ID burned into every network card at manufacture, like
3C:22:FB:A1:9D:42) to identify the next physical hop on the
local network segment.
⚙️ What L2 Does
Framing
Groups bits into discrete frames with clear start/end markers. Receiver knows where one frame stops and the next begins.
MAC addressing
Every NIC has a unique 48-bit MAC address. L2 frames carry source and destination MAC for delivery on the local segment.
Error detection
The Frame Check Sequence (FCS) is a CRC checksum appended to every frame. If the receiver computes a different CRC, the frame is silently discarded.
Media access
Decides who gets to transmit when multiple devices share a medium. Ethernet uses CSMA/CD; Wi-Fi uses CSMA/CA. Token Ring used token passing.
ARP
Address Resolution Protocol — "Who has IP 192.168.1.5?" Sent as an L2 broadcast; the host with that IP replies with its MAC. Maps L3 to L2.
Section 12
The Network Layer (L3) — Routing Across the Internet With IP
📍 The Layer That Made the Internet Possible
IP — The Universal Addressing Scheme
The Network Layer's job is routing: getting a packet from
a source on one network to a destination on a completely different network,
potentially traversing 8–15 different organisations' networks on the way.
The protocol that does this is IP (Internet Protocol), available
in two versions: IPv4 (32-bit addresses, ~4.3 billion total,
written as 192.168.1.10) and IPv6 (128-bit, written as
2001:db8::1). At Layer 3, every device on the Internet has at least one IP
address — that is what makes it globally addressable.
📍
IP Addresses
logical addressing
Unlike MAC (which is fixed to hardware), IP addresses can be assigned and
reassigned. They are logical identifiers. Your laptop gets a
different IP on every Wi-Fi network you join — but the same MAC.
🛍️
Routing
finding the best path
Routers maintain routing tables learned from protocols like
OSPF (intra-AS), RIP (legacy), and BGP
(between AS — the Internet's backbone routing). Each packet is forwarded
hop by hop based on its destination IP.
📫
ICMP
the network's diagnostic tool
Internet Control Message Protocol — what ping and
traceroute use. Reports "destination unreachable," "time
exceeded," and other network conditions. Not a transport protocol;
a control protocol.
✂
Fragmentation
splitting big packets
Different network segments have different MTUs (Maximum Transmission Unit).
A 1500-byte packet may need to be split when entering a network with a
smaller MTU. IPv4 does this in transit; IPv6 makes the sender do it (path
MTU discovery).
🔄
NAT
private ↔ public
Network Address Translation — the trick that lets many private hosts share
one public IP. Your home router rewrites packet headers so internal devices
can use 192.168.x.x while presenting one public IP to the Internet.
🛡️
Subnetting & CIDR
network organisation
Networks are split into subnets using CIDR notation (e.g.
10.0.0.0/24 = 256 addresses). Allows hierarchical organisation
and efficient routing-table aggregation.
Section 13
The Transport Layer (L4) — TCP vs UDP, the Two Personalities
Layer 4 takes IP's "best effort to deliver a packet" and turns it into either
reliable delivery (TCP) or fast delivery (UDP). It also
introduces port numbers — so a single IP can run dozens of
applications simultaneously, each on its own port.
🔐 TCP — Transmission Control Protocol
Property
Behaviour
Connection
Connection-oriented (3-way handshake)
Reliability
Guaranteed delivery, in order
Loss handling
Detects and retransmits
Flow control
Yes (sliding window)
Congestion control
Yes (slow start, AIMD)
Overhead
Higher (20+ byte header)
Used by
HTTP, HTTPS, SSH, SMTP, FTP, Git
⚡ UDP — User Datagram Protocol
Property
Behaviour
Connection
Connectionless ("fire and forget")
Reliability
Best effort, no guarantees
Loss handling
Lost packets are simply lost
Flow control
None
Congestion control
None (app must handle)
Overhead
Low (8 byte header)
Used by
DNS, VoIP, video streaming, gaming, DHCP
The TCP Three-Way Handshake
🤝 How TCP Opens a Connection
📐
Port Numbers — The Other L4 Innovation
A port is a 16-bit number (0–65535) that identifies which application on a
host the data belongs to. Well-known ports:
80 HTTP, 443 HTTPS, 22 SSH,
25 SMTP, 53 DNS, 3306
MySQL, 6379 Redis. Combination of IP:port
uniquely identifies a network conversation endpoint — called a socket.
Section 14
The Application Layer (L7) — Where Software Meets the Network
Layer 7 is where your software actually lives. Every protocol here is designed
to do one user-facing thing well: fetch web pages, send email, transfer files,
resolve names, manage devices remotely. Below is the cast of characters every
network engineer must know.
Protocol
Purpose
Default Port
Transport
HTTP
Web page transfer
80
TCP
HTTPS
HTTP over TLS — encrypted Web
443
TCP (or QUIC over UDP for HTTP/3)
DNS
Name ↔ IP lookups
53
Both UDP (queries) and TCP (zone transfers)
SMTP
Sending email
25 / 587
TCP
POP3 / IMAP
Receiving email
110 / 143
TCP
FTP
File transfer (legacy)
20 / 21
TCP
SFTP
Secure file transfer over SSH
22
TCP
SSH
Remote shell, secure tunnelling
22
TCP
Telnet
Remote shell (insecure, legacy)
23
TCP
DHCP
Auto-assign IPs to hosts
67 / 68
UDP
SNMP
Network device monitoring & management
161 / 162
UDP
NTP
Clock synchronisation
123
UDP
MQTT
IoT pub/sub messaging
1883 / 8883
TCP
gRPC
RPC over HTTP/2 with Protobuf
varies
TCP (over HTTP/2)
WebSocket
Persistent bidirectional channel
80 / 443
TCP
Section 15
Networking Devices — Who Does What in the Physical Network
A network is not just cables — it is a set of devices that
process, forward, and inspect traffic. Different devices operate at different
layers and have very different capabilities.
🔘
Repeater
Layer 1
Boosts a weakening signal so it can travel farther. Operates on raw bits
with no understanding of what they mean. Mostly obsolete in modern wired
networks but still used in fibre and as Wi-Fi range extenders.
🏣
Hub
Layer 1
A "dumb" multi-port repeater. A packet arriving on one port is blasted out
every other port. Creates a single collision domain — everyone shares
bandwidth. Functionally obsolete; replaced by switches.
📧
Bridge
Layer 2
Connects two network segments and learns which MAC addresses are on
each side. Forwards only relevant frames between them. Conceptually
a two-port switch.
⚔️
Switch
Layer 2 (some L3)
The workhorse of modern LANs. Maintains a MAC address table and forwards
frames only to the specific port where the destination lives. Each port
is its own collision domain. L3 switches can also route between VLANs.
🛍️
Router
Layer 3
Forwards IP packets between different networks. Maintains a routing table.
Every "next-hop" decision happens at a router. Your home router is what
bridges your LAN to the Internet.
🛡️
Firewall
L3, L4, or L7
Inspects traffic and blocks or allows it based on rules. Modern
NGFW (Next-Generation Firewalls) inspect at L7 (Deep
Packet Inspection), can decrypt TLS, and integrate with threat intel feeds.
📡
Wireless Access Point (WAP)
L1 + L2
Bridges Wi-Fi (radio) clients to a wired Ethernet network. Speaks 802.11
on one side and Ethernet on the other. Modern APs include controller
software for centralised management.
💾
Modem
L1 + L2
Modulator-Demodulator. Converts between digital network signals and the
analogue signal of the ISP medium (DSL, cable, fibre). Sits between your
router and the wider Internet.
⚙️
Gateway
often L7
Translates between different network protocols or formats. An API gateway,
a SIP gateway, a payment gateway — all bridge two protocol worlds.
Sometimes synonymous with "router" in colloquial use.
⚖️
Load Balancer
L4 or L7
Distributes incoming requests across multiple backend servers. L4 LBs
(HAProxy, NLB) work on IP+port. L7 LBs (Nginx, ALB) understand HTTP and
can route based on headers, paths, cookies.
🔎
Proxy
L7
An intermediary between client and server. Forward proxies
sit in front of clients (corporate browsing); reverse proxies
sit in front of servers (Cloudflare, Nginx).
📡
IDS / IPS
L3 to L7
Intrusion Detection / Prevention Systems. IDS observes and alerts; IPS
observes and blocks. Snort, Suricata, Zeek are common open-source options.
Section 16
Devices at Each Layer — And Why They Live There
Memorising which device operates at which layer is a classic networking exam
topic — but it has real practical value: when you troubleshoot, knowing the
layer tells you which tool to reach for and what kind of fault you might be
looking at.
Layer
Devices
Why It Lives Here
L1 Physical
Repeater, Hub, Cable, Connector, NIC, Modem
These devices deal in raw signal — voltages, light, radio. They have no understanding of MAC, IP, or anything above.
L2 Data Link
Switch, Bridge, Wireless Access Point, NIC (also)
These devices read MAC addresses from frame headers and make forwarding decisions per-port. They don't look at IPs.
L3 Network
Router, Layer-3 Switch, basic Firewall
These devices read IP addresses from packet headers and decide which network interface to forward toward. They maintain routing tables.
L4 Transport
L4 Load Balancer, stateful Firewall, NAT device
These devices look at port numbers and TCP flags. A NAT device tracks connections by source-IP:port mapped to public-IP:port.
L7 Application
L7 Load Balancer, WAF, Proxy, API Gateway, NGFW, IDS/IPS
These devices parse application-layer protocols — HTTP methods, paths, headers, cookies. They can make decisions based on what's inside the payload.
🛡️
The Troubleshooting Heuristic
Cable unplugged? L1. Two devices on the same LAN can't see each other?
L2 (check MAC table, VLAN, link lights). Can ping local but not remote? L3 (check
default gateway, routing). Can ping but not connect on TCP port? L4 (check
firewall). HTTP works but returns wrong page? L7. Walk the stack from the bottom up.
Section 17
Protocols at Each Layer — The Master Reference
Here is the consolidated cheat sheet — one place that lists which protocols
live at which layer. Print this; you will refer to it constantly.
You open a browser and type https://example.com. In the
next 200 milliseconds, more than a dozen distinct networking operations
happen in sequence across every layer of the stack. Here is the full
pipeline — exactly the kind of thing a senior interviewer will ask you to
walk through.
1
URL Parse (L7)
Browser parses https://example.com into scheme (https), host (example.com), and port (default 443).
2
DNS Lookup (L7 over L4/UDP)
Browser asks the OS resolver "what's the IP for example.com?" → resolver checks cache → if absent, queries the recursive DNS server (1.1.1.1, 8.8.8.8) over UDP port 53 → eventually gets back 93.184.216.34.
3
ARP (L2)
To send anything on the LAN, the OS needs the MAC address of the next hop (the default gateway / home router). It broadcasts an ARP request: "Who has IP 192.168.1.1?" The router replies with its MAC.
4
TCP Handshake (L4)
Three-way handshake: SYN → SYN-ACK → ACK. Now the browser has a reliable byte stream to the server on port 443.
5
TLS Handshake (L6 in OSI)
ClientHello → ServerHello with certificate → key exchange → encrypted channel established. From here on, every TCP byte is AEAD-encrypted.
6
HTTP Request (L7)
Browser sends GET / HTTP/1.1 with Host header, User-Agent, cookies, Accept headers. The request travels through the encrypted TCP channel.
7
Routing (L3 — many hops)
The packet hops through 8–15 routers on its way: home router → ISP edge → ISP core → IXP / peering → upstream AS → destination AS → destination data centre. Each router looks at the destination IP and forwards to its next hop based on BGP-learned routes.
8
Server Processing (L7)
Web server (Nginx, Apache) accepts the connection, hands off to application server (Node, Django, Spring), which queries database, generates HTML.
9
HTTP Response (L7)
Server sends 200 OK with HTML body. Compressed (gzip), encrypted (TLS), packed into TCP segments, IP packets, Ethernet frames, and electrons on the wire.
10
Browser Render (L7)
Browser receives, decrypts, parses HTML, fetches additional resources (CSS, JS, images — each one repeating most of the above), builds DOM, paints pixels. You see the page.
Section 19
Network Diagnostic Tools — Every Engineer's Toolkit
Knowing the layers gives you the conceptual map. These commands give you the
actual tools to walk the map when something breaks. Every networking engineer
uses these every day.
Tool
Layer
What It Tells You
ping
L3 (ICMP)
"Can I reach this host?" Measures round-trip time and packet loss.
traceroute / tracert
L3
Lists every router on the path to a destination — the actual hops your packets take.
nslookup / dig
L7 (DNS)
Performs DNS queries; useful for debugging name-resolution issues.
netstat / ss
L4
Lists active TCP/UDP connections, listening ports, and socket state.
arp -a
L2
Shows the local ARP cache — which MAC address is associated with which IP on your LAN.
ipconfig / ifconfig / ip
L2/L3
Shows your local interfaces: IPs, MACs, subnet masks, default gateways.
tcpdump / Wireshark
All layers
Captures and decodes every packet on an interface. The single most powerful network debugging tool.
curl / wget
L7
Makes raw HTTP(S) requests; shows headers and response — invaluable for API debugging.
nmap
L3/L4
Port scanner. Shows which TCP/UDP ports are open on a target host.
mtr
L3
Combines ping + traceroute with real-time updates. The professional's choice.
Section 20
Golden Rules — Networking Foundations Distilled
🎯 The Twelve Rules Every Network Engineer Knows
01
Five components, always. Sender, Receiver, Message, Medium, Protocol.
Any networking problem can be diagnosed by asking which of the five is misbehaving.
02
Layers are the API of networking. Each layer hides its complexity from the
one above. Respecting layer boundaries makes systems maintainable; violating them
makes them fragile.
03
OSI is the vocabulary; TCP/IP is the deployment. Use OSI when you discuss
concepts ("Layer 7 firewall"). Use TCP/IP when you build systems (the four-layer
reality of every device on the Internet).
04
Bits → Frames → Packets → Segments → Data. The PDU names matter.
Knowing them tells you which layer you are debugging.
05
MAC is local, IP is global. MAC addresses don't cross routers; IP
addresses can travel the whole Internet. The two-layer addressing scheme is what
makes both LANs and the Internet possible.
06
TCP for reliability, UDP for speed. Choose by use case: file transfer
and HTTPS need TCP; voice, video, gaming, and DNS prefer UDP. QUIC (HTTP/3) combines
benefits of both.
07
Ports identify applications. One IP, 65,535 ports — that is how a
single host runs dozens of services simultaneously. Memorise the well-known ones
(80, 443, 22, 53, 25).
08
Encapsulation is universal. Every packet on the wire is a Russian doll
of headers — Ethernet wraps IP wraps TCP wraps HTTP. Visualise the layers when you
think about networking.
09
The device matches its layer. Hubs at L1, switches at L2, routers at L3,
load balancers at L4 or L7. Knowing which device does which job makes design and
troubleshooting infinitely easier.
10
Walk the stack to troubleshoot. Bottom-up: is the cable plugged in?
Does the switch see the MAC? Can you ping the gateway? Can you reach the remote IP?
Does the TCP port respond? Does the application return the right HTTP status?
11
The Internet is a network of networks. No central authority. ~75,000
Autonomous Systems agreeing to exchange traffic. Resilient by design, fragile in
detail (one BGP misconfiguration can disrupt thousands of services).
12
Wireshark is your best friend. When the description on paper differs
from the behaviour on the wire, trust the wire. The packets do not lie.
🎯
You Now Have the Networking Foundations
The five components, the seven OSI layers, the four TCP/IP layers, the
five PDU names, the encapsulation pattern, the device-to-layer mapping,
and the protocol-to-layer mapping — these are the mental scaffolding that
every networking topic builds on. From here, deeper specialisations
(routing protocols, software-defined networking, cybersecurity, cloud
networking, 5G) are all variations on this same foundation.