OSI & TCP/IP models
Models split networking into layers so each layer has one job. The OSI model (7 layers) is used for teaching and troubleshooting; the TCP/IP model (4 layers) is what the internet actually runs on.
TCP/IP mapping: Application (L5–7) · Transport (L4) · Internet (L3) · Network Interface (L1–2). Mnemonic for OSI bottom-up: Please Do Not Throw Sausage Pizza Away.
TCP vs UDP
| TCP | UDP | |
|---|---|---|
| Connection | Connection-oriented (3-way handshake: SYN → SYN-ACK → ACK) | Connectionless |
| Reliability | Ordered, acknowledged, retransmits | Best effort, no guarantees |
| Used by | HTTP/S, SSH, SMTP, RDP | DNS queries, DHCP, VoIP, streaming, SNMP |
Ports to know by heart
| Port | Service | Port | Service |
|---|---|---|---|
20/21 | FTP | 389 / 636 | LDAP / LDAPS |
22 | SSH / SFTP | 443 | HTTPS |
23 | Telnet (avoid) | 445 | SMB |
25 | SMTP | 500 / 4500 | IPsec IKE / NAT-T |
53 | DNS | 3389 | RDP |
67/68 | DHCP | 161/162 | SNMP |
80 | HTTP | 88 | Kerberos |
Network types: PAN to WAN
Networks are classified by how far they reach.
IPv4 addressing & subnetting
An IPv4 address is 32 bits written as four octets (192.168.10.37). The prefix length (/24) says how many bits belong to the network; the rest identify hosts.
10.0.0.0/8 · 172.16.0.0/12 · 192.168.0.0/16127.0.0.0/8 loopback · 169.254.0.0/16 APIPA (no DHCP reply)Quick subnet table
| Prefix | Mask | Addresses | 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 |
/29 | 255.255.255.248 | 8 | 6 |
/30 | 255.255.255.252 | 4 | 2 (point-to-point links) |
Formula: usable hosts = 2(32 − prefix) − 2. The first address is the network ID, the last is broadcast.
Subnet calculator
VLANs & trunking
A VLAN splits one physical switch into separate logical networks (broadcast domains). It improves security and reduces broadcast traffic. Devices in different VLANs need a router or Layer-3 switch to talk to each other.
Cisco example
! Create VLANs
vlan 10
name USERS
vlan 20
name SERVERS
! Access port for a PC
interface GigabitEthernet0/5
switchport mode access
switchport access vlan 10
spanning-tree portfast
! Trunk to another switch / firewall
interface GigabitEthernet0/24
switchport mode trunk
switchport trunk allowed vlan 10,20,99
switchport trunk native vlan 99
! Verify
show vlan brief
show interfaces trunk
Two VLANs can't talk? Check IP/subnet → port VLAN assignment → trunk allowed VLANs → default gateway → inter-VLAN routing → firewall/ACL rules → logs.
VPN types
A VPN creates an encrypted tunnel over an untrusted network such as the internet.
| Type | What it does | Typical use |
|---|---|---|
| Site-to-site | Permanently links two networks | Branch office ↔ headquarters (IPsec) |
| Remote access | Connects one user to a private network | Work from home |
| IPsec | Encrypts IP traffic at Layer 3 (IKE on UDP 500/4500) | Site-to-site tunnels, firewalls |
| SSL / TLS | Runs over HTTPS (443), works through most firewalls | Remote users, browser portals |
| Client-based | Needs an installed client (e.g. Sophos Connect, AnyConnect) | Managed corporate laptops |
| Cloud VPN | Connects on-prem networks to a cloud VPC | Hybrid cloud |
DHCP & DNS
DHCP — automatic IP configuration
The client broadcasts a Discover, the server Offers an address, the client Requests it and the server Acknowledges. Across VLANs you need a DHCP relay (ip helper-address).
DNS — names to IP addresses
| Record | Purpose |
|---|---|
A / AAAA | Hostname → IPv4 / IPv6 |
CNAME | Alias to another hostname |
MX | Mail server for a domain |
PTR | Reverse lookup (IP → name) |
SRV | Locates services, e.g. Active Directory Domain Controllers |
TXT | Verification, SPF, DKIM, DMARC |
Troubleshooting commands
# Windows
ipconfig /all
ipconfig /release && ipconfig /renew
ipconfig /flushdns
nslookup example.com
# Linux
ip addr
dig example.com +short
resolvectl status
cat /etc/resolv.conf
Rule of thumb: if ping 8.8.8.8 works but ping google.com fails, it's DNS. An address of 169.254.x.x means DHCP failed.
What happens when you type a URL
One simple action that touches every layer of the stack — a great way to tie everything together.
- DNS resolution. Browser cache → OS cache → router → ISP resolver → root → TLD (
.com) → authoritative server returns the IP. - TCP connection. 3-way handshake: SYN, SYN-ACK, ACK to port 443.
- TLS handshake. Server presents its certificate; client checks validity, CA and domain name; session keys are agreed.
- HTTP request.
GET /with headers and cookies. - Server response. Status code (1xx info, 2xx success, 3xx redirect, 4xx client error, 5xx server error) plus HTML.
- Rendering. HTML → DOM, CSS → CSSOM, render tree → layout → paint; JavaScript runs.
Troubleshooting method
Work bottom-up through the layers and change one thing at a time. Always find out first whether one user or many are affected.
- Physical. Cable, link lights, port status (
show interfaces status). - IP configuration. Correct IP, mask, gateway and DNS (
ipconfig /all). - Gateway.
pingthe default gateway. - External IP.
ping 8.8.8.8, thentracert/tracerouteto see where it stops. - DNS.
nslookupa known domain. - Firewall. Review policies, NAT, web filtering and traffic logs.
- Fix & verify. Apply an approved change, confirm with the user, document the cause.
# Useful Cisco show commands
show ip interface brief
show interfaces status
show mac address-table
show ip route
show running-config
show logging
Infographics
Click to open full-size. Use ← → to browse, click the image to zoom.
Documents
PDFs open in a new tab. A tick appears on the ones you've opened.