Self-study deck
Computer Networking
from A to Z
Build a clear mental model of how devices communicate — from bits and Ethernet to IP, TCP, DNS, HTTP, routing, security, and troubleshooting.
Use ← → / Space to navigate · I contents · O overview · T theme · F fullscreen
The big picture
What happens when you open a website?
Follow one request to see why networking uses several layers instead of one giant protocol.
1 · Find the server
- The browser needs an IP address for
www.example.com.
- DNS checks caches, then asks a resolver for an
A or AAAA record.
- An IP address identifies where to send packets; a name is easier for humans.
2 · Establish trust
- TCP + TLS usually use port
443; HTTP/3 uses QUIC over UDP.
- TLS checks the server certificate and encrypts the conversation.
- Ports identify the service on the destination host.
3 · Ask for a page
- The browser sends an HTTP request such as
GET /.
- The request includes a hostname and headers; the server returns a status, headers, and content.
- HTTP defines meaning, not the physical path.
4 · Move packets
- Transport uses ports; TCP or QUIC handles reliability and congestion.
- IP adds source and destination addresses. Routers choose each next hop.
- A packet may cross many networks before reaching the server.
5 · Cross the local link
- Ethernet or Wi-Fi carries frames to the next hop, often your default gateway.
- ARP (IPv4) or Neighbor Discovery (IPv6) finds the next hop's link address.
- Switches connect local devices; routers connect networks.
6 · Read the response
- The server's response travels back through the network.
- The browser decrypts and renders it, then fetches images, scripts, and styles.
- Debug by layer: DNS → connection/TLS → HTTP → route → local link.
Computer Networking · A to Z
Contents
Click any line to jump there · press I to return to this page
Chapter 1
Foundations
The few ideas that make every protocol easier to understand.
Mental model
A network is a set of cooperating hops
The application sees one conversation; the network delivers it hop by hop.
End hosts
- A client starts a request; a server answers it.
- Each host has interfaces, addresses, and a routing table.
- A process listens on a port, not on the whole computer.
Intermediate devices
- Switches forward frames on a local link.
- Routers forward IP packets between networks.
- Firewalls and proxies may inspect, allow, deny, or transform traffic.
Protocols
- A protocol defines message format and behavior.
- Different layers solve different problems.
- The same HTTP request can cross Ethernet, Wi-Fi, and fiber.
Core question: which device owns the next decision — the host, switch, router, or application?
Layering
OSI and TCP/IP: two useful maps
OSI is a teaching model; the Internet protocol suite describes what commonly runs.
| OSI layer | Typical protocols or devices | Main question |
|---|
| 7–5 Application / presentation / session | HTTP, DNS, TLS, SSH | What does the message mean? |
| 4 Transport | TCP, UDP, QUIC | Which process and what delivery behavior? |
| 3 Network | IPv4, IPv6, ICMP, routers | Where is the destination network? |
| 2 Data link | Ethernet, Wi-Fi, VLANs, switches | How do I reach the next hop? |
| 1 Physical | Copper, fiber, radio | How are bits carried? |
A layer boundary is a reasoning tool, not a claim that every protocol fits perfectly into one box.
Encapsulation
What changes at each hop?
A sender wraps application data in headers; a receiver unwraps them.
At the sender
- HTTP creates a request.
- TCP/QUIC adds ports and delivery state.
- IP adds source and destination IP addresses.
On the local link
- Ethernet or Wi-Fi adds link addresses and a frame check.
- A switch reads the frame destination.
- A router removes the incoming frame and builds a new one for the next link.
At the receiver
- The network stack checks and removes headers.
- The transport layer delivers bytes or datagrams to the right socket.
- The application interprets the request.
Across routers, IP destination normally stays the same; link-layer addresses change each hop. NAT is an intentional exception to address preservation.
Vocabulary
Bits, bytes, packets, and frames
Use the right unit before interpreting a speed or a capture.
| Term | Meaning | Example |
|---|
| Bit / byte | 1 byte = 8 bits | 100 Mb/s is not 100 MB/s |
| Frame | Link-layer unit on one hop | Ethernet frame |
| Packet | Network-layer unit | IPv4 packet |
| Segment / datagram | Transport-layer unit | TCP segment / UDP datagram |
| Payload | The data carried by a layer | HTTP bytes inside TCP |
At 100 Mb/s, the theoretical byte rate is 12.5 MB/s before protocol overhead, contention, and loss.
Performance
Why a fast link can still feel slow
Separate capacity, delay, and reliability.
Bandwidth and throughput
- Bandwidth is a link capacity.
- Throughput is useful data delivered per unit time.
- The bottleneck link, protocol overhead, and congestion limit throughput.
Latency and jitter
- Latency is time for a message to travel and be processed.
- RTT measures a round trip.
- Jitter is variation in delay; voice and video care about it.
Loss and buffering
- Dropped packets trigger retries or concealment.
- Oversized queues add delay even before packets drop.
- A single test cannot prove the path is always healthy.
For bulk transfer, both bandwidth and RTT matter: the sender needs enough in-flight data to keep the path busy.
Queues and QoS
Why busy links add delay
Packets wait in buffers when offered load exceeds the rate a link can transmit.
Queue behavior
- Short bursts can be absorbed.
- Persistent overload grows delay and then causes drops.
- Bufferbloat is excess queueing delay under load.
Quality of service
- Classification groups traffic by importance.
- Scheduling and shaping decide who uses a congested link first.
- QoS cannot create capacity that the link does not have.
How to verify
- Measure latency both idle and during a large transfer.
- Check interface drops and queue counters.
- Improve capacity, shaping, or application rate where needed.
Chapter 2
Local networks and IP
How frames cross a link and packets find their way between networks.
Chapter 2 · Part 2.1
Local networks
How devices communicate before traffic reaches a router.
Physical links
Copper, fiber, and radio
The physical medium changes reach, interference, and operational risk.
Copper Ethernet
- Common for short building runs.
- Link speed and duplex are negotiated.
- Damaged cabling can cause errors, flaps, or reduced speed.
Fiber
- Useful for long distance and high capacity.
- Single-mode and multimode optics are different.
- Check optic type, power budget, and connector cleanliness.
Wi-Fi
- Shares radio airtime with nearby devices.
- Signal strength alone does not guarantee throughput.
- Interference, channel width, and roaming affect performance.
Ethernet
Frames and MAC addresses
A MAC address identifies an interface on a link; it is not an Internet-wide route.
Frame anatomy
- Destination and source MAC addresses
- EtherType identifies the next payload, such as IPv4 or IPv6.
- FCS helps detect corrupted frames.
Unicast, broadcast, multicast
- Unicast targets one link address.
- Broadcast reaches the local broadcast domain.
- Multicast targets a subscribed group, subject to switch behavior.
Important boundary
- A switch forwards frames inside the LAN.
- A router terminates one frame and sends a new frame on the next link.
- The MAC destination is usually the next hop, not the final server.
Address resolution
How an IP becomes a link address
A host must learn the next hop’s MAC before sending an Ethernet frame.
IPv4: ARP
- Ask “who has this IP?” on the local link.
- The owner replies with its MAC address.
- The host caches the answer for a limited time.
IPv6: Neighbor Discovery
- Uses ICMPv6 Neighbor Solicitation and Advertisement.
- Also supports router discovery and reachability checks.
- Multicast replaces IPv4-style ARP broadcast.
Troubleshooting
- Look for stale or duplicate address mappings.
- Confirm the gateway is on the expected VLAN.
ip neigh or arp -a shows local cache entries.
Switching
How a switch learns where to forward
A switch builds a MAC table by observing source addresses.
Learning
- A frame arrives on a port.
- The switch learns source MAC → ingress port.
- Known destinations go to one port; unknown destinations may be flooded.
Broadcast domain
- Broadcast and unknown traffic reach other ports in the VLAN.
- A VLAN separates one logical Layer 2 domain from another.
- Routers or Layer 3 switches connect VLANs.
Failure clues
- Loops can create broadcast storms.
- MAC flapping suggests a loop or moving host.
- A wrong VLAN can make DHCP and ARP appear broken.
Segmentation
Access ports, trunks, and VLANs
A VLAN ID tags traffic so several logical LANs can share one physical link.
| Port type | Carries | Typical use |
|---|
| Access | One VLAN, normally untagged | Laptop or ordinary server |
| Trunk | Multiple VLANs, usually 802.1Q tagged | Switch uplink, hypervisor, router |
| Native / untagged VLAN | Traffic without a tag on a trunk | Must match at both ends |
VLANs separate Layer 2 traffic. They do not themselves provide an Internet firewall; apply routing and access rules between VLANs.
Resilience
Loops, spanning tree, and link aggregation
Redundant cables are useful only when the forwarding behavior is controlled.
Spanning Tree
- Blocks selected Layer 2 paths to prevent loops.
- A topology change can alter the active path.
- A blocked port is not necessarily a fault.
Link aggregation
- LACP can combine links into one logical bundle.
- It adds capacity across flows and resilience.
- One flow usually hashes to one member link.
Design habit
- Document VLANs and uplinks.
- Use loop protection and appropriate edge-port settings.
- Check both ends of a bundle for matching configuration.
Wi-Fi
Why wireless behaves differently
Wireless devices contend for shared airtime rather than owning a dedicated cable.
Identity and connection
- SSID names the network.
- A client associates to an access point and authenticates.
- WPA2/WPA3 protects the radio link; HTTPS protects the application path.
Capacity
- Weak signal may require slower modulation.
- Interference and many clients consume airtime.
- A higher advertised link rate is not application throughput.
Roaming
- Clients decide when to move between access points.
- Roaming delays can affect calls and real-time apps.
- Test signal, retries, channel use, and backhaul separately.
Chapter 2 · Part 2.2
IP and addressing
How packets leave one local network and reach another.
IPv4
An IPv4 address has network and host bits
The prefix length says how much of the 32-bit address identifies the network.
Example
192.0.2.34/24 belongs to 192.0.2.0/24.- The
/24 mask is 255.255.255.0. - A host compares prefixes to decide local delivery or gateway.
Address types
- Private IPv4 ranges are used inside networks.
- Public addresses are globally routed when allocated and announced.
- Loopback
127.0.0.0/8 stays on the host.
Remember
- An IP address belongs to an interface, not a process.
- A subnet is an address range plus a common prefix.
- A default gateway is used when no more specific route matches.
IPv4 ranges
Private, link-local, loopback, and public
The same dotted notation can have very different routing meaning.
| Range | Common use | Route expectation |
|---|
| 10.0.0.0/8 | Private network | Not globally routed as ordinary public space |
| 172.16.0.0/12 | Private network | Same private-use rule |
| 192.168.0.0/16 | Private network | Common home and office LAN |
| 100.64.0.0/10 | Shared address space / CGNAT | Not ordinary public host addressing |
| 169.254.0.0/16 | IPv4 link-local | Local link only |
| 127.0.0.0/8 | Loopback | Stays on the same host |
“Public” means globally usable only when the address is allocated, routed, and allowed by policy.
Subnetting
Work a subnet example
For 192.0.2.130/26, 26 network bits leave 6 host bits.
Prefix: /26
Mask: 255.255.255.192
Block size: 256 - 192 = 64
Ranges: .0-.63, .64-.127,
.128-.191, .192-.255
Network: 192.0.2.128
Broadcast: 192.0.2.191
Usable IPv4: 192.0.2.129-.190
Usable count: 2^6 - 2 = 62
Reason it through
- Find the block that contains
.130: it starts at .128. - The last address of that block is
.191. - The first and last IPv4 addresses in an ordinary subnet are network and broadcast addresses.
- Cloud providers may reserve additional addresses.
CIDR practice
Choose a prefix by need, then verify overlap
Subnet design is address arithmetic plus a growth plan.
Useful sizes
/24 has 256 total IPv4 addresses./26 has 64 total addresses./28 has 16 total addresses.
Containment
10.20.8.0/21 covers 10.20.8.0 through 10.20.15.255.- A
/24 can be divided into four /26 subnets. - Smaller prefix number means a larger address block.
Planning
- Keep routes summarizable when possible.
- Avoid overlap with VPN peers, cloud VPCs, and future networks.
- Account for provider reservations and scaling headroom.
IPv6
IPv6 is more than a bigger address
IPv6 uses 128-bit addresses and removes the need for routine address-conserving NAT.
Reading addresses
- Hexadecimal groups are separated by colons.
:: compresses one contiguous run of zero groups.2001:db8::/32 is reserved for examples.
Common scopes
::1 is loopback.fe80::/10 is link-local and needs an interface scope.- Global unicast addresses are routable when permitted.
Operational differences
- Neighbor Discovery replaces ARP.
- Routers do not fragment IPv6 packets.
- Check DNS
AAAA, firewall rules, and path MTU.
Dual stack means IPv4 and IPv6 coexist. Verify both paths; success on one does not prove the other works.
ICMP
ICMP reports network conditions
Blocking every ICMP message can hide or break useful control signals.
Diagnostics
- Echo request/reply supports
ping. - Time Exceeded lets traceroute reveal hops.
- Destination Unreachable explains some failed delivery.
Path MTU
- IPv4 and IPv6 use ICMP messages to report packets too large for a path.
- Overly broad filtering can create “works for small requests” failures.
- Allow the required control messages through firewalls.
Limits
- Ping success does not prove an application port works.
- Ping failure does not prove a host is down.
- Routers may deprioritize ICMP replies.
Address assignment
DHCP gives a host its network settings
A usable address needs more than an IP number.
IPv4 exchange
- Discover → Offer → Request → Acknowledge is the common initial flow.
- The lease has a lifetime and renewal behavior.
- DHCP relay carries requests across routed boundaries.
Typical options
- IP address and subnet mask
- Default gateway
- DNS resolver and domain search list
IPv6 choices
- SLAAC uses Router Advertisements.
- DHCPv6 can provide additional settings or addresses.
- Implementation and network policy determine the combination.
Routing
A host chooses a route before it sends
The routing table uses longest-prefix match, then policy or metric among eligible routes.
Local destination
- If the destination is on-link, resolve its link address.
- Send the frame directly to the destination.
- No router is needed for that local hop.
Remote destination
- Choose the most specific matching route.
- Send the frame to the next-hop gateway.
- Every router repeats a route lookup.
Default route
0.0.0.0/0 or ::/0 matches when nothing more specific does.- A missing default route prevents most off-subnet access.
- A route does not override a firewall deny.
Route lookup
Read a route table
The most specific matching prefix wins, not the first printed line.
Destination Next hop Interface
10.20.8.0/24 on-link eth0
10.20.0.0/16 10.20.8.1 eth0
0.0.0.0/0 10.20.8.254 eth0
Target 10.20.8.44 → on-link /24
Target 10.20.9.44 → via 10.20.8.1 /16
Target 1.1.1.1 → via 10.20.8.254 /0
Read the output
10.20.8.44 matches three routes; /24 is most specific.10.20.9.44 matches /16 and default; /16 wins.- The next-hop address itself must be reachable on a local link.
- Use
ip route get <address> to ask Linux for the actual decision.
NAT
NAT changes addresses at a boundary
NAT is common for IPv4 sharing, but it is not a substitute for firewall policy.
Source NAT / PAT
- Many private hosts share one public IPv4 address.
- The device tracks translations using addresses and ports.
- Return traffic must match the translation state.
Destination NAT
- A public address and port map to an internal service.
- Cloud load balancers and port forwarding are related patterns.
- The server may see a translated source unless the design preserves it.
Trade-offs
- Translation obscures end-to-end addressing.
- Stateful mappings can expire.
- Logs need enough context to identify the original client.
Traffic destinations
Unicast, multicast, broadcast, anycast
These describe who can receive a packet, not which application created it.
Unicast
- One destination address identifies one endpoint.
- Most ordinary client-server traffic is unicast.
- Routes select one path at a time per flow or packet.
Broadcast and multicast
- IPv4 broadcast reaches a local broadcast domain.
- Multicast targets a group of interested receivers.
- IPv6 uses multicast for several functions and has no broadcast.
Anycast
- Several sites advertise the same destination address.
- Routing sends a client to one reachable site.
- Used by many DNS and edge services; paths can change.
MTU
Packet size can make a path fail strangely
Every link has a maximum frame payload; the path supports the smallest effective MTU.
What happens
- A larger packet may be fragmented in IPv4 or dropped with an ICMP error.
- IPv6 routers do not fragment; the sender adjusts.
- Tunnels add headers and reduce effective payload size.
TCP consequence
- TCP MSS limits payload per segment.
- A wrong MSS or blocked ICMP can break large transfers.
- Small pings may work while HTTPS stalls.
How to test
- Check interface MTU and tunnel overhead.
- Use path MTU tools or controlled pings.
- Inspect captures for retransmissions and ICMP errors.
Chapter 3
Transport and applications
TCP, UDP, QUIC, and the protocols users actually touch: DNS, HTTP, TLS.
Chapter 3 · Part 3.1
Transport
How applications share a host and handle delivery.
Choice of transport
TCP, UDP, and QUIC solve different needs
The application chooses the transport behavior it requires.
TCP
- Connection-oriented byte stream.
- Reliable, ordered delivery with flow and congestion control.
- Used by HTTP/1.1, HTTP/2, SSH, and many databases.
UDP
- Datagram service with minimal transport guarantees.
- Applications decide how to handle loss and ordering.
- Used by DNS (which also uses TCP), voice, games, and as QUIC’s carrier.
QUIC
- Runs over UDP and integrates TLS 1.3.
- Reliable streams and congestion control live in QUIC.
- HTTP/3 runs over QUIC.
Ports and sockets
A port identifies a service endpoint
IP finds a host; a transport port helps find the process.
Four-tuple
- Source IP + source port + destination IP + destination port identify a TCP connection.
- Client source ports are usually temporary.
- A server commonly listens on a stable port.
Listening versus established
- A listening socket accepts new connections.
- Each established connection has its own state.
- Many clients can connect to one server port.
Troubleshooting
- Check the process bound to the expected address and port.
- A service bound only to
127.0.0.1 is not reachable remotely. - A firewall can block a listening service.
TCP setup
The three-way handshake
TCP peers agree on initial sequence numbers before application data flows.
SYN
- Client proposes a connection and its initial sequence number.
- A repeated SYN can indicate loss or filtering.
- The server must be reachable on the destination port.
SYN-ACK
- Server acknowledges and supplies its own sequence number.
- Seeing SYN but no SYN-ACK narrows the failure.
- A refused port can return a reset instead.
ACK
- Client acknowledges; the connection is established.
- TLS negotiation usually follows for HTTPS.
- A completed handshake does not prove the app is healthy.
TCP delivery
Reliability is a feedback loop
Sequence numbers, acknowledgements, timers, and windows keep a byte stream usable.
Loss recovery
- Unacknowledged data can be retransmitted.
- Duplicate ACKs and timers help detect loss.
- Some retransmissions are normal; sustained growth is a symptom.
Flow control
- The receiver advertises how much it can buffer.
- A zero window can pause a healthy network.
- The sender must not overwhelm the receiver.
Congestion control
- The sender estimates safe in-flight data for the path.
- Loss or delay may cause it to slow down.
- High bandwidth with high RTT needs a sufficiently large window.
Close and timeout
Connection endings tell different stories
A clean close, reset, and idle timeout are not equivalent.
FIN
- Gracefully ends one direction of a TCP stream.
- Both directions must be closed to finish normally.
TIME_WAIT helps handle delayed old packets.
RST
- Aborts a connection immediately.
- Can come from a host, proxy, or firewall.
- Correlate both ends before blaming the server.
Timeout
- No useful response arrives before a timer expires.
- Could be loss, filtering, routing, or an overloaded app.
- Check at which stage the timeout occurs.
UDP and QUIC
Low overhead does not mean no design work
A UDP packet may be lost, duplicated, reordered, or filtered.
UDP itself
- Preserves message boundaries.
- Has ports and a checksum.
- Does not promise delivery or congestion control.
Applications
- Voice may prefer a late packet to be discarded.
- DNS can retry a query.
- A custom protocol must plan for loss and abuse.
QUIC
- Uses UDP as a substrate, then adds secure connections and streams.
- Independent streams avoid some TCP head-of-line effects.
- Middleboxes still need to allow the UDP path.
Chapter 3 · Part 3.2
Application protocols
How names, requests, and secure sessions work.
DNS
DNS is a distributed naming system
The client usually asks a recursive resolver; authoritative servers own the answer.
Lookup path
- Browser or OS checks a local cache.
- A recursive resolver may answer from its cache.
- Otherwise it follows delegation toward the authoritative zone.
Response
A maps to IPv4; AAAA maps to IPv6.- CNAME points to another name.
- TTL tells caches how long an answer may be reused.
Failure modes
- NXDOMAIN means the name is not present in the queried DNS view.
- SERVFAIL means resolution failed.
- Split-horizon DNS can give different answers in different networks.
DNS records
The records you will meet most often
Record type changes what a DNS answer means.
| Type | Purpose | Example interpretation |
|---|
| A / AAAA | Address | Name → IPv4 / IPv6 |
| CNAME | Alias | Name → canonical name |
| MX | Mail routing | Domain → mail exchanger |
| TXT | Arbitrary text | SPF and domain verification often use it |
| NS | Delegation | Zone → authoritative nameservers |
| PTR | Reverse lookup | IP → name in reverse DNS |
| CAA | Certificate issuance policy | Which CAs may issue for a domain |
A CNAME is a name-to-name alias; it is not a redirect in the browser.
DNS caching
Why a DNS change is not instant
Caches can keep old answers until TTL expires, and clients may cache independently.
Positive caching
- A resolver stores a successful answer.
- Short TTL allows faster planned changes but increases query volume.
- A long TTL reduces lookup load but delays changes.
Negative caching
- An absent name can also be cached.
- Creating a record may not immediately clear earlier NXDOMAIN results.
- Check the authoritative answer and the resolver answer separately.
Troubleshooting
- Query a specific resolver with
dig @server name. - Check record type, TTL, and authoritative nameserver.
- Compare the answer from inside and outside a private network.
DNS example
Walk one uncached DNS lookup
The exact sequence depends on caches and resolver configuration.
Client → recursive resolver: A www.example.com?
Resolver → root: who serves .com?
Root → resolver: .com nameservers
Resolver → .com: who serves example.com?
.com → resolver: example.com nameservers
Resolver → authoritative: A www.example.com?
Authoritative → resolver: answer + TTL
Resolver → client: answer + TTL
What each server contributes
- Delegation points the resolver toward the next authority.
- The authoritative server owns the zone data.
- The recursive resolver caches the answer according to TTL.
- A CNAME may require another lookup before an address is returned.
HTTP
HTTP is request and response semantics
A URL names a resource; HTTP defines methods, headers, status codes, and bodies.
Request
- Method such as
GET, POST, or PUT. - Target path and authority/host.
- Headers can carry content type, cache rules, and credentials.
Response
- Status family: 2xx success, 3xx redirect, 4xx client, 5xx server.
- Headers explain content and caching.
- A body may contain HTML, JSON, or a stream.
Versions
- HTTP/1.1 uses persistent TCP connections.
- HTTP/2 multiplexes streams over one TCP connection.
- HTTP/3 maps HTTP to QUIC.
TLS
TLS protects the application conversation
HTTPS is HTTP over TLS; encryption alone does not prove the endpoint is the right one.
Handshake
- Client and server agree on keys and protocol parameters.
- The server presents a certificate for the requested name.
- The client validates chain, name, and validity period.
What TLS provides
- Confidentiality against passive observation.
- Integrity against undetected modification.
- Server authentication when validation succeeds.
What TLS does not provide
- It does not fix a vulnerable application.
- It does not hide every network metadata field.
- A trusted but wrong endpoint can still mishandle data.
HTTP behavior
Caching, redirects, and sessions
Many “network” symptoms are application behavior at Layer 7.
Caching
Cache-Control guides reuse and freshness.- CDNs and browsers can cache different objects.
- A stale response may come from a cache, not the origin.
Redirects
- 3xx responses point the client to another URL.
- A redirect can add an extra round trip.
- A loop often means conflicting proxy or app configuration.
Sessions
- Cookies carry session identifiers or state.
- A load balancer may use persistence, but stateless apps scale more easily.
- Secure cookie flags matter alongside TLS.
Middleboxes
Proxy, load balancer, and CDN
These devices may terminate one connection and create another.
Forward proxy
- Acts on behalf of clients.
- May filter, authenticate, or cache outbound requests.
- Clients need configuration or transparent interception.
Reverse proxy / load balancer
- Acts in front of servers.
- Chooses a healthy backend and may terminate TLS.
- Preserve original client context with trusted headers or proxy protocols.
CDN
- Caches content near users.
- Reduces origin load and geographic latency.
- Cache key and invalidation rules affect correctness.
Other common services
A small set of protocols supports daily operations
Recognize each service’s role before debugging its port.
SSH and NTP
- SSH provides encrypted remote administration.
- NTP synchronizes time, which matters for logs and certificates.
- Clock drift can look like an authentication problem.
Email
- SMTP transfers mail between systems.
- IMAP and POP retrieve mail for clients.
- MX records direct mail toward receiving servers.
Service discovery
- DNS names are common inside datacenters and clusters.
- Health checks help avoid unhealthy backends.
- A successful lookup does not prove the service is accepting traffic.
Chapter 4
Internet and security
How networks exchange reachability, and how to control and protect traffic.
Chapter 4 · Part 4.1
Routing and Internet
How networks exchange reachability beyond one subnet.
Forwarding decisions
Control plane versus data plane
Routes are learned or configured; packets are forwarded using the resulting table.
Control plane
- Static configuration or routing protocols build reachability.
- Policy decides which routes may be installed.
- Convergence changes the table after failures.
Data plane
- For each packet, find the best matching prefix.
- Apply next-hop and interface information.
- Forward, drop, or locally deliver the packet.
Common confusion
- A route can exist while the next hop is unreachable.
- A return route may be missing even when the forward route works.
- Firewall state is separate from routing state.
Routing types
Static, OSPF, and BGP at a glance
Different scales and administrative boundaries lead to different choices.
| Method | Where it fits | Key idea |
|---|
| Static route | Small or predictable networks | Operator specifies prefix and next hop |
| OSPF / IS-IS | Inside one organization | Routers exchange topology and compute paths |
| BGP | Between autonomous systems; also inside large fabrics | Neighbors exchange reachable prefixes with policy |
| Default route | Edge or leaf with one general exit | Catch-all path when no specific route exists |
Dynamic routing improves adaptation, but a bad advertisement or policy can spread a failure quickly.
Internet scale
What BGP actually decides
BGP exchanges reachability and policy, not a universal shortest physical path.
Autonomous systems
- An AS is a routing policy domain.
- Networks announce IP prefixes to neighbors.
- AS paths and attributes influence selection.
Traffic engineering
- Inbound and outbound paths may differ.
- A change can take time to propagate.
- More specific prefixes can override aggregates when accepted.
Operational safeguards
- Filter announcements and validate ownership.
- Use route monitoring and RPKI where applicable.
- Never infer the return path from one traceroute.
Tunnels and VPNs
A tunnel carries one packet inside another
The outer network reaches tunnel endpoints; the inner packet carries private traffic.
Common uses
- Site-to-site VPN connects private networks across the Internet.
- Remote-access VPN connects a user device.
- Overlay networks provide virtual links over an underlay.
Costs
- Encapsulation reduces effective MTU.
- Encryption consumes processing capacity.
- Tunnel health does not prove inner routes or firewall rules are correct.
Debug sequence
- Check outer connectivity and tunnel state.
- Check inner route selection and return path.
- Then test firewall and application behavior.
Chapter 4 · Part 4.2
Security
Control who can communicate and protect what they exchange.
Policy layers
Where to enforce access
Security is strongest when identity, network rules, and application checks agree.
Network ACL / firewall
- Matches address, port, protocol, direction, and sometimes state.
- Default deny can reduce accidental exposure.
- Rules need both intended forward and return behavior.
Identity
- Authentication answers who is connecting.
- Authorization answers what they may do.
- A reachable port should not imply permission.
Application
- Validate requests and inputs.
- Use TLS and secure session handling.
- Log security decisions without exposing secrets.
Firewall reasoning
Stateful and stateless filters
The difference matters most for return traffic.
| Filter | Tracks connections? | Typical implication |
|---|
| Stateful firewall | Yes | A permitted request can allow matching return packets |
| Stateless ACL | No | Allow rules may be needed in both directions |
| Application proxy | Understands app protocol | Can enforce host, path, identity, or content policy |
A timeout can be a deny, missing return rule, missing route, or silent packet loss. A reset suggests an active rejection or closed endpoint.
Trust boundaries
Encryption in transit and PKI
Trust comes from validating identities and protecting keys.
Certificates
- A certificate binds a public key to a name or identity.
- A CA signs it; clients validate the chain.
- Name mismatch, expiry, or an untrusted CA blocks a secure connection.
Mutual TLS
- Both sides present and verify certificates.
- Useful for service-to-service identity.
- Certificate issuance, rotation, and revocation become operational work.
Key management
- Keep private keys secret.
- Rotate and scope keys to the intended service.
- Do not disable verification to make a connection “work.”
Common threats
What network controls can and cannot stop
Think in terms of entry, movement, and impact.
Exposure
- Open management ports invite scanning and brute force.
- Restrict source ranges and require strong identity.
- Inventory external endpoints continuously.
Lateral movement
- Flat networks make one compromise more valuable.
- Segment workloads and control egress.
- Watch east–west traffic and unusual DNS or outbound connections.
Availability
- DDoS can exhaust links, state tables, or applications.
- Rate limits and upstream protection absorb some attacks.
- Capacity and runbooks matter alongside filters.
DNS and privacy
DNSSEC, DoT, and DoH solve different problems
Do not confuse answer authenticity with query confidentiality.
DNSSEC
- Signs DNS data so validating resolvers can check authenticity.
- Does not encrypt the DNS query or response.
- Requires correct signing and delegation.
DoT / DoH
- Encrypt transport to a chosen resolver.
- Do not by themselves prove that the answer is correct.
- Local policy and resolver trust still matter.
Practical check
- Find which resolver a device actually uses.
- Test expected public or private DNS view.
- Investigate certificate and clock errors separately.
Chapter 5
Cloud and containers
Apply the same networking model to virtual infrastructure.
Virtual networks
A VPC is a routed address space with policy
Cloud abstractions change management, not the basic packet questions.
Building blocks
- CIDR blocks divide into subnets.
- Route tables choose next hops.
- Security groups and network ACLs filter traffic.
Internet access
- Public addressing and routes are both needed.
- Private instances may egress through NAT or proxies.
- VPC endpoints keep selected service traffic on private paths.
Common mistakes
- Overlapping CIDRs block easy interconnection.
- Missing return routes create one-way traffic.
- A public subnet does not automatically make every resource public.
Load balancing
One address can front many backends
Distinguish the client-facing connection from the backend connection.
Layer 4
- Decides using IP and transport information.
- Useful for TCP or UDP workloads.
- Health checks determine eligible targets.
Layer 7
- Can route by HTTP host, path, or headers.
- Often terminates TLS.
- The application may need trusted forwarded client headers.
Availability
- Place healthy targets across failure domains.
- Tune timeouts and draining with app behavior.
- A healthy LB does not guarantee the whole user journey.
Containers and Kubernetes
Pod networking follows familiar rules
A container gets a network namespace; Kubernetes adds service discovery and virtual service addresses.
Pod and node
- A pod usually has its own IP.
- The CNI creates connectivity and may enforce policy.
- Cross-node traffic still relies on routes or an overlay.
Service
- A Service provides a stable virtual endpoint.
- DNS resolves the service name.
- Endpoints point to ready backend pods.
Ingress / Gateway
- Routes external HTTP traffic to Services.
- A controller or managed platform implements the data path.
- Check class, target health, TLS, and policy separately.
Chapter 6
Troubleshooting and practice
A repeatable method, real cases, labs, and review.
Chapter 6 · Part 6.1
Troubleshooting
A repeatable method beats random commands.
Method
Narrow the failing layer first
Ask where the last successful step ends.
Start with scope
- One user or everyone? One destination or all?
- When did it start, and what changed?
- Can you reproduce it from another location?
Walk the path
- Name resolution → local interface → route → transport handshake → TLS → application.
- Check the reverse path too.
- Compare a working and failing flow.
Collect evidence
- Record timestamps and exact errors.
- Inspect counters, logs, traces, and packets.
- Change one variable at a time.
“Cannot connect” is a symptom. A DNS failure, timeout, reset, TLS rejection, and HTTP 503 each point to different next checks.
Command line
A small command set answers many questions
Commands below use Linux; macOS equivalents are on the next slide.
ip addr
ip route get 1.1.1.1
ip neigh
dig example.com A
dig @1.1.1.1 example.com AAAA
ping -c 4 1.1.1.1
traceroute example.com
nc -vz example.com 443
curl -vI https://example.com
ss -lntup
Read the output
ip reveals local addressing, route choice, and neighbor state.dig separates DNS from transport or HTTP.nc tests a TCP port; curl -v exposes DNS, connect, TLS, and HTTP phases.ss shows local listeners. A successful command tests only that part of the path.
Platform commands
Linux and macOS quick mapping
Choose the commands for the host you are actually testing.
| Question | Linux | macOS |
|---|
| Interface addresses | ip addr | ifconfig |
| Route to a destination | ip route get 1.1.1.1 | route -n get 1.1.1.1 |
| IPv4 neighbors | ip neigh | arp -a |
| IPv6 neighbors | ip -6 neigh | ndp -a |
| Listening TCP ports | ss -lnt | lsof -nP -iTCP -sTCP:LISTEN |
| DNS and HTTP | dig, curl -v | dig, curl -v |
Commands reveal the host’s view. Test from the same network namespace or machine where the failing app runs.
Packet capture
Use Wireshark to test a hypothesis
Capture close to the suspected boundary; compare client and server views.
Capture safely
- Choose the correct interface and time window.
- Filter by host or port to limit volume.
- Packets may contain credentials or personal data; handle captures securely.
Read the sequence
- DNS query and answer
- TCP SYN → SYN-ACK → ACK or QUIC Initial packets
- TLS handshake, then encrypted application data
Filter examples
- Display filter:
dns - Display filter:
tcp.port == 443 - Display filter:
ip.addr == 192.0.2.10
Symptom map
First checks by failure type
The wording of the failure often tells you where to start.
| Symptom | Likely layer | First check |
|---|
| Name not found | DNS | Resolver, record type, NXDOMAIN / SERVFAIL |
| Connection timed out | Route / firewall / loss | SYN and reply, forward and return path |
| Connection refused | Transport / listener | Process bound to port, active reset |
| Certificate error | TLS | Hostname, trust chain, expiry, system time |
| HTTP 5xx | Proxy / application | Backend health, app logs, upstream timeout |
| Small works; large stalls | MTU / PMTUD | Tunnel overhead, ICMP, MSS |
| Slow but succeeds | Latency / loss / app | RTT, retransmits, server timing |
Traceroute
Why traceroute reveals intermediate hops
It sends probes with increasing TTL or Hop Limit and listens for ICMP Time Exceeded.
Probe 1: TTL=1 → first router decrements to 0
Probe 2: TTL=2 → second router decrements to 0
Probe 3: TTL=3 → third router ...
traceroute example.com
# Or on some systems: tracepath example.com
Interpret carefully
- Each hop address is the router interface that answered; it is not always the forwarding interface.
- A
* can mean no reply or rate limiting, not necessarily a broken path. - Different probe types can take different paths through policy or load balancing.
- The forward path says little about the return path.
Case study
“DNS works, but HTTPS times out”
Do not stop at the first successful check.
Known good
dig returns the expected address.- The client has a route to the destination.
- Another site may still work.
Next evidence
- Does a TCP SYN leave the client?
- Does a SYN-ACK return?
- If yes, does TLS finish?
Possible causes
- Firewall or route blocks outbound or return traffic.
- Server is not listening, or load balancer has no healthy targets.
- MTU or TLS inspection breaks later packets.
Case study
“The page loads, but it is slow”
Break total time into DNS, connect, TLS, first byte, and download.
Before the request
- Slow DNS or many uncached lookups.
- Long RTT to a distant server.
- Repeated connection setup.
At the server
- Large time to first byte suggests server or backend delay.
- A proxy may queue requests.
- Application traces reveal database or dependency time.
During transfer
- Low throughput, retransmissions, or packet loss.
- Large assets or no caching.
- Test from several networks before blaming one link.
Observability
Measure what users actually experience
One metric rarely explains a network incident.
Network signals
- RTT, loss, jitter, interface errors, drops.
- Link utilization and queue depth.
- Route changes and BGP sessions where relevant.
Service signals
- Request rate, error rate, duration.
- DNS success and latency.
- TLS failures and backend health.
Correlate
- Use synchronized timestamps.
- Connect client symptoms to proxy, app, and network logs.
- Alert on sustained user impact, not every transient packet loss.
Chapter 6 · Part 6.2
Practice and review
Turn terminology into skills you can demonstrate.
Lab 1
Discover your own network path
Linux commands are shown; on macOS use the command mapping in the troubleshooting section.
ip addr
ip route
ip route get 1.1.1.1
ip neigh
dig example.com A
curl -vI https://example.com
Write down
- Identify your interface address, prefix, and default gateway.
- Explain why
1.1.1.1 uses that route. - Find the gateway’s link address in the neighbor table.
- Compare DNS answer, connected IP, TLS hostname, and HTTP status.
Lab 2
Trace DNS and the transport handshake
Capture your own traffic, then explain the first few packets.
# Terminal A: capture on your test interface
sudo tcpdump -i <interface> -nn 'port 53 or port 443'
# Terminal B: run a test
curl -vI https://example.com
# Wireshark display filters
dns
tcp.flags.syn == 1
tcp.analysis.retransmission
What to find
- Find the DNS query and matching answer, if they were not cached.
- For TCP, identify SYN, SYN-ACK, and ACK.
- For HTTP/3, expect UDP/QUIC instead of a TCP handshake.
- Avoid saving or sharing packets containing private data.
Lab 3
Solve three subnet questions
Work without a calculator first; verify with a trusted subnet tool afterward.
A. 10.42.17.99/20
Network? Last address?
B. Split 192.0.2.0/24 into four
equal subnets. What are the prefixes?
C. Are 10.42.16.0/20 and
10.42.32.0/20 overlapping?
Answers:
A. 10.42.16.0 – 10.42.31.255
B. /26: .0, .64, .128, .192
C. No
Reasoning
- A
/20 mask groups 16 values of the third octet. - Four equal parts add two prefix bits:
/24 → /26. - Compare full address ranges rather than relying on visual similarity.
Self-check
Can you explain these without looking?
If not, revisit the relevant section and repeat the lab.
Path
- Why does an off-subnet packet use the gateway’s MAC?
- What changes at a router, and what normally stays the same?
- How can the return path differ?
Protocols
- How do DNS, TCP/QUIC, TLS, and HTTP depend on each other?
- What does a TCP reset tell you that a timeout does not?
- Why can small traffic work when large traffic fails?
Operations
- Which command tests name resolution, port reachability, and HTTP separately?
- What evidence would prove a firewall or app is responsible?
- What data is sensitive in a packet capture?
Glossary
Terms to keep in your pocket
Use these as quick anchors, then explain the packet journey in your own words.
| Term | Short meaning |
|---|
| MAC / frame | Local-link address / unit of transfer |
| IP / packet | Internetwork address / unit of transfer |
| CIDR / prefix | Notation for an address range and network-bit count |
| Gateway / route | Next hop / decision for where to send |
| Port / socket | Service number / process endpoint |
| DNS / TTL | Name system / cache lifetime |
| NAT / MTU | Address translation / largest packet a link can carry |
| RTT / jitter | Round-trip delay / delay variation |
Further reading
Primary references and practice
Start with the standards for precise behavior; use vendor guides for implementation details.
Standards
- TCP —
rfc-editor.org/rfc/rfc9293
- IPv4 —
rfc-editor.org/rfc/rfc791
- IPv6 —
rfc-editor.org/rfc/rfc8200
- DNS concepts —
rfc-editor.org/rfc/rfc1034
- QUIC —
rfc-editor.org/rfc/rfc9000
- HTTP semantics / HTTP/3 — RFC 9110 / 9114
Hands-on references
- Wireshark User’s Guide —
wireshark.org/docs/wsug_html/
- Linux
ip, ss, tcpdump manual pages
- Cloud provider networking guides for route tables, firewalls, and load balancers
- Draw your own packet path and annotate each address, port, and next hop.