TCP/IP Basics
TCP/IP protocol layers and networking fundamentals.
OSI vs TCP/IP Model
# OSI Model (7 layers)
7. Application # HTTP, FTP, SMTP
6. Presentation # encryption
5. Session # sessions
4. Transport # TCP, UDP
3. Network # IP, routing
2. Data Link # MAC, switches
1. Physical # cables
# TCP/IP Model (4 layers)
4. Application
3. Transport
2. Internet
1. Network Access
IP Addresses
# IPv4 format
192.168.1.1 # 32-bit address
# Private ranges
10.0.0.0 - 10.255.255.255 # Class A
172.16.0.0 - 172.31.255.255 # Class B
192.168.0.0 - 192.168.255.255 # Class C
# IPv6 format
2001:0db8:85a3::8a2e:0370:7334
TCP vs UDP
# TCP
Connection-oriented # reliable
Ordered delivery
Error checking
Slower
Use: HTTP, HTTPS, FTP
# UDP
Connectionless
No guaranteed delivery
Faster
Use: DNS, streaming, gaming
Common Ports
20/21 # FTP
22 # SSH
25 # SMTP
53 # DNS
80 # HTTP
443 # HTTPS
3306 # MySQL
5432 # PostgreSQL
27017 # MongoDB