Introduction to Networking
Networking is one of the most important foundations of cybersecurity. In this tutorial, you'll learn how devices connect, communicate, and share data using simple explanations and diagrams.
1. What Is Networking?
A computer network is a group of connected devices that communicate and share resources.
These devices can include computers, smartphones, printers, routers, switches, and servers.
Example: When your phone and laptop connect to the same Wi-Fi router, they become part of a local network.
2. Types of Networks
PAN — Personal Area Network
A small network around one person. Example: Bluetooth communication between a smartphone and wireless earbuds.
LAN — Local Area Network
Connects devices in a limited area such as a home, office, school, or building.
MAN — Metropolitan Area Network
Connects networks across a city or metropolitan area.
WAN — Wide Area Network
Connects networks across large geographical distances. The internet is the largest example of interconnected networks.
3. Network Topologies
Network topology describes how devices and connections are arranged in a network.
Star Topology
All devices connect to a central switch or hub. This is common in modern LANs.
Bus Topology
Devices share a single backbone cable. A failure in the backbone can interrupt communication.
Ring Topology
Devices are connected in a circular path. Data moves around the ring according to the network's design.
Mesh Topology
Devices have multiple connections to other devices, providing alternative paths for communication.
4. Common Networking Devices
Router
Connects different networks and forwards packets based on IP addresses.
Switch
Connects devices inside a LAN and normally forwards Ethernet frames using MAC addresses.
Hub
A basic Layer 1 device that repeats incoming signals to all other connected ports.
Modem
Converts signals between formats required by your ISP connection and local equipment.
Wireless Access Point
Allows wireless devices to connect to a local network using Wi-Fi.
5. OSI Model — Seven Layers
The OSI model helps us understand how communication works by dividing networking into seven layers.
| Layer | Name | Purpose |
|---|---|---|
| 7 | Application | Provides network services to applications. |
| 6 | Presentation | Handles data formatting, encoding, and encryption. |
| 5 | Session | Manages communication sessions. |
| 4 | Transport | Handles end-to-end transport using protocols such as TCP and UDP. |
| 3 | Network | Handles IP addressing and routing. |
| 2 | Data Link | Handles frames and local network delivery. |
| 1 | Physical | Transmits bits as electrical, optical, or radio signals. |
6. TCP/IP Model
TCP/IP is the protocol suite used by the internet. A common teaching model uses four layers, while some courses separate the lowest layer into Data Link and Physical to show five layers.
| Layer | Examples |
|---|---|
| Application | HTTP, HTTPS, DNS, SSH |
| Transport | TCP, UDP |
| Internet / Network | IPv4, IPv6, ICMP |
| Network Access | Ethernet, Wi-Fi |
7. IP Addresses & Subnetting
An IP address identifies a network interface and helps routers deliver packets to the correct destination.
IPv4
IPv4 uses 32-bit addresses.
Example: 192.168.1.10
IPv6
IPv6 uses 128-bit addresses.
Example: 2001:db8::1
Private and Public IP Addresses
Private IPv4 addresses are commonly used inside home and office networks. Public IP addresses can be used for communication across the public internet.
Subnet Mask and CIDR
A subnet mask separates the network portion
from the host portion of an IPv4 address.
CIDR expresses the prefix length using
a slash, such as /24.
IP Address: 192.168.1.10
Subnet Mask: 255.255.255.0
CIDR: /24
Network: 192.168.1.0
Broadcast: 192.168.1.255
Usable hosts:
192.168.1.1 - 192.168.1.254
MAC Address
A MAC address is a link-layer identifier used by technologies such as Ethernet for communication on a local network.
8. Ports & Protocols
A port number helps identify a service or application using TCP or UDP.
| Protocol | Common Port | Purpose |
|---|---|---|
| HTTP | 80 | Web communication |
| HTTPS | 443 | Encrypted web communication |
| DNS | 53 | Domain name resolution |
| SSH | 22 | Secure remote access |
| FTP | 21 | File transfer control |
| SMTP | 25 | Email transfer |
TCP vs UDP
TCP: Connection-oriented and provides reliable, ordered delivery of data.
UDP: Connectionless and has less protocol overhead, but does not guarantee delivery or order.
9. DNS, DHCP & ARP
DNS — Domain Name System
DNS helps convert domain names such as google.com into IP addresses.
Security example: DNS spoofing can redirect users toward an incorrect destination.
DHCP — Dynamic Host Configuration Protocol
DHCP automatically assigns network settings, including an IP address, to devices.
A common DHCP exchange is called DORA: Discover, Offer, Request, Acknowledge.
ARP — Address Resolution Protocol
ARP helps an IPv4 device discover the MAC address associated with another local IPv4 address.
Security example: ARP spoofing can allow an attacker on a local network to redirect traffic.
10. TCP Three-Way Handshake
Before sending application data over a new TCP connection, the client and server establish the connection using three steps.
Client Server
| |
| ------ SYN --------> |
| |
| <--- SYN-ACK ------- |
| |
| ------ ACK --------> |
| |
| Connection ready |
| |
SYN: The client requests a connection. SYN-ACK: The server responds. ACK: The client confirms.
11. Practice Questions
Test yourself before opening each answer.
Q1. What is the difference between a switch and a router?
A switch usually connects devices within a local network. A router connects different networks and forwards IP packets.
Q2. Which OSI layer handles IP routing?
Layer 3 — the Network layer.
Q3. What does DNS do?
DNS translates domain names into information such as IP addresses.
Q4. What is the difference between TCP and UDP?
TCP provides reliable, ordered data delivery. UDP sends datagrams without those built-in guarantees.
Q5. What does /24 mean in IPv4?
It means the first 24 bits are the network prefix.
Q6. What are the three steps of the TCP handshake?
SYN → SYN-ACK → ACK.