TCP/IP Protocol Suite
The TCP/IP model is the foundation of modern networking, defining how data is transmitted across networks.
The Four Layers
Application Layer
- HTTP, HTTPS, FTP, SSH, DNS, SMTP
- User-facing protocols
- Data formatting and presentation
Transport Layer
- TCP - Reliable, connection-oriented
- UDP - Fast, connectionless
- Port numbers and segmentation
Internet Layer
- IP - Addressing and routing
- ICMP - Error reporting and diagnostics
- Packet fragmentation
Network Access Layer
- Ethernet, Wi-Fi
- MAC addressing
- Physical transmission
TCP vs UDP
| Feature | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented | Connectionless |
| Reliability | Guaranteed delivery | Best effort |
| Ordering | In-order delivery | No ordering |
| Speed | Slower | Faster |
| Use Cases | HTTP, SSH, FTP | DNS, Streaming, Gaming |
TCP Three-Way Handshake
Client Server
| |
|------- SYN ------>|
| |
|<--- SYN + ACK ----|
| |
|------- ACK ------>|
| |
| Connection |
| Established |IP Addressing
IPv4 Structure
- 32-bit address
- Dotted decimal notation (192.168.1.1)
- Network and host portions
IPv6 Structure
- 128-bit address
- Hexadecimal notation (2001:db8::1)
- Built-in security features
Common Ports
Port Protocol Service
20-21 TCP FTP
22 TCP SSH
23 TCP Telnet
25 TCP SMTP
53 TCP/UDP DNS
80 TCP HTTP
443 TCP HTTPS
3306 TCP MySQL
5432 TCP PostgreSQL
6379 TCP RedisPacket Flow Example
# Trace packet path
traceroute google.com
# Capture packets
tcpdump -i eth0 -n port 80
# Analyze with tshark
tshark -i eth0 -f "tcp port 443"Best Practices
- Understand layers - Know which protocol operates where
- Use TCP for reliability - When data integrity matters
- Use UDP for speed - Real-time applications
- Monitor traffic - Regular packet analysis
- Secure ports - Close unnecessary services
- tcp
- ip
- networking
- osi model
- protocol
- packets
- layers