IP Address (IPv4 vs. IPv6)
A numerical label assigned to each device connected to a computer network.
Detailed Explanation
IPv4 (e.g., `192.168.1.1`) uses 32 bits, allowing for ~4 billion addresses, which the world has now run out of. IPv6 (e.g., `2001:0db8:85a3...`) uses 128 bits, providing a virtually infinite number of addresses. IPv6 also includes better security and routing features, though the transition from IPv4 has taken decades.
Quick Summary
An IP address identifies a network endpoint. IPv4 has run out, but lives on through NAT; IPv6 has effectively unlimited addresses and is gradually taking over. Both will coexist for a long time.
Key Takeaways
- IPv4: 32-bit, written as four octets (`192.168.1.1`). Public address space is exhausted.
- IPv6: 128-bit, written in hex with colons (`2001:db8::1`). Plenty of addresses for every grain of sand.
- Private ranges (RFC1918): `10/8`, `172.16/12`, `192.168/16` for internal networks behind NAT.
- CIDR notation (`10.0.0.0/24`) defines subnet sizes; the `/n` is the number of network bits.
- Cloud providers default to IPv4 + optional IPv6; mobile carriers are largely IPv6-first.
When to use it
- Designing VPC subnets and routing rules in cloud networks.
- Configuring firewall and security group rules by CIDR range.
- Geo-locating users (with significant limitations and privacy considerations).
- Rate limiting and abuse detection by IP , with awareness that NAT and CGNAT share IPs across many users.
Common Mistakes
- Treating IP as a stable user identifier; mobile users hop IPs constantly.
- Forgetting IPv6 in security rules , apps may be reachable via IPv6 even when firewall is configured for IPv4 only.
- Hard-coding IPs instead of hostnames; cloud infrastructure scales by rotating addresses.
- Trusting `X-Forwarded-For` without verifying it came from a trusted proxy; clients can spoof it.
IP Address (IPv4 vs. IPv6), Frequently Asked
Should I support IPv6?
Yes, especially for consumer-facing apps. Mobile networks (T-Mobile, Verizon, Jio) are IPv6-first; users without IPv6 fall back through degraded NAT64 paths. Cloud load balancers usually do dual-stack with a checkbox.
Can I trust a user's IP?
Only as a coarse signal. Use it for rate limiting, anomaly detection, and broad geo, but never as authentication or unique identity. CGNAT, VPNs, proxies, and mobile network reshuffling all make IP-as-identity unreliable.