BUILD YOUR FOUNDATIONS / NETWORKING

Complete Computer Networking Course

Learn networking through simple explanations, device images, diagrams, real-life examples and practical commands. Start with the basics and build your understanding step by step.

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.

Example: Your phone and laptop connect to home Wi-Fi. They use the network to reach the Internet and may also communicate with local devices.

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

Switch Laptop Computer Server

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.

These categories describe scope. They do not have universal, fixed distance limits.

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.

PC 1 PC 2 PC 3 PC 4 Shared backbone

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.

Switch PC 1 PC 2 PC 3 PC 4

Ring Topology

Each device connects to two neighbors, forming a loop. Fault tolerance depends on the ring technology and available backup paths.

PC 1 PC 2 PC 3 PC 4

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.

A B C D

Tree Topology

A hierarchy connects a main device to smaller branches. Example: a main office switch connected to switches on different floors.

Main switch Switch A Switch B PC PC PC PC

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.

Important: OSI is a model, not an exact blueprint for every application. Real protocols can combine functions associated with several layers.

Sending: Layer 7 down to Layer 1. Receiving: Layer 1 up to Layer 7.

7

Application

Provides network services used by applications. Examples include HTTP, DNS and SMTP.

Real-life example: Your browser uses HTTP to request a webpage. The browser itself is not the entire layer.
6

Presentation

Describes data representation, encoding, compression and encryption functions.

Real-life example: Text can use UTF-8 encoding. TLS encrypts web traffic. TLS is often associated with presentation functions when teaching OSI, but does not fit perfectly into one layer.
5

Session

Describes establishing, managing and ending conversations between applications.

Real-life example: Starting, maintaining and ending a video conversation illustrates session-related functions. Real software may spread these jobs across protocols.

A website login session or cookie is an application-level mechanism, not automatically OSI Layer 5.

4

Transport

Supports application-to-application communication using ports. TCP provides reliable, ordered byte delivery; UDP provides datagrams without built-in delivery guarantees.

Real-life example: During a TCP file download, missing data can be retransmitted. Ports help identify application endpoints.
3

Network

Handles logical addressing and forwarding packets between networks. IP operates here.

Real-life example: Your router uses the destination IP and its routing table to choose a next hop toward a website.
2

Data Link

Handles frames on a local link. Ethernet uses MAC addresses and an FCS to detect frame corruption.

Real-life example: An office switch forwards a known unicast frame toward the appropriate port. For a remote website, your local frame normally targets your gateway's MAC, not the website server's MAC.
1

Physical

Transmits bits using electrical, optical or radio signals through physical media.

Real-life example: Ethernet cables carry electrical signals, fiber carries light and Wi-Fi uses radio. A damaged cable is a physical-layer troubleshooting example.

Example: Opening an HTTPS Website

Assume DNS resolution is complete and the connection uses HTTPS over TCP. HTTP/3 uses QUIC instead.

  1. Application: The browser creates an HTTP request.
  2. Presentation-related functions: TLS encrypts its content.
  3. Session-related functions: Applications and protocols manage the conversation; this need not be a separate implementation step.
  4. Transport: TCP carries encrypted bytes in segments, normally toward server port 443.
  5. Network: IP addressing and routers guide packets toward the server.
  6. Data Link: Frames carry packets across each local link.
  7. Physical: Bits travel as signals.

Encapsulation and Decapsulation

Encapsulation adds protocol information around data. For TCP over IP over Ethernet:

Data
TCP segment
IP packet
Ethernet frame
Signals

The receiver processes this information in reverse. This is decapsulation. TLS decrypts the content before the web server reads the HTTP request.

Routers process incoming frames and build new frames for the next link. One Ethernet frame does not travel unchanged across the entire Internet.

OSI Troubleshooting Examples

ProblemStarting pointCheck
No Ethernet linkLayer 1Cable, power and port.
Wrong VLANLayer 2Switch port configuration.
Wrong gatewayLayer 3IP settings and routing.
TCP connection failsLayer 4 and supporting layersService, ports, routes and firewall.
HTTP 404 responseLayer 7URL 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 modelApproximate OSI mappingExamples
ApplicationLayers 5–7HTTP, DNS, SMTP
TransportLayer 4TCP, UDP
InternetLayer 3IP, ICMP
LinkLayers 1–2Ethernet, Wi-Fi
Example: An HTTP request can travel inside TCP, inside IP, inside an Ethernet frame.

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

Example: Your laptop may use 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.

IP: Used for network-layer addressing and routing.
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

PrefixSubnet maskTotal addressesTypical usable hosts
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614

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.

ProtocolCommon portPurpose
FTPTCP 21Control connection for file transfer.
SSHTCP 22Encrypted remote access.
TelnetTCP 23Unencrypted remote terminal.
SMTPTCP 25Mail transfer between servers.
DNSUDP/TCP 53Name resolution.
DHCPv4UDP 67/68Automatic network configuration.
HTTPTCP 80Web communication.
HTTPSTCP 443; UDP 443 for HTTP/3Protected web communication.
SMBTCP 445File sharing and related services.
RDPTCP/UDP 3389Remote desktop.

11. How the Internet Works

  1. You enter a website address in your browser.
  2. DNS resolves the hostname to address information, unless cached.
  3. Your device sends traffic through its local network and gateway.
  4. Routers forward packets through interconnected networks.
  5. The browser establishes the required transport and TLS connections.
  6. The server receives an HTTP request and sends a response.
  7. The browser processes the response and renders the page.
Your browser
Home gateway
Internet networks
Web server

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.

Browser / OS cache
Recursive resolver
Authoritative DNS

If needed, the resolver follows referrals through root and top-level-domain servers to find the authoritative server.

nslookup example.com
Example: DNS helps your device find an address for a website without you remembering the numeric IP.
Security: DNS spoofing or cache poisoning can misdirect name resolution. DNSSEC provides authenticity checking for signed DNS data; it does not encrypt queries.

13. DHCP — Automatic Network Configuration

DHCPv4 can provide an IP address, subnet mask, default gateway and DNS server settings for a lease period.

Discover
Offer
Request
Acknowledge
Example: Your laptop joins home Wi-Fi and automatically receives its network settings.

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.

Who has 192.168.1.1?
Local broadcast request
Gateway replies with its MAC
Windows: arp -a
Linux:   ip neigh
Security: ARP has no built-in authentication. ARP spoofing can corrupt local IP-to-MAC mappings. IPv6 uses Neighbor Discovery instead of ARP.

15. TCP Three-Way Handshake

TCP establishes a connection and synchronizes initial sequence information before normal data exchange.

Client Server 1. SYN 2. SYN-ACK 3. ACK
Security: A SYN flood attempts to exhaust connection-handling resources. SYN cookies and other controls can reduce its impact.

16. TCP vs UDP

FeatureTCPUDP
CommunicationConnection-oriented byte streamDatagrams without a TCP-style handshake
DeliveryRetransmission and ordered deliveryNo built-in retransmission or ordering
ControlFlow and congestion controlApplications must handle required controls
ExamplesSSH, HTTPS over TCPDNS 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.

Example: A password submitted over HTTPS is encrypted in transit. HTTPS does not guarantee that the website itself is trustworthy or free from vulnerabilities.

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.

NAT is not a substitute for firewall policy. Translation and traffic filtering are different functions.

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.

Example: Traffic to another host on your local subnet normally stays local. Traffic to a remote network normally goes to your default gateway.

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.

Your device
Encrypted tunnel
VPN server
Destination

Examples include WireGuard, OpenVPN and IPsec-based VPNs.

A VPN does not guarantee anonymity. Accounts, cookies and other tracking can identify you. Split tunneling can leave some traffic outside the VPN.

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

  1. Capture traffic from your own device or open a sample capture.
  2. Use dns to inspect ordinary DNS traffic.
  3. Use tcp.flags.syn == 1 to find SYN packets.
  4. Use tcp.flags.syn == 1 && tcp.flags.ack == 0 to focus on initial SYN packets.
  5. Compare IP addresses, ports, sequence numbers and flags.

Encrypted DNS may not appear under the ordinary DNS filter.

Lab 8 — Build a Small LAN

  1. In a network simulator, add two PCs and one switch.
  2. Connect both PCs to the switch.
  3. Set PC1 to 192.168.1.10/24.
  4. Set PC2 to 192.168.1.11/24.
  5. 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.

References and Further Learning