01. What Is Computer Networking?
Networking connects devices so they can communicate and share resources. Computers, phones, printers and servers can all take part in a network.
Host
A network-connected endpoint that can send or receive data.
Client
A device or application requesting a service.
Server
A system or application providing services to clients.
Packet
A unit of data carried by a network-layer protocol such as IP.
A Simple Local Network
02. Types of Computer Networks
PAN — Personal Area Network
A network around one person. Example: a phone connected to Bluetooth earbuds.
LAN — Local Area Network
Connects devices in a limited area, such as a home, office or building.
MAN — Metropolitan Area Network
Connects networks across a city or metropolitan area.
WAN — Wide Area Network
Connects networks across large distances, such as offices in different countries.
03. Network Topologies
A topology describes how devices and connections are arranged.
Bus Topology
Devices share one backbone cable. A backbone fault can disrupt the network. Older Ethernet systems used this arrangement.
Star Topology
Each device connects to a central device, usually a switch. One endpoint cable failure normally affects that endpoint, but central switch failure affects its connected devices.
Ring Topology
Each device connects to two neighbors, forming a loop. Fault tolerance depends on the ring technology and available backup paths.
Mesh Topology
A mesh provides multiple connections. In a full mesh, every device connects directly to every other device. Extra links improve redundancy but increase cost.
Tree Topology
A hierarchy connects a main device to smaller branches. Example: a main office switch connected to switches on different floors.
04. Common Networking Devices
Illustrative hardware examples. Models look different, and some devices combine several functions.
Hub
A Layer 1 device that repeats received signals to other ports. Connected devices share bandwidth and a collision domain. Hubs are largely obsolete.
Switch
Usually forwards Ethernet frames at Layer 2 using learned MAC addresses. Modern full-duplex Ethernet links avoid the collisions found in shared hub networks.
Router
Connects IP networks and forwards packets using routing information. A home router often also includes a switch, Wi-Fi access point and firewall.
Modem
Provides connectivity over an access technology such as cable or DSL. It converts information into signals suitable for that access link and back again.
Access Point
Connects Wi-Fi clients to a network. A standalone access point commonly bridges wireless traffic to a wired LAN.
Repeater
Regenerates or retransmits signals to extend communication distance. The image shows a common Wi-Fi extender implementation.
Bridge
Connects Layer 2 network segments and forwards frames using MAC information. An Ethernet switch is essentially a multiport bridge.
Firewall
Allows or blocks traffic according to security rules. It may be a physical appliance, software on a host or a cloud service.
05. OSI Model — The Seven Layers
OSI divides network communication into seven conceptual layers. Each layer describes a different job. It helps you understand protocols and investigate problems.
Sending: Layer 7 down to Layer 1. Receiving: Layer 1 up to Layer 7.
Application
Provides network services used by applications. Examples include HTTP, DNS and SMTP.
Presentation
Describes data representation, encoding, compression and encryption functions.
Session
Describes establishing, managing and ending conversations between applications.
A website login session or cookie is an application-level mechanism, not automatically OSI Layer 5.
Transport
Supports application-to-application communication using ports. TCP provides reliable, ordered byte delivery; UDP provides datagrams without built-in delivery guarantees.
Network
Handles logical addressing and forwarding packets between networks. IP operates here.
Data Link
Handles frames on a local link. Ethernet uses MAC addresses and an FCS to detect frame corruption.
Physical
Transmits bits using electrical, optical or radio signals through physical media.
Example: Opening an HTTPS Website
Assume DNS resolution is complete and the connection uses HTTPS over TCP. HTTP/3 uses QUIC instead.
- Application: The browser creates an HTTP request.
- Presentation-related functions: TLS encrypts its content.
- Session-related functions: Applications and protocols manage the conversation; this need not be a separate implementation step.
- Transport: TCP carries encrypted bytes in segments, normally toward server port 443.
- Network: IP addressing and routers guide packets toward the server.
- Data Link: Frames carry packets across each local link.
- Physical: Bits travel as signals.
Encapsulation and Decapsulation
Encapsulation adds protocol information around data. For TCP over IP over Ethernet:
The receiver processes this information in reverse. This is decapsulation. TLS decrypts the content before the web server reads the HTTP request.
OSI Troubleshooting Examples
| Problem | Starting point | Check |
|---|---|---|
| No Ethernet link | Layer 1 | Cable, power and port. |
| Wrong VLAN | Layer 2 | Switch port configuration. |
| Wrong gateway | Layer 3 | IP settings and routing. |
| TCP connection fails | Layer 4 and supporting layers | Service, ports, routes and firewall. |
| HTTP 404 response | Layer 7 | URL or application route. |
Why is a website cookie not automatically Layer 5?
Because web cookies and login sessions are application-level mechanisms. The word “session” alone does not determine an OSI layer.
Which layer uses IP addresses?
Layer 3 — Network.
What does HTTP 404 tell you?
An HTTP server responded, but the requested resource was not found. Check the URL or application routing.
06. TCP/IP Model
The Internet protocol suite is commonly described using four layers. Teaching materials also use a five-layer version that separates Physical and Data Link.
| Four-layer model | Approximate OSI mapping | Examples |
|---|---|---|
| Application | Layers 5–7 | HTTP, DNS, SMTP |
| Transport | Layer 4 | TCP, UDP |
| Internet | Layer 3 | IP, ICMP |
| Link | Layers 1–2 | Ethernet, Wi-Fi |
07. IP Addresses
An IP address identifies an interface within an IP network. Addresses may change when a device joins another network.
IPv4
A 32-bit address written as four decimal numbers. Example: 192.168.1.10.
IPv6
A 128-bit address written in hexadecimal. Documentation example: 2001:db8::10.
Private IPv4
Used inside private networks. These ranges are not globally routed on the public Internet.
Public IP
A globally routable address. Reachability still depends on routing, firewall rules and services.
Private IPv4 Ranges
10.0.0.0/8172.16.0.0/12192.168.0.0/16
192.168.1.10 at home while the router uses
a public IPv4 address for translated Internet connections.
08. MAC Addresses
Ethernet and Wi-Fi use MAC addresses for local-link communication. A typical MAC address contains 48 bits.
Example: 02:1A:2B:3C:4D:5E
MAC addresses can be locally assigned, randomized or changed. They are not guaranteed permanent identifiers.
MAC: Used for delivery across a local link.
09. Subnetting
Subnetting divides an IP address block into smaller networks. A prefix length tells you how many bits belong to the network portion.
IP address: 192.168.1.10/24
Subnet mask: 255.255.255.0
Network: 192.168.1.0
Broadcast: 192.168.1.255
Typical hosts: 192.168.1.1–192.168.1.254
Typical IPv4 Subnet Sizes
| Prefix | Subnet mask | Total addresses | Typical usable hosts |
|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
For ordinary IPv4 broadcast subnets:
total addresses = 2^(32 − prefix).
Usually subtract two for network and broadcast addresses.
/31 point-to-point networks and /32 routes are exceptions.
How many typical usable hosts are in a /26?
There are 64 total addresses and normally 62 usable host addresses.
10. Ports and Protocols
TCP and UDP ports identify transport endpoints. A protocol defines rules for communication. Port numbers are conventions, not proof of the service running.
| Protocol | Common port | Purpose |
|---|---|---|
| FTP | TCP 21 | Control connection for file transfer. |
| SSH | TCP 22 | Encrypted remote access. |
| Telnet | TCP 23 | Unencrypted remote terminal. |
| SMTP | TCP 25 | Mail transfer between servers. |
| DNS | UDP/TCP 53 | Name resolution. |
| DHCPv4 | UDP 67/68 | Automatic network configuration. |
| HTTP | TCP 80 | Web communication. |
| HTTPS | TCP 443; UDP 443 for HTTP/3 | Protected web communication. |
| SMB | TCP 445 | File sharing and related services. |
| RDP | TCP/UDP 3389 | Remote desktop. |
11. How the Internet Works
- You enter a website address in your browser.
- DNS resolves the hostname to address information, unless cached.
- Your device sends traffic through its local network and gateway.
- Routers forward packets through interconnected networks.
- The browser establishes the required transport and TLS connections.
- The server receives an HTTP request and sends a response.
- The browser processes the response and renders the page.
This is simplified. Caches, CDNs, proxies and existing connections can change the exact sequence.
12. DNS — Domain Name System
DNS resolves names to records. A records contain IPv4 addresses; AAAA records contain IPv6 addresses.
If needed, the resolver follows referrals through root and top-level-domain servers to find the authoritative server.
nslookup example.com
13. DHCP — Automatic Network Configuration
DHCPv4 can provide an IP address, subnet mask, default gateway and DNS server settings for a lease period.
- Discover: The client looks for DHCP servers.
- Offer: A server offers configuration.
- Request: The client requests the selected offer.
- Acknowledge: The server confirms the lease.
14. ARP — Address Resolution Protocol
ARP finds the link-layer address for an IPv4 next hop on the local network. It does not resolve a remote server's MAC across the Internet.
Windows: arp -a
Linux: ip neigh
15. TCP Three-Way Handshake
TCP establishes a connection and synchronizes initial sequence information before normal data exchange.
16. TCP vs UDP
| Feature | TCP | UDP |
|---|---|---|
| Communication | Connection-oriented byte stream | Datagrams without a TCP-style handshake |
| Delivery | Retransmission and ordered delivery | No built-in retransmission or ordering |
| Control | Flow and congestion control | Applications must handle required controls |
| Examples | SSH, HTTPS over TCP | DNS queries, QUIC, many media applications |
UDP is not always “faster.” Performance depends on the application, network and protocols built above it. QUIC provides reliable streams over UDP.
17. HTTP vs HTTPS
HTTP defines web requests and responses. HTTPS protects HTTP communication using TLS.
HTTP
Plain HTTP does not encrypt its content. Someone able to observe the traffic may read or alter it.
HTTPS
TLS provides encryption, integrity protection and server authentication when certificates are properly validated.
18. NAT and PAT
NAT translates IP addresses. PAT, also called NAPT, translates addresses and transport identifiers such as ports so multiple devices can share a public IPv4 address.
Illustrative translations:
192.168.1.10:51000 → 203.0.113.10:61000
192.168.1.11:51000 → 203.0.113.10:61001
203.0.113.10 is a documentation address, not a suggested address to configure on your network.
19. Routing and Switching
Switching
Layer 2 switching forwards frames using MAC information within a broadcast domain, such as a VLAN.
Routing
Layer 3 routing forwards packets between IP networks using a routing table.
Useful Commands
Windows:
route print
Linux:
ip route
20. Firewalls
A firewall enforces rules that allow or block traffic. Rules can use addresses, ports, connection state or application information.
Packet Filtering
Evaluates fields such as IP addresses, protocols and ports.
Stateful Filtering
Tracks connection state when evaluating traffic.
Application Filtering
Uses application-level information to apply security rules.
Host Firewall
Runs on a computer or server and controls its network traffic.
Conceptual rules, not product-specific commands:
ALLOW TCP 443 to the web server
DENY TCP 23 from untrusted networks
21. VPN — Virtual Private Network
A VPN creates a logical tunnel between endpoints. Secure remote-access VPNs encrypt traffic through that tunnel.
- Remote employees accessing company systems.
- Connecting office networks.
- Protecting selected traffic over untrusted local networks.
Examples include WireGuard, OpenVPN and IPsec-based VPNs.
Hands-On Networking Labs
Use your own computer or an authorized practice environment. Actual outputs will vary.
Lab 1 — Find Your Network Settings
Windows:
ipconfig /all
Linux:
ip addr
ip route
Find your IP address, prefix or mask, gateway and interface name.
Lab 2 — Test Connectivity
ping 1.1.1.1
A failed ping does not always mean a host is offline. ICMP may be filtered.
Lab 3 — Check DNS
nslookup example.com
Identify the resolver and returned addresses.
Lab 4 — Inspect Local Neighbors
Windows:
arp -a
Linux:
ip neigh
Look for your gateway's local-link address.
Lab 5 — View Connections
Windows:
netstat -ano
Linux:
ss -tunap
Identify local addresses, ports and connection state. Some process details require elevated privileges.
Lab 6 — Trace a Route
Windows:
tracert example.com
Linux:
traceroute example.com
Observe responding hops. Missing responses do not necessarily mean the route is broken.
Lab 7 — Wireshark Practice
- Capture traffic from your own device or open a sample capture.
- Use
dnsto inspect ordinary DNS traffic. - Use
tcp.flags.syn == 1to find SYN packets. - Use
tcp.flags.syn == 1 && tcp.flags.ack == 0to focus on initial SYN packets. - Compare IP addresses, ports, sequence numbers and flags.
Encrypted DNS may not appear under the ordinary DNS filter.
Lab 8 — Build a Small LAN
- In a network simulator, add two PCs and one switch.
- Connect both PCs to the switch.
- Set PC1 to
192.168.1.10/24. - Set PC2 to
192.168.1.11/24. - Ping between them and observe ARP followed by ICMP.
Practice Questions
Try answering before opening the solutions.
1. What is the difference between LAN and WAN?
A LAN covers a limited local area. A WAN connects networks over larger distances.
2. Why is a switch different from a hub?
A hub repeats signals to other ports. A switch learns MAC addresses and selectively forwards known unicast frames.
3. Which OSI layer handles routing?
Layer 3 — Network.
4. What does TCP provide that UDP does not provide by itself?
Reliable, ordered byte delivery, retransmission, flow control and congestion control.
5. What is the subnet mask for /24?
255.255.255.0
6. How many typical usable hosts fit in /27?
32 total addresses, normally 30 usable host addresses.
7. What does DNS resolve?
Names to DNS records, including IPv4 addresses through A records and IPv6 addresses through AAAA records.
8. What is DHCP DORA?
Discover, Offer, Request, Acknowledge.
9. Why does your laptop use ARP for its gateway?
It needs the gateway's local-link address to send an IPv4 packet to that next hop over Ethernet.
10. What is the TCP handshake order?
SYN, SYN-ACK, ACK.
11. Does HTTPS prove that a website is safe?
No. It protects communication when properly validated, but the website can still be malicious or vulnerable.
12. What does PAT allow?
Multiple private devices can share a public IPv4 address using translated ports to distinguish connections.
13. Does a VPN guarantee anonymity?
No. Accounts, cookies, device information and other methods can still identify you.
14. You can reach an IP but a hostname fails. What should you investigate?
Check DNS resolution first. It is one possible cause, though other application or network issues may also exist.
15. Does a port number prove which application is running?
No. Services can use nonstandard ports, and different services can be configured on familiar ports.