# TCP IP
TCP/IP (Transmission Control Protocol/Internet Protocol) is the fundamental communication protocol suite that powers the [[Internet]]. Developed by [[Vint Cerf]] and [[Bob Kahn]] in the 1970s, it provides the rules for how data is packaged, addressed, transmitted, routed, and received across networks. The "IP" part handles addressing and routing packets to their destination; the "TCP" part ensures reliable, ordered delivery by managing connections and retransmitting lost packets. Together, they enable any computer to communicate with any other computer on the Internet, regardless of underlying hardware or network technology.
TCP/IP replaced ARPANET's original NCP (Network Control Protocol) on January 1, 1983—a date known as "flag day." The protocol suite embodies key design principles: packet switching (data split into independent packets), layered architecture (each layer handles specific functions), and end-to-end design (intelligence at endpoints, network kept simple). These principles enabled the Internet to scale from four nodes in 1969 to billions of devices today. TCP/IP is not a single protocol but a family including UDP (faster but unreliable), ICMP (diagnostics), and many others built on the IP foundation.
## TCP/IP Model
```
┌─────────────────────────────────────────────────────────────┐
│ TCP/IP PROTOCOL STACK │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ APPLICATION LAYER │ │
│ │ HTTP, HTTPS, FTP, SMTP, DNS, SSH, Telnet │ │
│ │ (What applications use to communicate) │ │
│ └─────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ TRANSPORT LAYER │ │
│ │ TCP (reliable, ordered) │ UDP (fast, unreliable) │ │
│ │ (End-to-end communication) │ │
│ └─────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ INTERNET LAYER │ │
│ │ IP (addressing, routing), ICMP, ARP │ │
│ │ (Packet delivery across networks) │ │
│ └─────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ NETWORK ACCESS LAYER │ │
│ │ Ethernet, Wi-Fi, Fiber, DSL │ │
│ │ (Physical transmission) │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
```
## TCP vs UDP
| Aspect | TCP | UDP |
|--------|-----|-----|
| **Connection** | Connection-oriented | Connectionless |
| **Reliability** | Guaranteed delivery | Best effort |
| **Ordering** | Packets arrive in order | No ordering guarantee |
| **Speed** | Slower (overhead) | Faster (minimal overhead) |
| **Use cases** | Web, email, file transfer | Streaming, gaming, DNS |
| **Header size** | 20+ bytes | 8 bytes |
## Key Protocols
| Protocol | Layer | Purpose |
|----------|-------|---------|
| **IP** | Internet | Addressing and routing |
| **TCP** | Transport | Reliable, ordered delivery |
| **UDP** | Transport | Fast, connectionless delivery |
| **ICMP** | Internet | Error messages, diagnostics (ping) |
| **ARP** | Network Access | IP to MAC address resolution |
| **DNS** | Application | Domain name resolution |
| **HTTP/HTTPS** | Application | Web content transfer |
| **SMTP** | Application | Email sending |
## IP Addressing
| Version | Format | Example | Addresses |
|---------|--------|---------|-----------|
| **IPv4** | 32-bit, dotted decimal | `192.168.1.1` | ~4.3 billion |
| **IPv6** | 128-bit, hexadecimal | `2001:db8::1` | 340 undecillion |
## How TCP Works
```
┌─────────────────────────────────────────────────────────────┐
│ TCP THREE-WAY HANDSHAKE │
├─────────────────────────────────────────────────────────────┤
│ │
│ CLIENT SERVER │
│ │ │ │
│ │─────────── SYN ─────────────────▶│ │
│ │ (synchronize) │ │
│ │ │ │
│ │◀────────── SYN-ACK ──────────────│ │
│ │ (synchronize-acknowledge) │ │
│ │ │ │
│ │─────────── ACK ─────────────────▶│ │
│ │ (acknowledge) │ │
│ │ │ │
│ │◀═══════ DATA TRANSFER ══════════▶│ │
│ │ │ │
│ │
│ Connection established → Data flows → Connection closed │
│ │
└─────────────────────────────────────────────────────────────┘
```
## TCP Features
| Feature | Description |
|---------|-------------|
| **Sequencing** | Packets numbered for reassembly |
| **Acknowledgment** | Receiver confirms receipt |
| **Retransmission** | Lost packets resent |
| **Flow control** | Prevents overwhelming receiver |
| **Congestion control** | Adapts to network conditions |
| **Checksums** | Detects corrupted data |
## Timeline
| Year | Event |
|------|-------|
| 1969 | ARPANET launched with NCP |
| 1973 | Kahn begins internetworking research |
| 1974 | Cerf & Kahn publish TCP paper |
| 1978 | TCP split into TCP and IP |
| 1981 | IPv4 specification (RFC 791) |
| 1983 | ARPANET switches to TCP/IP ("flag day") |
| 1995 | IPv6 specification published |
| 2010s | IPv6 deployment accelerates |
## Design Principles
| Principle | Description |
|-----------|-------------|
| **Packet switching** | Data split into independent packets |
| **Layered architecture** | Each layer handles specific functions |
| **End-to-end** | Reliability at endpoints, not network |
| **Best effort** | Network doesn't guarantee delivery |
| **Stateless routing** | Routers don't track connections |
| **Decentralization** | No central control point |
## TCP/IP vs OSI Model
| TCP/IP Layer | OSI Layers | Function |
|--------------|------------|----------|
| Application | Application, Presentation, Session | User-facing protocols |
| Transport | Transport | End-to-end communication |
| Internet | Network | Routing and addressing |
| Network Access | Data Link, Physical | Physical transmission |
## Common Port Numbers
| Port | Protocol | Service |
|------|----------|---------|
| 20, 21 | TCP | FTP |
| 22 | TCP | SSH |
| 25 | TCP | SMTP |
| 53 | TCP/UDP | DNS |
| 80 | TCP | HTTP |
| 443 | TCP | HTTPS |
## References
- Cerf, V. & Kahn, R. (1974). "A Protocol for Packet Network Intercommunication"
- RFC 791 (IP), RFC 793 (TCP)
- https://en.wikipedia.org/wiki/Internet_protocol_suite
## Related
- [[Internet]]
- [[Vint Cerf]]
- [[Bob Kahn]]
- [[ARPANET]]
- [[Hypertext Transfer Protocol (HTTP)]]
- [[DNS]]