Computer Networking
From cables and frames to DNS, TLS and the cloud.
Learn how data really moves between computers, layer by layer. You will subnet IPv4 and IPv6 networks, follow packets through switches, routers and NAT, understand TCP, DNS, HTTP and TLS, secure and troubleshoot networks with real tools, and finish by designing, building and debugging a small office network in a simulator with packet captures.
01Network models & foundations
The vocabulary and layered models every other topic builds on.
- What a network is: hosts, LANs, WANs & topologiesA network is a set of devices, called hosts, connected by links so they can exchange data. Switches connect hosts inside a local area network, and routers connect networks to each other, forming wide area networks and ultimately the internet. Bandwidth, latency and throughput describe how well a network performs.11 min
- The OSI modelThe OSI model splits networking into seven layers, each with one responsibility and a clear interface to the layers above and below. Real networks run TCP/IP rather than OSI protocols, but the OSI layer numbers are the shared vocabulary engineers use. They also give you a systematic order for troubleshooting.10 min
- TCP/IP model & encapsulationThe TCP/IP model has four layers: application, transport, internet and link. As data moves down the stack each layer adds its own header, wrapping the data like nested envelopes, and the receiver unwraps them in reverse. This encapsulation is what you see layer by layer in a Wireshark capture.10 min
02Physical & data link layers
Cables, frames, MAC addresses and the switches that forward them.
- Physical media: copper, fibre & signallingThe physical layer moves raw bits as electrical signals, light or radio waves. Copper twisted pair is cheap and common up to 100 metres, while fibre carries data much further with no electrical interference. Duplex settings and cable category limit the speed a link can reach.11 min
- Ethernet frames & MAC addressesEthernet is the dominant layer 2 technology for wired LANs. Each frame carries destination and source MAC addresses, a type field saying what is inside, the payload and a checksum. A MAC address is a 48-bit identifier whose first half identifies the manufacturer.10 min
- Switches & MAC learningA switch forwards frames by MAC address. It learns which port each source MAC lives on, stores that in its MAC address table and sends later frames only out of the right port. Frames to unknown or broadcast destinations are flooded to every other port in the VLAN.10 min
- VLANs & trunkingVLANs split one physical switch into several logical networks, each its own broadcast domain. Access ports belong to a single VLAN, while trunk ports carry many VLANs between switches by adding an 802.1Q tag to each frame. Traffic between VLANs must go through a router or layer 3 switch.10 min
- ARP & neighbour discoveryARP finds the MAC address that belongs to an IPv4 address on the local network. A host broadcasts who-has for the IP and the owner replies directly with its MAC, which the asker caches. To reach a remote network a host ARPs for its default gateway, not for the final destination.10 min
- Loops & Spanning Tree ProtocolRedundant links between switches protect against failures, but Ethernet frames have no TTL, so a loop lets broadcasts circle forever and melt the network. Spanning Tree Protocol elects a root bridge and blocks just enough ports to leave a loop-free tree. If an active link fails, a blocked port takes over.11 min
03IP addressing & subnetting
Addresses, prefixes and how to carve networks into subnets.
- IPv4 addresses, binary & the IPv4 headerAn IPv4 address is 32 bits written as four decimal octets, such as 192.168.1.10. A prefix length splits it into a network part, shared by every host on the subnet, and a host part. Some ranges are reserved: private addresses for internal networks, loopback, and link-local.10 min
- Subnetting & CIDRSubnetting divides a network into smaller networks by borrowing host bits for the network part. CIDR notation such as 10.0.0.0/26 states how many bits are network bits. From the prefix you can work out the mask, network and broadcast addresses, usable host range and host count.9 min
- VLSM & address planningVariable-length subnet masking lets each subnet be just big enough for its hosts instead of making every subnet the same size. You allocate the largest subnets first, aligned on their block size, then fill the gaps with smaller ones. Contiguous allocations can later be summarised into a single route.9 min
- IPv6 addressingIPv6 uses 128-bit addresses written as eight groups of hexadecimal, which removes address scarcity and the need for NAT. Sites typically receive a /48 or /56 and every LAN is a /64. Hosts can configure themselves with SLAAC using router advertisements, or get addresses from DHCPv6.10 min
- ICMP & ICMPv6ICMP carries control and error messages for IP. Echo request and reply power ping, time exceeded messages power traceroute, and destination unreachable messages tell senders why delivery failed. ICMPv6 is even more central, carrying neighbour discovery and router advertisements.11 min
04Routing & NAT
How packets find their way between networks.
- Routing tables & longest-prefix matchA router forwards each packet by looking up its destination IP in a routing table of prefixes and next hops. When several routes match, the most specific one, with the longest prefix, wins. A default route, 0.0.0.0/0, catches everything else.12 min
- Static & default routesStatic routes are entered by hand and never change unless you change them. They are simple and predictable for small networks, stub sites and default routes towards an ISP. Their weakness is that they do not adapt when links fail.13 min
- Dynamic routing & OSPF conceptsDynamic routing protocols let routers discover routes and react to failures automatically. OSPF is a link-state protocol: every router floods descriptions of its links so all routers share the same map, then each runs Dijkstra's shortest-path algorithm on it. Areas keep large networks manageable.13 min
- BGP & internet routing conceptsThe internet is a network of autonomous systems, each run by one organisation with its own routing policy. BGP is the protocol they use to tell each other which prefixes they can reach, along with the AS path to get there. It chooses routes by policy rather than pure shortest path, and mistakes can take large parts of the internet offline.13 min
- NAT & PATNetwork address translation rewrites IP addresses as packets cross a router, letting many private hosts share one public IPv4 address. Port address translation tracks each connection by source port so replies return to the right host. NAT conserves addresses but breaks end-to-end reachability.13 min
05Transport layer: TCP & UDP
Ports, reliable streams and fast datagrams.
- Ports, sockets & multiplexingPorts let one host run many network services at once by giving each a 16-bit number. A socket is an endpoint made of an IP address and port, and a connection is identified by a 5-tuple: protocol, source IP and port, destination IP and port. Servers listen on well-known ports while clients use random ephemeral ones.11 min
- TCP connection lifecycleTCP provides a reliable, ordered byte stream over unreliable IP. Before sending data, the two sides perform a three-way handshake to agree on initial sequence numbers. Connections end with a FIN exchange in each direction, or abruptly with a RST.13 min
- TCP reliability & flow controlTCP makes delivery reliable by numbering bytes, acknowledging what arrives and retransmitting what does not. Flow control uses the receiver's advertised window so a fast sender cannot overrun a slow receiver. Together they deliver an ordered stream even when packets are lost or reordered.12 min
- TCP congestion controlCongestion control protects the network itself by limiting how much a sender has in flight. TCP grows a congestion window quickly during slow start, then cautiously during congestion avoidance, and cuts it back when it detects loss. Modern variants such as CUBIC and BBR tune this for fast, long-distance links.12 min
- UDP & QUICUDP sends independent datagrams with just ports, a length and a checksum: no handshake, no retransmission, no ordering. That suits DNS queries, voice, video, games and protocols that build their own reliability. QUIC is such a protocol: it runs over UDP and provides encrypted, multiplexed, reliable streams for HTTP/3.13 min
06Application protocols
The protocols users actually touch: names, addresses, web and mail.
- DNS: hierarchy, resolution & recordsDNS translates names like www.example.com into IP addresses and other records. Your device asks a recursive resolver, which walks the hierarchy from the root servers to the top-level domain servers to the domain's authoritative servers, then caches the answer for its TTL. Nearly every connection starts with a DNS lookup, so DNS faults look like everything is down.12 min
- DHCPDHCP gives hosts their network configuration automatically: IP address, subnet mask, default gateway, DNS servers and lease time. A new client broadcasts because it has no address yet, and the exchange of four messages is remembered as DORA. Relays forward the broadcasts to a DHCP server on another subnet.11 min
- HTTP/1.1 semanticsHTTP is a request-response protocol: the client sends a method, path, headers and optional body, and the server replies with a status code, headers and body. HTTP/1.1 is plain text, so you can read it directly with curl -v. Headers control caching, content type, cookies, authentication and connection reuse.11 min
- HTTP/2 & HTTP/3HTTP/2 keeps HTTP semantics but sends binary frames, multiplexing many requests over one TCP connection with compressed headers. A lost TCP packet still stalls all streams, so HTTP/3 moves to QUIC over UDP, where each stream recovers independently. Browsers negotiate the version automatically.11 min
- TLS & certificatesTLS encrypts and authenticates connections, turning HTTP into HTTPS. During the handshake the client and server agree on keys with ephemeral Diffie-Hellman and the server proves its identity with a certificate signed by a trusted certificate authority. TLS 1.3 completes this in a single round trip.12 min
- Email: SMTP, IMAP & authenticationEmail is relayed between servers with SMTP, which looks up the recipient domain's MX records to find where to deliver. Users read mail with IMAP, which keeps messages on the server, or the older POP3. SPF, DKIM and DMARC records in DNS let receivers check that mail really comes from the domain it claims.11 min
07Wireless networking
Radio, Wi-Fi standards and keeping wireless networks secure.
- Wi-Fi standards & radio basicsWi-Fi is the IEEE 802.11 family of standards for wireless LANs, now branded by generation. Newer generations add wider channels, more spatial streams and more efficient scheduling. Frequency band matters as much as generation: 2.4 GHz reaches further, while 5 and 6 GHz offer more channels and less interference.11 min
- How Wi-Fi works: SSIDs, association & roamingAccess points advertise networks with beacon frames carrying the SSID. A client scans, authenticates and associates with one AP, then exchanges data frames through it. Because radio is a shared medium, devices listen before talking and take turns using CSMA/CA.12 min
- Wireless security: WPA2, WPA3 & 802.1XWireless traffic can be received by anyone nearby, so encryption and authentication are essential. WPA2 and WPA3 encrypt frames with keys derived during a four-way handshake. Home networks use a shared passphrase, while enterprises use 802.1X so each user authenticates individually against a RADIUS server.12 min
08Network tools & troubleshooting
A method plus the commands that reveal what the network is doing.
- Troubleshooting methodologyGood troubleshooting is a method, not a guess. Define the symptom and scope precisely, then test layer by layer, bottom-up from the cable or top-down from the application, changing one variable at a time. Writing down each test and result stops you going in circles.11 min
- ping, traceroute & mtrping sends ICMP echo requests to test whether a host is reachable and how long round trips take. traceroute sends probes with increasing TTL to reveal each router along the path. mtr combines both, showing loss and latency per hop over time.12 min
- dig, nslookup & resolver checksdig and nslookup query DNS directly so you can see exactly what a server answers. Querying specific servers separates a broken local resolver from a broken authoritative zone. Following the delegation with +trace reveals misconfigured name servers.10 min
- ip, ss, curl & nmap on the hostOn Linux the ip command shows and changes interfaces, addresses and routes, while ss lists sockets and the processes that own them. curl tests application endpoints with full control over headers and timing. nmap scans hosts to discover open ports, which you should only do on systems you own or are authorised to test.11 min
- Packet capture with tcpdumptcpdump captures packets from an interface and prints or saves them, which makes it the standard capture tool on servers without a GUI. Capture filters written in BPF syntax limit what is recorded so files stay small. Save to a pcap file and open it in Wireshark for deeper analysis.11 min
- Wireshark analysisWireshark decodes captured packets into every protocol layer and lets you filter, follow conversations and graph behaviour. Display filters narrow thousands of packets to the ones that matter, and expert analysis flags retransmissions, resets and zero windows. It is the fastest way to prove what actually happened on the wire.11 min
09Network security basics
Control who can talk to what, encrypt across untrusted networks and detect attacks.
- Firewalls & ACLsFirewalls decide which traffic may pass based on rules about addresses, ports, protocols and connection state. Stateless ACLs check each packet in isolation, while stateful firewalls track connections and automatically allow replies. Good rule sets deny by default and allow only what is needed between clearly defined zones.12 min
- VPNs: IPsec, WireGuard & TLS VPNsA VPN builds an encrypted tunnel across an untrusted network so traffic travels as if on a private link. Site-to-site VPNs join whole networks, often with IPsec, while remote-access VPNs connect individual users. WireGuard is a modern, minimal protocol that is fast and easy to configure.11 min
- IDS/IPS & common network attacksCommon network attacks include reconnaissance scans, spoofing to intercept traffic, and floods that exhaust resources. An intrusion detection system watches traffic and alerts on suspicious patterns, while an intrusion prevention system sits inline and can block them. Detection uses known signatures or deviations from normal behaviour.12 min
10Cloud & data-centre networking
How modern applications are networked at scale.
- Data-centre topologies: leaf-spineModern data centres carry far more server-to-server traffic than traffic to users, which the old three-tier design handled poorly. Leaf-spine fabrics connect every leaf switch to every spine switch, so any two servers are the same number of hops apart and ECMP spreads load across all paths. Overlays such as VXLAN stretch layer 2 segments across this layer 3 fabric.11 min
- Virtual private cloudsA virtual private cloud is your own isolated network inside a cloud provider, defined by a CIDR block and divided into subnets across availability zones. Route tables decide whether a subnet is public, with a route to an internet gateway, or private, reaching out only through a NAT gateway. Security groups and network ACLs filter traffic.12 min
- Load balancersA load balancer spreads incoming connections across a pool of healthy servers, adding capacity and resilience. Layer 4 balancers forward TCP or UDP connections by address and port, while layer 7 balancers understand HTTP and can route by host, path or header. Health checks remove failing servers automatically.11 min
- CDNs & anycastA content delivery network caches content at many edge locations close to users, cutting latency and offloading the origin server. Many CDNs use anycast, announcing the same IP address from every location so routing sends each user to a nearby edge. The same spread-out capacity absorbs large DDoS attacks.11 min
- SDN & network automation conceptsSoftware-defined networking separates the control plane, which decides where traffic should go, from the data plane, which forwards packets. A central controller programs many devices through APIs, so the network can be managed as one system and configured as code. Cloud VPCs are SDN in practice.10 min
11Capstone: design & troubleshoot an office network
Design, build, capture and fix a small office network end to end.
- Design the office networkDesigning a network starts from requirements: how many users and devices, which services, which groups must be isolated and how much growth to expect. From there you draw the physical and logical topology, assign VLANs and subnets, and plan services such as DHCP, DNS, NAT and firewall rules. A clear plan makes the build and every later fix faster.11 min
- Build it in Packet Tracer or GNS3In Cisco Packet Tracer or GNS3 you build the designed network device by device: switch VLANs and trunks, router subinterfaces for inter-VLAN routing, DHCP pools, NAT to the internet and ACLs between zones. Verify each layer as you go rather than configuring everything first. Save working configurations so you can return to a known-good state.12 min
- Capture & explain real trafficCapturing your own network's traffic connects every protocol you studied to real packets. Record a client joining the network and loading a web page, then annotate each exchange: DHCP DORA, ARP for the gateway, DNS lookup, TCP handshake, TLS handshake and HTTP. Writing it up proves you understand each step.11 min
- Troubleshoot broken scenariosPractising on deliberately broken networks builds real troubleshooting skill. Have a partner, or a script, inject faults such as a wrong access VLAN, a missing route, a bad gateway, a DNS typo or an overly strict ACL. Diagnose each one layer by layer and record symptom, evidence, cause and fix.13 min