Computer Networks Quick Reference
Everything you need day‑to‑day – protocols, addressing, routing, and more.
OSI Model (7 Layers)
Layer 7 – Application
- User interface, network applications
- HTTP, FTP, SMTP, DNS, Telnet, SSH
Layer 6 – Presentation
- Data formatting, encryption, compression
- SSL/TLS, JPEG, MPEG, ASCII
Layer 5 – Session
- Session management, dialog control
- NetBIOS, RPC, PPTP
Layer 4 – Transport
- End‑to‑end communication, flow control
- TCP, UDP, SCTP
Layer 3 – Network
- Routing, logical addressing
- IP, ICMP, ARP, RIP, OSPF, BGP
Layer 2 – Data Link
- Frame delivery, error detection
- Ethernet, PPP, MAC, VLAN
Layer 1 – Physical
- Bit transmission, electrical signals
- USB, Ethernet cables, fiber optics
OSI Mnemonic
- All People Seem To Need Data Processing
- Application → Presentation → Session → Transport → Network → Data Link → Physical
TCP/IP Model (4 Layers)
| TCP/IP Layer | OSI Equivalent | Protocols |
|---|---|---|
| Application | Application, Presentation, Session | HTTP, FTP, SMTP, DNS, DHCP, SSH |
| Transport | Transport | TCP, UDP |
| Internet | Network | IP, ICMP, ARP |
| Link | Data Link, Physical | Ethernet, Wi‑Fi, PPP |
IP Addressing
IPv4 Address Classes
| Class | Range | Default Mask | Purpose | Private Range |
|---|---|---|---|---|
| A | 0.0.0.0 – 127.255.255.255 | /8 (255.0.0.0) | Large networks | 10.0.0.0/8 |
| B | 128.0.0.0 – 191.255.255.255 | /16 (255.255.0.0) | Medium networks | 172.16.0.0/12 |
| C | 192.0.0.0 – 223.255.255.255 | /24 (255.255.255.0) | Small networks | 192.168.0.0/16 |
| D | 224.0.0.0 – 239.255.255.255 | – | Multicast | – |
| E | 240.0.0.0 – 255.255.255.255 | – | Experimental | – |
Special IPv4 Addresses
- 0.0.0.0 – default route, unknown address
- 127.0.0.1 – localhost (loopback)
- 255.255.255.255 – local broadcast
- 169.254.0.0/16 – APIPA (automatic private IP)
Subnetting
// Network address = IP & Subnet Mask // Broadcast address = Network | ~Subnet Mask // Usable hosts = 2^(32 - prefix) - 2 // Example: 192.168.1.0/24 Network: 192.168.1.0 Broadcast: 192.168.1.255 Usable hosts: 254 (192.168.1.1 – 192.168.1.254) // Common masks /8 = 255.0.0.0 (16,777,214 hosts) /16 = 255.255.0.0 (65,534 hosts) /24 = 255.255.255.0 (254 hosts) /28 = 255.255.255.240 (14 hosts) /30 = 255.255.255.252 (2 hosts) // point‑to‑point links /32 = 255.255.255.255 (1 host) // single host
IPv6
- 128‑bit addresses (vs 32‑bit IPv4)
- 8 groups of 4 hexadecimal digits
- Example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
- Abbreviation: leading zeros can be omitted, :: for consecutive zeros
- Loopback: ::1
- Unspecified: ::
Key Protocols
TCP (Transmission Control Protocol)
- Connection‑oriented – three‑way handshake
- Reliable – acknowledgements, retransmissions
- In‑order delivery – sequence numbers
- Flow control – sliding window, congestion control
- Ports – well‑known (0‑1023), registered (1024‑49151), dynamic (49152‑65535)
TCP 3‑Way Handshake
Client Server | | |--- SYN (seq=x) ------------> | | | |<- SYN-ACK (seq=y, ack=x+1) --| | | |--- ACK (ack=y+1) ----------> | | | | Connection Established |
UDP (User Datagram Protocol)
- Connectionless – no handshake
- Unreliable – no acknowledgements
- Out‑of‑order delivery possible
- Faster – less overhead
- Use cases: DNS, DHCP, VoIP, streaming, gaming
Port Numbers (Common)
- 20/21 – FTP
- 22 – SSH
- 23 – Telnet
- 25 – SMTP
- 53 – DNS
- 80 – HTTP
- 110 – POP3
- 143 – IMAP
- 443 – HTTPS
- 3389 – RDP
ICMP (Internet Control Message Protocol)
- Used for error reporting and diagnostics
- Type 0 – Echo Reply (ping response)
- Type 3 – Destination Unreachable
- Type 8 – Echo Request (ping)
- Type 11 – Time Exceeded (TTL expired)
ARP (Address Resolution Protocol)
- Maps IP addresses to MAC addresses
- ARP request – broadcast, ARP reply – unicast
- ARP cache – stores mappings
Routing Protocols
Distance Vector
- RIP – Routing Information Protocol
- Hop count metric (max 15)
- Periodic updates (every 30s)
- Slow convergence
- Count‑to‑infinity problem
- IGRP – Cisco proprietary
Link State
- OSPF – Open Shortest Path First
- Cost metric (bandwidth based)
- Dijkstra algorithm
- Fast convergence
- No count‑to‑infinity
- Areas for scalability
Path Vector
- BGP – Border Gateway Protocol
- Used between autonomous systems
- Path attributes for routing decisions
- Policy‑based routing
Comparison
- IGP – Interior (RIP, OSPF, EIGRP)
- EGP – Exterior (BGP)
- AS – Autonomous System
Switching
Switching Methods
- Circuit Switching – dedicated path (telephony)
- Packet Switching – store‑and‑forward
- Virtual Circuit – connection‑oriented packet
- Datagram – connectionless packet
Bridge vs Switch vs Router
- Bridge – Layer 2, connects networks
- Switch – Layer 2, multi‑port bridge
- Router – Layer 3, connects networks
- Hub – Layer 1, broadcast
Network Topologies
Common Topologies
- Bus – single cable, all share
- Star – central switch/hub
- Ring – circular path
- Mesh – fully connected
- Tree – hierarchical
- Hybrid – combination
Network Types by Size
- PAN – Personal Area Network (Bluetooth)
- LAN – Local Area Network (Ethernet, Wi‑Fi)
- MAN – Metropolitan Area Network
- WAN – Wide Area Network (Internet)
- WLAN – Wireless LAN
- VLAN – Virtual LAN
Error Detection & Correction
Error Detection
- Parity – simple, detects odd errors
- Checksum – sum of data, used in UDP/TCP
- CRC – Cyclic Redundancy Check
- Hamming Code – detection + correction
Error Correction
- Hamming Code – single‑bit correction
- Reed‑Solomon – burst errors
- ARQ – Automatic Repeat Request
- FEC – Forward Error Correction
Network Security
Encryption
- Symmetric – AES, DES, 3DES
- Asymmetric – RSA, ECC
- Key exchange – Diffie‑Hellman
- Hashing – MD5, SHA‑1, SHA‑256
Security Protocols
- SSL/TLS – secure HTTP (HTTPS)
- IPSec – VPN (AH, ESP)
- SSH – secure remote access
- PGP – email encryption
Firewalls
- Packet Filtering – IP/port based
- Stateful – tracks connections
- Proxy – application level
- WAF – web application firewall
Common Attacks
- DDoS – Distributed Denial of Service
- MITM – Man‑in‑the‑middle
- Phishing – credential theft
- SQL Injection – database attack
- XSS – Cross‑Site Scripting
Network Troubleshooting Tools
Command Line Tools
ping– test connectivitytracert / traceroute– path to destinationnslookup– DNS lookupdig– DNS query toolipconfig / ifconfig– IP confignetstat– network statisticstelnet– connect to portcurl– HTTP requests
Advanced Tools
- Wireshark – packet analysis
- Nmap – port scanning
- MTR – My TraceRoute (ping + traceroute)
- tcpdump – CLI packet capture
NAT & DHCP
NAT (Network Address Translation)
- Static NAT – one‑to‑one mapping
- Dynamic NAT – pool of IPs
- PAT (NAT overload) – multiple to one (ports)
- Benefits: conserve IPs, security
DHCP (Dynamic Host Configuration Protocol)
- DORA – Discover, Offer, Request, Acknowledge
- Leases IP address dynamically
- Provides: IP, subnet, gateway, DNS
- Renewal at 50% of lease
📌 Quick Reference
OSI layers: Application, Presentation, Session, Transport, Network, Data Link, Physical
TCP: Reliable, connection‑oriented, uses ports, 3‑way handshake
UDP: Unreliable, connectionless, faster, no handshake
IP classes: A (/8), B (/16), C (/24), D (multicast), E (experimental)
Routing: Distance Vector (RIP), Link State (OSPF), Path Vector (BGP)
TCP: Reliable, connection‑oriented, uses ports, 3‑way handshake
UDP: Unreliable, connectionless, faster, no handshake
IP classes: A (/8), B (/16), C (/24), D (multicast), E (experimental)
Routing: Distance Vector (RIP), Link State (OSPF), Path Vector (BGP)