Networking Fundamentals
Complete Notes

Based on Practical Networking's course. Covers Modules 1, 2 & 3 — with extra DevOps-relevant topics. Use Learning Mode for understanding; Revision Mode for quick review.

Module 1 · Fundamentals Module 2 · Hands-On Module 3 · Layer 3 Focus DevOps Extras
MODULE 1

Networking Fundamentals

1a Hosts, IP Addresses & Networks

What is a Host?

A host is any device that sends or receives traffic on a network.

Traditional Hosts

Computers, laptops, phones, printers, servers, smart TVs, speakers, smartwatches, smart thermostats, fridges

Cloud / IoT Hosts

Cloud VMs, cloud storage services, IoT sensors — all follow the same communication rules

Key Insight All hosts — whether a fridge or a data-center server — follow the exact same rules to communicate on the internet. Understanding "host behavior" explains how everything communicates.

Clients vs Servers

These are relative roles, not fixed device types:

RoleActionExample
ClientInitiates a requestYour browser requesting google.com
ServerResponds to a requestGoogle's web server sending the page
Relativity Example A web server is a server to your browser → but it becomes a client when it requests files from a file server → and that file server becomes a client when requesting updates from an update server. The same machine can be both!
Client–Server Relativity Diagram
Your Browser CLIENT request Web Server SERVER / CLIENT request File Server SERVER / CLIENT request Update Server SERVER

IP Addresses

An IP address is the identity of each host — like a phone number or mailing address. Every host needs one to send and receive data.

  • IP address = 32 bits (ones and zeros)
  • Split into 4 octets, each converted to decimal (0–255)
  • Example: 192.168.1.100
  • Every packet is stamped with a source IP and a destination IP
IP Address Anatomy
  192      .    168     .    1      .    100
  ┌────────────┐  ┌────────────┐  ┌──────────┐  ┌──────────┐
  │  Octet 1   │  │  Octet 2   │  │ Octet 3  │  │ Octet 4  │
  │  00-255    │  │  00-255    │  │  00-255  │  │  00-255  │
  └────────────┘  └────────────┘  └──────────┘  └──────────┘
       8 bits          8 bits         8 bits        8 bits
  ══════════════════════════════════════════════════════════
                       Total: 32 bits

IP Hierarchy (Subnetting Concept)

IP addresses are assigned hierarchically. Example — ACME Corporation:

ACME Corp IP Hierarchy
  ACME owns:  10.x.x.x  (anything starting with 10)
  │
  ├── New York Office:   10.20.x.x
  │     ├── Sales:       10.20.55.x
  │     ├── Engineering: 10.20.66.x
  │     └── Marketing:   10.20.77.x
  │
  ├── London Office:     10.30.x.x
  │     └── Sales:       10.30.55.x  ← 10.30.55.127 = London Sales host
  │
  └── Tokyo Office:      10.40.x.x
Subnetting The process of dividing a larger IP block into smaller, organized sub-blocks is called subnetting. Covered in depth in Module 3.

Networks

A network = a logical grouping of hosts that require similar connectivity.

  • The simplest network: two hosts connected by a wire
  • Networks can contain sub-networks (subnets)
  • The Internet = interconnected networks, tied together by ISPs
The Internet — Networks of Networks
Internet ISPs connect all networks Home Network 192.168.1.x PC, Phone, TV... School Network 10.0.x.x Classroom subnets Corp Network 172.16.x.x Office subnets Coffee Shop 10.10.x.x Guest Wi-Fi
1b Network Devices — Repeaters, Hubs, Bridges, Switches, Routers

Why Devices Exist

Data (electrical signal) decays over distance. Also, directly connecting every host to every other host doesn't scale. Network devices solve both problems.

Repeater

Sole purpose: regenerate a signal. Anything entering one side comes out the other, amplified. Allows communication across greater distances.

Repeater
  Host A ──[weak signal]──► REPEATER ──[fresh signal]──► Host B

Hub

A multi-port repeater. Solves the scaling problem by giving all hosts a central point to connect to. But: it duplicates every incoming packet to all ports — every host receives everything.

Hub — All hosts receive all data
                  ┌──── Host A
                  │
  [packet from A] HUB ─── Host B  ← also gets packet
                  │
                  └──── Host C  ← also gets packet

Bridge

Sits between two hub-connected segments. Has exactly 2 ports. Learns which hosts are on each side, and only forwards packets across when needed — containing traffic within its segment.

Bridge — Learns & contains traffic
  Segment A:              Segment B:
  Host1 ─┐               ┌─ Host3
  Host2 ─┤ HUB-A ──[Bridge]── HUB-B ┤─ Host4

  • Host1 ↔ Host2: Bridge does NOT forward (same side)
  • Host1 ↔ Host3: Bridge DOES forward (cross-side)

Switch

Combines Hub (multiple ports) + Bridge (learns per-port). A switch learns which host is on which port and sends data only to the correct port.

  • Facilitates communication within a network
  • All connected hosts share the same IP address space (e.g. 192.168.1.x)
  • A Layer 2 device
Switch — Intelligent port-based forwarding
           ┌── Port 1: Host A (192.168.1.10)
           ├── Port 2: Host B (192.168.1.20)
  SWITCH ──┤── Port 3: Host C (192.168.1.30)
           └── Port 4: Host D (192.168.1.40)

  Host A → Host C: Switch sends packet ONLY to Port 3

Router

Facilitates communication between networks. Lives at the boundary of networks and directs traffic using routing tables.

  • Has an IP address in each network it connects to
  • Acts as the gateway — the exit point for hosts trying to reach other networks
  • Stores a routing table: a list of all known networks and which interface leads there
  • Security policies can be applied at router boundaries
Router — Connecting Networks
Network A 172.16.20.x GW: 172.16.20.1 ROUTER IF-A: 172.16.20.1 | IF-B: 172.16.30.254 Routing Table: knows both networks Network B 172.16.30.x GW: 172.16.30.254

Routing vs Switching

Core distinction Switching = moving data within a network  |  Routing = moving data between networks.
These are processes, not just device names. Access points, firewalls, load balancers, and Layer 3 switches all perform one or both.
DeviceLayerPurposeAddresses used
RepeaterL1Regenerate signalNone
HubL1Multi-port repeater (broadcasts)None
BridgeL2Contain traffic between segmentsMAC
SwitchL2Forward within a networkMAC
RouterL3Forward between networksIP
2a OSI Model — Layers 1, 2 & 3

Why the OSI Model?

Networking needs rules, just like languages have grammar. The OSI model divides networking rules into 7 layers. If every layer does its job, the goal — two hosts sharing data — is achieved.

Think of it like the human body: the skeletal, respiratory, and cardiovascular systems each have their own function, and together they achieve "life." The OSI layers each have a function, and together they achieve "data sharing."

OSI Model — 7 Layers at a Glance
  Layer 7 │ Application  │ What the app uses (HTTP, DNS, FTP...)
  Layer 6 │ Presentation │ Encoding, encryption, compression
  Layer 5 │ Session      │ Connection management
  ─────────────────────────────────────────────────────
  Layer 4 │ Transport    │ Service-to-service (ports, TCP/UDP)
  Layer 3 │ Network      │ End-to-end delivery (IP addresses)
  Layer 2 │ Data Link    │ Hop-to-hop delivery (MAC addresses)
  Layer 1 │ Physical     │ Bits on the wire (cables, Wi-Fi)

Layer 1 — Physical

Goal: Transport bits (1s and 0s) between hosts.

  • Anything that moves bits from A to B is a Layer 1 technology
  • Examples: Ethernet cables, fiber optic cables, Wi-Fi radio signals
  • Devices: Repeaters, Hubs
Don't be fooled by "Physical" The OSI model was written before wireless existed. Wi-Fi is still Layer 1 because its job is solely to carry bits — just through air instead of wire.

Layer 2 — Data Link

Goal: Hop-to-hop delivery — move data from one NIC to the next NIC.

  • A "hop" = one NIC to another NIC
  • Addressing scheme: MAC addresses
  • Devices: NICs, Wi-Fi cards, Switches

MAC Addresses

  • 48 bits, displayed as 12 hex digits
  • Every NIC has a globally unique MAC address
  • Three common display formats:
Windows:  A1-B2-C3-D4-E5-F6   (dashes)
Linux:    A1:B2:C3:D4:E5:F6   (colons)
Cisco:    A1B2.C3D4.E5F6      (dots, groups of 4)

Layer 3 — Network

Goal: End-to-end delivery — get data from the source host all the way to the destination host, regardless of how many hops are in between.

  • Addressing scheme: IP addresses
  • Devices: Routers and any host with an IP address

Why both MAC and IP addresses?

They serve different scopes:

IP Address (L3)

Stays constant for the entire journey. Identifies source and destination hosts end-to-end. Like the address on an envelope.

MAC Address (L2)

Changes at every hop. Only relevant for the current single hop (NIC → NIC). Like who's handing the envelope at each step.

Packet Flow — L2 headers added/removed per hop, L3 header stays
Source IP: 10.1.1.1 Router 1 removes L2, adds new L2 Router 2 removes L2, adds new L2 Router 3 removes L2, adds final L2 Destination IP: 10.4.4.4 L3 header (Src IP → Dst IP) stays unchanged entire journey Hop 1 L2 Hop 2 L2 Hop 3 L2 Hop 4 L2

ARP — Address Resolution Protocol

ARP is the glue between L3 and L2. When a host knows the IP address of its next hop but needs the MAC address, it uses ARP to find it.

Remember ARP = "Given this IP, what is the MAC?" — it links Layer 3 to Layer 2. Covered in detail later.
2b OSI Model — Layer 4, 5, 6, 7 & Encapsulation

Layer 4 — Transport

Goal: Service-to-service delivery — get data to the right application on the destination host.

A single host runs many programs simultaneously (browser, Slack, a game). All of them share the same IP address. Layer 4 uses port numbers to tell them apart.

Port Numbers

  • Range: 0–65535
  • Two protocols: TCP and UDP (each has its own 0–65535 space)
  • Well-known ports (servers): assigned ahead of time, standardized
  • Ephemeral ports (clients): randomly chosen for each connection

TCP vs UDP

TCP — Transmission Control Protocol

Favors reliability. Guarantees delivery, order, and error-checking. Used for web (HTTP/HTTPS), email, file transfers. Slower but trustworthy.

UDP — User Datagram Protocol

Favors efficiency / speed. No delivery guarantee, no ordering. Used for video streaming, VoIP, DNS, online games. Fast but "fire and forget."

Well-Known Port Numbers

ServiceProtocolPort
HTTPTCP80
HTTPSTCP443
DNSUDP (mainly)53
DHCP ServerUDP67
DHCP ClientUDP68
SSHTCP22
FTPTCP20, 21
SMTPTCP25
IRCUDP6667

How Client-Server Port Communication Works

Client connecting to multiple servers simultaneously
  Client IP: 1.1.1.1                  Servers
  ┌─────────────────────────┐
  │  Browser tab 1          │──[src:1.1.1.1:9999  dst:2.2.2.2:80 ]──► site.com (HTTP)
  │  Browser tab 2          │──[src:1.1.1.1:11000 dst:2.2.2.2:80 ]──► site.com (same site, diff tab)
  │  Banking app            │──[src:1.1.1.1:7777  dst:3.3.3.3:443]──► bank.com (HTTPS)
  │  Chat (IRC)             │──[src:1.1.1.1:4444  dst:4.4.4.4:6667]─► chat server (UDP)
  └─────────────────────────┘

  Server responses come back to the CLIENT's random source port.
  Each connection tracked by: Src IP + Src Port + Dst IP + Dst Port (4-tuple)

Layers 5, 6, 7 — Session, Presentation, Application

In the original OSI model these had distinct roles, but in practice modern applications blend them together freely:

LayerOriginal RoleReality today
Layer 5 – SessionManage connections between hostsApps handle this themselves
Layer 6 – PresentationData formatting, encryption, compressionApps handle this themselves
Layer 7 – ApplicationUser-facing protocols (HTTP, DNS, FTP...)This is what developers interact with
TCP/IP Model The practical alternative model — TCP/IP — collapses OSI layers 5, 6, and 7 into a single Application Layer. For understanding data flow on the internet, layers 1–4 are what matter most.

Encapsulation

When a host sends data, it goes down the OSI stack, with each layer wrapping the data with its own header:

Encapsulation — Sending (wrapping layers)
  Application data:   [ DATA ]
                           ↓ Layer 4 adds port header
  Segment:            [ L4 Header | DATA ]
                           ↓ Layer 3 adds IP header
  Packet:             [ L3 Header | L4 Header | DATA ]
                           ↓ Layer 2 adds MAC header + trailer
  Frame:              [ L2 Header | L3 Header | L4 Header | DATA | L2 Trailer ]
                           ↓ Layer 1: converted to bits and transmitted

  ─────────────────────────────────────────────────────────────
  Receiving host De-encapsulates (strips each header going up)
3a/b Everything Hosts do to Speak on the Internet

What a Host Does Before Sending a Packet

Before any data leaves your computer, the host must figure out:

  1. Does the destination IP live on my network or a different network?
  2. What is the MAC address of the next hop?

Step 1 — Is it local or remote?

The host compares the destination IP to its own subnet. If the destination is in the same subnet → send directly. If it's in a different subnet → send to the default gateway (the router's IP on that network).

Step 2 — ARP (Address Resolution Protocol)

The host knows the IP of the next hop (either the destination or the gateway). But Layer 2 needs a MAC address. ARP resolves this:

ARP Process
  Host A wants to reach IP 192.168.1.20 (local)

  1. Host A broadcasts: "Who has 192.168.1.20? Tell 192.168.1.10"
     [src MAC: A, dst MAC: FF:FF:FF:FF:FF:FF (broadcast)]

  2. Host B (192.168.1.20) replies: "I have 192.168.1.20. My MAC is B."
     [src MAC: B, dst MAC: A] (unicast reply)

  3. Host A caches "192.168.1.20 → MAC B" in its ARP table.

  4. Host A sends the actual packet to MAC B.

Default Gateway

Every host has a configured default gateway — the IP of the router interface on its local network. When the destination is on another network, the host sends the packet to the gateway. The gateway (router) then forwards it onward.

DNS — Domain Name System

Before any of the above, if the destination is a hostname (like google.com), the host needs to resolve it to an IP via DNS.

Full sequence when typing a URL
  1. User types: https://google.com
  2. Host checks DNS cache → not found
  3. Host sends DNS query to configured DNS server (UDP, port 53)
  4. DNS server returns: google.com → 142.250.x.x
  5. Host now has destination IP → proceeds with ARP / routing
  6. TCP 3-way handshake (if TCP)
  7. HTTP/HTTPS request sent
  8. Response received → page rendered
4a/b Everything Switches Do

Switch's Core Function

A switch maintains a MAC Address Table (also called CAM table): a mapping of MAC addresses to ports.

How a Switch Learns

Switch MAC Learning Process
  Initial state: MAC table is empty.

  1. Host A (MAC: AAAA) sends a frame from Port 1.
     Switch records: AAAA → Port 1.
     Switch doesn't know where BBBB is → FLOODS frame to all other ports.

  2. Host B (MAC: BBBB) receives, replies from Port 3.
     Switch records: BBBB → Port 3.
     Switch now knows AAAA and BBBB.

  3. Next frame from A to B:
     Switch looks up BBBB → Port 3. Sends ONLY to Port 3.  ← UNICAST FORWARDING

VLANs (Virtual LANs)

A switch can be logically divided into multiple VLANs. Each VLAN acts as its own broadcast domain — hosts in VLAN 10 cannot communicate with VLAN 20 at Layer 2; they need a router (or Layer 3 switch) to cross VLAN boundaries.

DevOps relevance VLANs are used to segment environments: dev, staging, prod might each be a separate VLAN. Kubernetes node networks and pod networks are logically similar concepts (separate Layer 2 domains).

Spanning Tree Protocol (STP)

When you have multiple switches for redundancy, you create loops. STP automatically blocks redundant paths to prevent infinite loops, and re-enables them if the primary path fails.

5a/b/c Everything Routers Do

Routing Table

A router stores a table of known networks. Each entry (a route) includes:

  • Destination network (e.g., 10.20.0.0/16)
  • Next hop IP or outgoing interface
  • Metric (cost/preference)

Types of Routes

TypeHow addedExample
Directly connectedAutomatic when an interface is configuredThe subnet on each interface
Static routeManually configured by adminip route 10.30.0.0 255.255.0.0 10.20.1.1
Dynamic routeLearned via routing protocols (OSPF, BGP, EIGRP)Auto-learned from neighbor routers
Default routeStatic or dynamic0.0.0.0/0 — "send here if no other match"

Longest Prefix Match

When multiple routes match a destination, the router picks the most specific one (the one with the longest prefix / highest subnet mask).

Routes: 10.0.0.0/8, 10.20.0.0/16, 10.20.55.0/24
Destination: 10.20.55.100
Winner: 10.20.55.0/24 (most specific)
6 Network Protocols — DNS, DHCP, HTTP/S, FTP, SMTP

DNS — Domain Name System

Resolves human-readable names to IP addresses. Hierarchical system: Root → TLD (.com, .org) → Authoritative nameserver.

Record TypePurpose
AHostname → IPv4
AAAAHostname → IPv6
CNAMEAlias → another hostname
MXMail exchange server
NSName server for domain
PTRReverse DNS: IP → hostname
TXTArbitrary text (SPF, DKIM...)

DHCP — Dynamic Host Configuration Protocol

Automatically assigns IP addresses to hosts. The DORA process:

DHCP DORA Process
  Client                          DHCP Server
    │──── Discover (broadcast) ──────────►│
    │◄─── Offer (IP offer) ───────────────│
    │──── Request (accept offer) ─────────►│
    │◄─── Acknowledge (confirmed) ────────│

  Client receives: IP, Subnet Mask, Default Gateway, DNS Server

HTTP / HTTPS

HTTP (port 80): HyperText Transfer Protocol — transfers web content. Plaintext.

HTTPS (port 443): HTTP + TLS encryption. The same protocol, but wrapped in SSL/TLS.

SSL/TLS: Provides encryption, authentication, and integrity. TLS is the modern, more secure version of SSL.

FTP — File Transfer Protocol

Transfers files between hosts. Uses port 21 for control, port 20 for data. Plaintext — use SFTP or FTPS in production.

SMTP — Simple Mail Transfer Protocol

Sends email (port 25). Use SMTPS (port 465) or SMTP with STARTTLS (port 587) for secure mail.

7 Life of a Packet as it Travels the Internet
📊 Mermaid Diagram — Copy into mermaid.live to render
sequenceDiagram
    participant H as Your Host
    participant SW as Switch (LAN)
    participant GW as Default Gateway (Router)
    participant ISP as ISP Router
    participant DST as Destination Server

    H->>H: DNS resolve google.com → 142.250.x.x
    H->>H: ARP → get gateway MAC
    H->>SW: Frame [Src:HostMAC, Dst:GW-MAC | Src:HostIP, Dst:142.250.x.x]
    SW->>GW: Forward to GW port
    GW->>GW: Strip L2, check routing table
    GW->>ISP: New Frame [Src:GW-MAC, Dst:ISP-MAC | Src:HostIP, Dst:142.250.x.x]
    ISP->>ISP: Strip L2, route to next hop
    ISP->>DST: Frame [Src:ISP-MAC, Dst:Server-MAC | Src:HostIP, Dst:142.250.x.x]
    DST->>DST: Strip all headers, process request
    DST->>H: Response (reverse path)
The Key Takeaway At every router hop: L2 header is stripped and recreated. L3 header (IPs) never changes. L4 header (ports) only changes if NAT is involved.
MODULE 2

Proving What We Learned & Going Further

1a–e Configuring & Verifying Network Attributes

Key Network Attributes Every Host Has

AttributePurposeExample
IP AddressHost's identity on the network192.168.1.50
Subnet MaskDefines the network portion of IP255.255.255.0 = /24
Default GatewayRouter to use for non-local traffic192.168.1.1
DNS ServerName resolution8.8.8.8

Verification Commands

# Windows
ipconfig /all        # Show all network config
ipconfig /flushdns   # Clear DNS cache
nslookup google.com  # DNS lookup
route print          # Routing table
arp -a               # ARP table

# Linux / macOS
ip addr              # Show IP addresses (modern)
ifconfig             # Older alternative
ip route             # Routing table
cat /etc/resolv.conf # DNS config
arp -n               # ARP table
nmcli                # NetworkManager CLI (Linux)

# macOS
networksetup -listallnetworkservices
2a–c Ping & Wireshark

Ping

Ping uses ICMP (Internet Control Message Protocol) to test connectivity. It sends an Echo Request and waits for an Echo Reply.

ping 8.8.8.8           # Basic ping (ICMP echo)
ping -c 4 google.com   # Send 4 packets (Linux/Mac)
ping -n 4 google.com   # Send 4 packets (Windows)
traceroute google.com  # Linux/Mac: trace route hops
tracert google.com     # Windows equivalent
Ping can fail even when connectivity is fine Many firewalls block ICMP. A failed ping doesn't always mean the host is down.

Wireshark — Packet Analysis

Wireshark is a packet capture tool that lets you see every frame going in and out of your NIC. Essential for debugging network issues.

Key Concepts

  • Capture filter: Filter at capture time (e.g., only TCP port 80)
  • Display filter: Filter what you see after capture
  • Each packet shows all layers: Frame → Ethernet → IP → TCP/UDP → Application
# Common Wireshark display filters
tcp.port == 80          # HTTP traffic
ip.addr == 192.168.1.5  # Traffic to/from specific IP
icmp                    # Only ping traffic
dns                     # Only DNS
http.request            # HTTP requests only
tcp.flags.syn == 1      # TCP SYN packets (new connections)
3a/b NAT — Network Address Translation

Why NAT Exists

IPv4 has ~4.3 billion addresses — not enough for every device. NAT allows many devices to share a single public IP by mapping private IPs to public ones.

Private IP Ranges (RFC 1918)

RangeCIDRCommon use
10.0.0.0 – 10.255.255.255/8Corporate networks
172.16.0.0 – 172.31.255.255/12Corporate / Docker default
192.168.0.0 – 192.168.255.255/16Home routers

Types of NAT

Static NAT One private IP ↔ one public IP (1:1 mapping). Used when a server needs a consistent public IP.
Static PAT (Port Address Translation) One public IP, multiple private IPs, distinguished by port. A specific port is permanently mapped to an internal host.
Dynamic PAT (Most Common) Many private IPs share ONE public IP. The router tracks connections using the source port. This is what your home router does. Also called NAT overload or masquerade.
Dynamic PAT — Many-to-One
  Internal                     Router (NAT)              Internet
  192.168.1.10:5000 ──►  translate ──► 203.0.113.5:40001 ──► Server
  192.168.1.20:6000 ──►  translate ──► 203.0.113.5:40002 ──► Server
  192.168.1.30:7000 ──►  translate ──► 203.0.113.5:40003 ──► Server

  Router NAT table:
  40001 → 192.168.1.10:5000
  40002 → 192.168.1.20:6000
  40003 → 192.168.1.30:7000

  Replies come back to 203.0.113.5:4000x → router translates back
DevOps relevance Docker uses NAT (masquerade) by default. Kubernetes Services use NAT rules (via iptables/ipvs). Cloud load balancers perform NAT. Understanding NAT is essential for debugging container/k8s networking.
4a/b Radiowaves & WiFi Security

How Wi-Fi Works

Wi-Fi uses radio waves to transmit data. It's still Layer 1 — just wireless instead of wired. An Access Point (AP) bridges wireless hosts to a wired network.

  • 2.4 GHz: Better range, more interference, slower (used by older devices)
  • 5 GHz: Less interference, faster, shorter range
  • 6 GHz (Wi-Fi 6E): Newest, fastest, shortest range

Wi-Fi Security Standards

StandardSecurityStatus
WEPWeak, easily cracked❌ Avoid
WPAImproved but still vulnerable❌ Avoid
WPA2AES encryption, widely used✅ Acceptable
WPA3Best, uses SAE instead of PSK✅ Recommended

SSID, BSSID, Association

  • SSID: The human-readable Wi-Fi network name
  • BSSID: The MAC address of the Access Point
  • Devices associate with an AP and get an IP via DHCP
5a–c Home Networking, Segmentation & Scaling

Typical Home Network

Home Network Topology
  Internet
      │
  [Modem] ──── ISP provides public IP
      │
  [Router/Gateway]  192.168.1.1
      │         \
  [Switch]      [Wi-Fi AP]
   /    \            \
Host A  Host B     Phone/Laptop

  All internal hosts: 192.168.1.x/24
  Router does NAT: translates private IPs to public IP

Network Segmentation

Dividing a network into smaller parts for security and performance:

  • Isolates broadcast domains
  • Limits blast radius of security incidents
  • Enables different policies per segment
  • Implemented via VLANs or separate physical networks

Scaling Network Capacity

  • More switches: Add ports / more hosts
  • Link aggregation (LACP): Bundle multiple cables between switches for more bandwidth and redundancy
  • Hierarchical design: Access → Distribution → Core switch layers
  • Spine-leaf: Modern data-center design for horizontal scale
6 Protocols Primer

A protocol is a set of rules that define how two parties communicate. Protocols define: message format, sequence of messages, error handling, and connection establishment/teardown.

TCP 3-Way Handshake

TCP Connection Establishment
  Client                    Server
    │──── SYN ─────────────►│  "I want to connect, my seq=X"
    │◄─── SYN-ACK ──────────│  "OK, my seq=Y, your seq+1 acknowledged"
    │──── ACK ─────────────►│  "Your seq+1 acknowledged"
    │                        │
    │ [Data exchange]        │
    │                        │
    │──── FIN ─────────────►│  "Done sending"
    │◄─── FIN-ACK ──────────│
    │──── ACK ─────────────►│  Connection closed
7 OSI Model: Layers 5, 6, 7 in Depth

Layer 5 — Session

Manages sessions between applications — starting, maintaining, and ending conversations. Examples: NetBIOS, RPC, SQL sessions.

Layer 6 — Presentation

Handles data translation: encoding (ASCII, Unicode), encryption (SSL/TLS operates here conceptually), compression (gzip). Ensures data sent by one app can be understood by another.

Layer 7 — Application

The layer that user-facing applications and protocols operate at: HTTP, FTP, DNS, SMTP, SSH, DHCP. This is where developers spend most of their time.

MODULE 3

Layer 3 Focus

1 IP Address Groups

Classes of IP Addresses (Classful, historical)

ClassRangeDefault MaskUse
A1–126.x.x.x/8Large orgs
B128–191.x.x.x/16Medium orgs
C192–223.x.x.x/24Small orgs
D224–239.x.x.xN/AMulticast
E240–255.x.x.xN/AReserved / Experimental

Classful addressing is obsolete. Modern networking uses CIDR (Classless Inter-Domain Routing). But you'll still see the terms "Class A/B/C" in the wild.

Special IP Ranges

AddressMeaning
127.0.0.1Loopback (localhost) — refers to yourself
0.0.0.0Default route / unspecified address
255.255.255.255Limited broadcast (sent to all on local network)
10.x.x.x, 172.16-31.x.x, 192.168.x.xPrivate (RFC 1918)
169.254.x.xAPIPA — self-assigned when DHCP fails
2a/b Unicast, Multicast, Broadcast & Anycast
TypeDestinationExampleUse Case
UnicastOne specific hostTypical web requestMost network traffic
BroadcastAll hosts on local networkARP requests, DHCP DiscoverDiscovery protocols
MulticastA subscribed group of hosts224.0.0.x rangeStreaming, routing protocols (OSPF)
AnycastNearest host with that IP8.8.8.8 (Google DNS)CDN, DNS at scale
Anycast in Practice Cloudflare's 1.1.1.1, Google's 8.8.8.8, and Cloudflare's CDN all use anycast. The same IP is announced from multiple locations globally; BGP routes you to the nearest one. Critical for DevOps when building globally distributed services.
3a/b/c Subnetting — CIDR, Subnet Masks

What is Subnetting?

Subnetting = dividing a large IP block into smaller, manageable sub-blocks. It controls which hosts are in the same network and which need a router to communicate.

Subnet Mask

A 32-bit number that defines the network portion vs host portion of an IP address.

IP:   192.168.1.100  →  11000000.10101000.00000001.01100100
Mask: 255.255.255.0  →  11111111.11111111.11111111.00000000
                        ─────────── Network ───────────  ── Host ──
CIDR: /24 (24 ones in the mask)

CIDR Notation

Instead of writing 255.255.255.0, we write /24 — the number of 1-bits in the subnet mask.

CIDRSubnet MaskHostsUsable
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/30255.255.255.25242
/32255.255.255.25511 (single host)
Why 2 less usable? First IP = Network address (e.g. 192.168.1.0) | Last IP = Broadcast address (e.g. 192.168.1.255). These can't be assigned to hosts.

Subnetting Example: Split /24 into /26s

192.168.1.0/24 split into 4 × /26 subnets
  Original: 192.168.1.0/24 (256 IPs, 254 usable)

  Subnet 1: 192.168.1.0/26   →  .0   to .63   (62 usable)
  Subnet 2: 192.168.1.64/26  →  .64  to .127  (62 usable)
  Subnet 3: 192.168.1.128/26 →  .128 to .191  (62 usable)
  Subnet 4: 192.168.1.192/26 →  .192 to .255  (62 usable)

  Each subnet gets: Network addr, 62 hosts, Broadcast addr
DevOps Subnetting Rule of Thumb In AWS VPCs, Azure VNets, GCP VPCs — you define CIDRs and subnet them. AWS reserves 5 IPs per subnet (first 4 + last 1). Always use /24 or larger for production subnets to avoid running out of IPs during scaling.
4–8 NAT Deep Dive — Static, PAT, Dynamic PAT

Static NAT (1-to-1)

One private IP permanently mapped to one public IP. Used for servers that must be reachable from the internet with a consistent public IP (e.g., a web server behind a corporate firewall).

# Example (Cisco-style concept)
ip nat inside source static 10.0.0.10 203.0.113.10
# 10.0.0.10 always appears as 203.0.113.10 externally

Static PAT (Port Forwarding)

A specific external port is mapped to an internal host. Very common in home routers and small office setups.

# Port forward: external 203.0.113.5:8080 → internal 192.168.1.100:80
# Used for: hosting a web server at home, game servers, remote access

Dynamic PAT (NAT Overload / Masquerade)

Multiple internal hosts share one public IP. The NAT device tracks connections using source port numbers.

This is what Linux iptables -t nat -A POSTROUTING -j MASQUERADE does Docker, Kubernetes nodePort services, and home routers all use dynamic PAT. The NAT table entry expires after a timeout if no traffic.

NAT and DevOps

TechnologyNAT Type Used
Docker container networkingDynamic PAT (masquerade)
Kubernetes NodePortDNAT (destination NAT) via iptables
AWS/GCP Load BalancerDNAT to backend pods/instances
VPN gatewayNAT traversal + static mappings
Home routerDynamic PAT
DEVOPS EXTRA

Topics Critical for Junior DevOps (not in videos)

+ Essential DevOps Networking Topics

Cloud Networking Basics

Cloud providers implement software-defined versions of all the same concepts:

TraditionalAWSGCP / Azure
NetworkVPCVPC / VNet
SubnetSubnet (per-AZ)Subnet (regional)
RouterRoute TableRoutes
FirewallSecurity Group / NACLFirewall Rules / NSG
NATNAT GatewayCloud NAT
Load BalancerALB / NLB / CLBCloud LB / ALB
Private DNSRoute 53 PrivateCloud DNS

Firewall / Security Groups

Control which traffic is allowed in/out of a network or host.

  • Stateful firewall (Security Groups in AWS): tracks connection state. If you allow outbound, the reply is automatically allowed inbound.
  • Stateless firewall (NACLs in AWS): each packet evaluated independently. You must allow both directions explicitly.

Load Balancers

TypeLayerDecision basisUse case
Layer 4 (NLB)L4IP + PortTCP/UDP apps, low latency
Layer 7 (ALB)L7HTTP headers, path, hostnameWeb apps, microservices

Container & Kubernetes Networking

Kubernetes Networking Layers
  Pod A ──── (same node, L2) ──────► Pod B
  Pod A ──── (diff node, L3 overlay) ► Pod C
                    │
              CNI Plugin (Calico/Flannel/Cilium)
              handles pod IP assignment + routing

  Service (ClusterIP):
    Virtual IP (VIP) → iptables/ipvs DNAT → Pod IPs (load balanced)

  NodePort:
    Node:30080 → DNAT → ClusterIP → Pod

  LoadBalancer:
    Cloud LB → NodePort → ClusterIP → Pod

Important Linux Networking Commands

# Interface and IP
ip addr show                    # All interfaces and IPs
ip link show                    # Link status
ip addr add 10.0.0.5/24 dev eth0  # Assign IP

# Routing
ip route show                   # Routing table
ip route add 10.0.0.0/8 via 192.168.1.1  # Add static route

# Connections
ss -tulpn                       # Open sockets (better than netstat)
netstat -tulpn                  # Open sockets (older)
curl -v http://example.com      # Test HTTP with verbose output

# DNS
dig google.com                  # DNS lookup (full detail)
nslookup google.com             # Simpler DNS lookup
resolvectl status               # systemd-resolved status

# Firewall (iptables)
iptables -L -n -v               # List all rules
iptables -t nat -L -n -v        # List NAT rules

# Traffic capture
tcpdump -i eth0 port 80         # Capture HTTP traffic
tcpdump -i any host 10.0.0.5    # All traffic to/from host

SSL/TLS Certificates

  • Certificate: Contains public key + identity info, signed by a CA
  • CA (Certificate Authority): Trusted third party that signs certificates (Let's Encrypt, DigiCert)
  • TLS handshake: Client and server negotiate cipher suite, exchange keys, establish encrypted channel
  • mTLS: Mutual TLS — both client AND server present certificates. Used heavily in service meshes (Istio, Linkerd)
# Check a certificate
openssl s_client -connect google.com:443
openssl x509 -in cert.pem -text -noout

# Common cert formats
.pem / .crt   — Base64 encoded certificate
.key          — Private key (keep secret!)
.csr          — Certificate Signing Request
.p12 / .pfx   — PKCS12 bundle (cert + key together)
Revision Mode Every concept from all three modules, condensed for fast review. No topic skipped.
MODULE 1

Fundamentals — Quick Review

1a Hosts, IPs, Networks
Host = any device that sends or receives traffic (PC, phone, server, IoT, cloud VM)
Client = initiates request | Server = responds. These roles are relative — the same device can be both
IP Address = 32-bit identity of a host, written as 4 octets (0–255 each). e.g. 10.20.55.127
Every packet has a source IP and destination IP
IP hierarchy: IP blocks subdivided by org → office → team via subnetting
Network = logical grouping of hosts needing similar connectivity. Internet = interconnected networks via ISPs
1b Network Devices
Repeater: regenerates signal. Solves distance decay
Hub: multi-port repeater. All hosts receive all packets. L1 device
Bridge: 2 ports, learns which hosts are on each side. Contains traffic. L2 device
Switch: Hub + Bridge. Per-port learning. Sends only to correct port. Facilitates within-network comms
Router: connects networks. Uses routing table. Acts as gateway. Security policy point
Switching = within network | Routing = between networks. Processes, not just device types
2a OSI Layers 1–3
L1 Physical: transport bits. Cables, Wi-Fi, repeaters, hubs
L2 Data Link: hop-to-hop delivery. MAC addresses. 48-bit / 12 hex. NICs, switches
L3 Network: end-to-end delivery. IP addresses. 32-bit / 4 octets. Routers, hosts
MAC: changes per hop | IP: stays constant end-to-end. Both needed for different scopes
ARP: resolves IP → MAC. Broadcasts "who has IP x?" Unicast reply. Cached in ARP table
At each router hop: L2 header stripped and rewritten, L3 header stays
2b OSI Layer 4 & Upper Layers
L4 Transport: service-to-service. Port numbers distinguish applications
TCP: reliable, ordered, error-checked | UDP: fast, no guarantee
Ports: HTTP=80, HTTPS=443, SSH=22, DNS=53, DHCP=67/68, FTP=20/21, SMTP=25
Clients pick random ephemeral source port per connection. Server responds to that port
Connection tracked by 4-tuple: SrcIP + SrcPort + DstIP + DstPort
L5/6/7: Session / Presentation / Application. TCP/IP model merges all into "Application Layer"
Encapsulation: App data → L4 adds ports → L3 adds IPs → L2 adds MACs → L1 transmits bits
3 Everything Hosts Do
Host first resolves hostname → IP via DNS (UDP port 53)
Host checks: is destination on my subnet? → direct ARP. Different subnet? → ARP for gateway MAC
ARP: broadcast to get MAC for a known IP. Response cached in ARP table
Default gateway: router's IP on local network. All non-local traffic goes here first
TCP 3-way handshake: SYN → SYN-ACK → ACK (before any data)
4 Everything Switches Do
MAC table (CAM): maps MAC addresses to ports. Populated by learning source MACs from incoming frames
Unknown destination MAC → flood to all ports. Known MAC → unicast to that port only
VLAN: logical network segmentation on a switch. Different VLANs need a router to communicate
STP: prevents loops in redundant switch topologies. Blocks redundant links, re-enables on failure
5 Everything Routers Do
Routing table: network → interface/next-hop mappings. Consulted for every packet
Route types: directly connected (auto), static (manual), dynamic (OSPF/BGP), default (0.0.0.0/0)
Longest prefix match: most specific route wins
Router has an IP address in every connected network. Hosts use that IP as their gateway
6 Protocols
DNS: resolves names→IPs. Records: A, AAAA, CNAME, MX, NS, PTR, TXT
DHCP DORA: Discover→Offer→Request→Acknowledge. Gives IP, mask, gateway, DNS
HTTP: port 80, plaintext | HTTPS: port 443, HTTP+TLS encryption
FTP: 20/21 | SSH: 22 | SMTP: 25
MODULE 2

Hands-On — Quick Review

1 Configuring Network Attributes
4 key attributes: IP, Subnet Mask, Default Gateway, DNS Server
Linux: ip addr, ip route, cat /etc/resolv.conf, arp -n
Windows: ipconfig /all, route print, arp -a, nslookup
2 Ping & Wireshark
Ping: uses ICMP Echo Request/Reply. Tests basic connectivity. Can be blocked by firewalls
Traceroute: shows path (hops) to destination. traceroute (Linux) / tracert (Windows)
Wireshark: captures and displays packets with all layer details. Use display filters like tcp.port == 443
3 NAT
NAT: solves IPv4 exhaustion. Translates private→public IPs
Private ranges: 10.x.x.x/8, 172.16-31.x.x/12, 192.168.x.x/16
Static NAT: 1 private ↔ 1 public | Static PAT: port forwarding | Dynamic PAT: many-to-one (home router, Docker)
Dynamic PAT tracks connections via NAT table: external port → internal IP:port
4–5 WiFi, Home Networking, Segmentation
Wi-Fi is L1. 2.4GHz (range) vs 5GHz (speed) vs 6GHz (fastest)
Security: WEP ❌, WPA ❌, WPA2 ✅, WPA3 ✅ (best)
Network segmentation: separates hosts for security + performance. Implemented via VLANs or subnets
MODULE 3

Layer 3 Focus — Quick Review

1–2 IP Groups, Unicast/Multicast/Broadcast/Anycast
Classful: A(/8), B(/16), C(/24), D(multicast), E(reserved). Modern = CIDR (classless)
Special IPs: 127.0.0.1=loopback, 169.254.x.x=APIPA, 255.255.255.255=broadcast
Unicast=one host | Broadcast=all on LAN | Multicast=subscribed group | Anycast=nearest instance
Anycast: same IP announced globally, BGP routes to nearest. Used by Google DNS, CDNs
3 Subnetting
Subnet mask: defines network vs host portion. /24 = 255.255.255.0 = 256 IPs = 254 usable
Usable = 2^(host bits) − 2 (subtract network + broadcast addresses)
CIDR = /prefix notation. Each extra bit halves the block: /24→128 hosts, /25→62 hosts
Splitting /24 into /26 gives 4 subnets of 62 usable hosts each
AWS reserves 5 IPs per subnet. /30 = 2 usable (point-to-point links). /32 = single host
4–8 NAT Deep Dive
Static NAT: 1:1. One private IP permanently = one public IP
Static PAT: port forwarding. External port mapped to internal host:port permanently
Dynamic PAT: many-to-one. NAT table tracks ephemeral port → internal IP:port. Entries expire on timeout
Linux masquerade = dynamic PAT. Docker, K8s NodePort all use variants of NAT
DEVOPS

DevOps Networking — Quick Review

+ DevOps Critical Concepts
Cloud VPCs: software-defined networks. VPC→Subnet→Route Table→Security Group = Network→Subnet→Router→Firewall
Security Groups: stateful firewall (allow reply auto) | NACLs: stateless (both directions needed)
L4 LB (NLB): routes by IP+port | L7 LB (ALB): routes by HTTP path/hostname/headers
Container networking: each pod gets IP, CNI plugin routes between pods, Services use ClusterIP+iptables DNAT
mTLS: both client and server present certs. Used in service meshes (Istio/Linkerd) for zero-trust
Key tools: ip addr, ip route, ss -tulpn, dig, tcpdump, curl -v, iptables -L
APIPA 169.254.x.x: means DHCP failed. Host assigned itself an IP. Check DHCP server
TLS certs: .pem/.crt=cert, .key=private key (never share!), .csr=signing request, .p12=bundle