IP & Networking
Before the cloud, you must understand how computers find each other.
What is an IP Address?
An IP Address (Internet Protocol) is like a home address for your digital device. It is a unique string of numbers that validates the device on a network.
IPv4
Old standard, but still most used.
Limit: ~4 billion addresses (Already exhausted!)
IPv6
The new standard.
Limit: 340 undecillion (Infinite for practical purposes)
Localhost vs Network IP
There are two very special numbers you need to know as a developer.
Localhost
"Home". This is a loopback address. It points only to your own machine. If you run a server here, only you can see it.
Private/LAN IP
Your address on your WiFi router. Other devices connected to the same WiFi can talk to you using this IP.
Concept: 'Mild Hosting'
Most students think they need AWS to show their project to a friend. You don't. You can do "Mild Hosting" on your local WiFi.
Steps to host on WiFi:
- Connect both your Laptop and Phone to the same WiFi.
- Find your Laptop's LAN IP (using
ipconfigorifconfig). Say it's192.168.1.45. - Run your app on your laptop:
npm run dev(Port 3000). - Important: Ensure your app listens on
0.0.0.0(All interfaces), not just localhost. - Open your Phone's browser and type:
http://192.168.1.45:3000.
Public vs Private IP Architecture
How can millions of devices exist if Private IPs (like 192.168.1.2) are repeated in every home?
The Router is the Gateway.
Network A (Local LAN)
Network B (Local LAN)
Communication Flow
Same Network (Inner)
My Laptop (192.168.1.5) → Mom's Phone (192.168.1.6)
- Communication happens locally via the Router (Switch).
- Data packets never leave your house.
- Very fast, low latency.
- Internet cable can be unplugged, works fine.
Different Network (Outer)
My Laptop (192.168.1.5) → Friend's Laptop (192.168.1.5)
- Packet leaves My Laptop → My Router.
- My Router replaces 192.168.1.5 with Public IP (NAT).
- Travels through Internet → Friend's Public IP.
- Friend's Router receives packet → Forwards to Friend's Laptop.
DNS: The Phonebook
We humans are bad at remembering numbers like 142.250.193.206. We prefer google.com.
DNS (Domain Name System) maps these names to IP addresses.
You: "Go to google.com"
Browser: "Hey DNS Server (8.8.8.8), where is google.com?"
DNS: "It lives at 142.250.193.206"
Browser: *Connects to 142.250.193.206*