How the Internet Works
ip 🌐 IP
IP-local or the one assigned when you connect to the internet is a unique address for each device. When you connect to a different network, the IP changes.
types Types:
-
🌍 Public IP
Assigned by your ISP (Internet Service Provider). This exposes you to the outside world and makes you reachable.
-
🏠 Private IP
Used in local networks such as LAN, home, office, etc.
-
📍 Static IP
Typically assigned to servers and set manually.
-
🔄 Dynamic IP
Assigned temporarily by a DHCP (Dynamic Host Configuration Protocol) server.
mac 💻 MAC
MAC Address (Media Access Control Address) — a physical address.
It is tied to the hardware and cannot be changed (under normal conditions).
dns 📞 DNS
It’s like a contacts list. It translates website names to IP addresses.
People use names rather than memorizing IP addresses when visiting websites.
📌 Example: google.com
IP → 142.250.190.14
protocols 📋 Protocols
A set of rules and standards that define how devices on the internet communicate, how data is sent, received, and interpreted.
The most famous ones: TCP/IP, OSI models
important-protocols Some important protocols:
-
🌐 HTTP / HTTPS (HyperText Transfer Protocol / Secure)
The fundamental protocol of the web. It provides the connection between Browser and Server (request, response).
-
🔒 TCP (Transmission Control Protocol)
A reliable, connection-oriented transport protocol.
Before sending data, it establishes a connection and then ensures it is complete, in order, and error-free.
Many protocols like HTTP, FTP, SMTP are built on top of TCP.
-
⚡ UDP (User Datagram Protocol)
Connectionless and fast, but less reliable transport protocol.
Data is sent without establishing a connection. There is no guarantee on delivery or order.
Used for video, audio streaming, and online games. (interview question!)
-
🔐 TLS / SSL (Transport Layer Security / Secure Sockets Layer)
This is the
S
in HTTPS. It’s added on top of TCP and encrypts communication and provides authentication. -
📁 FTP / SFTP (File Transfer Protocol / Secure File Transfer Protocol)
Used for file transfers.
-
✉️ SMTP / IMAP / POP3
Email protocols.
-
🔄 WebSocket
Enables real-time, two-way (full-duplex) communication.
real-case-example 📌 Real-case example
When you connect to a website (www.example.com
), this happens:
- 🔍 Your computer finds the IP address of the
www.example.com
domain via DNS. - 📤 The browser creates a request packet according to the HTTP or HTTPS protocol rules.
- 📦 This request is segmented by the TCP protocol.
- 📍 Each TCP segment is placed into an IP packet with the IP address.
- 💻 Your computer determines the router’s MAC address (via ARP) to send the packet to it, and sends it via Ethernet.
- 🌐 The packet is delivered from router to router across the internet based on the IP address.
- 📍 Once it reaches the local network where the target server resides, the router delivers the packet to the server based on the MAC address.
- ✅ The server processes the packet according to the IP, TCP, and HTTP protocols and sends the response back the same way.