# How the Internet Works: TCP/IP and the OSI Model

> Understand layers, IP addressing, subnets, routing, and the difference between TCP and UDP well enough to reason about any connection problem. Free notes, key...

Canonical: https://www.internhack.in/roadmaps/tracks/devops/internet-tcpip
Last updated: 2026-11-28

Understand layers, IP addressing, subnets, routing, and the difference between TCP and UDP well enough to reason about any connection problem.

Beginner · about 10 hours · difficulty 2/5

Learn first: [Linux Command Line and Packages](https://www.internhack.in/roadmaps/tracks/devops/linux-basics)

Networking knowledge separates engineers who guess from those who diagnose. You do not need to be a network engineer, but you must be able to follow a packet from a client to your service.

### Layers as a mental model

The **OSI model** (7 layers) and the simpler **TCP/IP model** (link, internet, transport, application) are ways to locate a problem. "Can I resolve the name?" (application/DNS), "Can I reach the IP?" (internet), "Is the port open?" (transport), "Is the app answering correctly?" (application).

### Addressing and routing

- **IPv4** addresses and **CIDR** notation: `10.0.0.0/16` holds 65,536 addresses; `/24` holds 256. You will size VPCs and subnets with this.
- **Private ranges** (10/8, 172.16/12, 192.168/16) and **NAT** to reach the internet.
- Default gateway, route tables, and **IPv6** basics.
- **ARP** maps IPs to MAC addresses on a local network.

### Transport

- **TCP**: connection-oriented, three-way handshake, ordered and retransmitted. Most web traffic.
- **UDP**: connectionless and lightweight: DNS, video, QUIC (HTTP/3).
- **Ports** identify services; ephemeral ports are used by clients.

### Tools

`ip addr`, `ip route`, `ping`, `traceroute`/`mtr`, `ss -tulpn`, `nc -zv host port`, `curl -v`, and `tcpdump` when you need to see raw packets.

**Good enough to move on:** you can split a /16 into subnets, explain the TCP handshake, and systematically answer "why can't service A reach service B?"

## Key concepts

- **OSI and TCP/IP models**
- **IPv4, CIDR and subnetting**
- **Private ranges and NAT**
- **Routing and gateways**
- **TCP vs UDP**
- **Ports and sockets**
- **IPv6 basics**
- **ping, mtr, ss, nc, tcpdump**

## Mini project

Design the address plan for a VPC with public, private and database subnets across 3 availability zones on paper, then verify your math with ipcalc and document it as a table.

## Check yourself

nc -zv to a port returns 'connection refused' on one host and times out on another. What does each tell you?

## Free resources

- [Cloudflare Learning Center](https://www.cloudflare.com/learning/) (Cloudflare)
- [What is the OSI model?](https://www.cloudflare.com/learning/ddos/glossary/open-systems-interconnection-model-osi/) (Cloudflare)

Previous: [Editors and Terminal Productivity](https://www.internhack.in/roadmaps/tracks/devops/editors-terminal) · Next: [DNS in Practice](https://www.internhack.in/roadmaps/tracks/devops/dns)

## More in Networking You Will Actually Debug

- [How the Internet Works: TCP/IP and the OSI Model](https://www.internhack.in/roadmaps/tracks/devops/internet-tcpip)
- [DNS in Practice](https://www.internhack.in/roadmaps/tracks/devops/dns)
- [HTTP and HTTPS](https://www.internhack.in/roadmaps/tracks/devops/http-https)
- [TLS and Certificates](https://www.internhack.in/roadmaps/tracks/devops/tls-certificates)
- [Load Balancing and Proxies](https://www.internhack.in/roadmaps/tracks/devops/load-balancing-proxies)
- [Firewalls, Security Groups and NAT](https://www.internhack.in/roadmaps/tracks/devops/firewalls-nat)
- [SSH, Bastions and VPNs](https://www.internhack.in/roadmaps/tracks/devops/ssh-vpn)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [DevOps Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/devops)
