IP Addresses Explained: IPv4, IPv6, and How They Work
· 6 min read
What Is an IP Address?
Every device connected to the internet needs a unique identifier—an Internet Protocol (IP) address. Think of it as a postal address for your computer, smartphone, or server. Without IP addresses, data packets would have no way to find their destination, and the internet as we know it simply wouldn't function.
An IP address serves two fundamental purposes: host identification and location addressing. When you type a website URL into your browser, your device uses IP addresses behind the scenes to locate the server hosting that website and establish a connection. This process happens in milliseconds, millions of times per second across the global internet.
There are currently two versions of IP addresses in active use: IPv4 and IPv6. Understanding both is essential for anyone working with networks, servers, or web infrastructure.
IPv4: The Original Standard
IPv4 (Internet Protocol version 4) has been the backbone of internet communication since its deployment in 1983. An IPv4 address consists of four groups of numbers separated by dots, where each group (called an octet) ranges from 0 to 255.
# IPv4 address format
192.168.1.100
# Each octet is 8 bits (1 byte)
# Total: 32 bits = 4,294,967,296 possible addresses
# Finding your public IP
curl ifconfig.me
# Finding your local IP (Linux/Mac)
ifconfig | grep "inet " | grep -v 127.0.0.1
The 32-bit structure of IPv4 allows for approximately 4.3 billion unique addresses. While that seemed like plenty in the early days of the internet, the explosive growth of connected devices—smartphones, IoT devices, smart home appliances—has exhausted this address space. The last blocks of IPv4 addresses were allocated by IANA in 2011, driving the adoption of IPv6.
🛠️ Try it yourself
IPv4 Address Classes
IPv4 addresses were historically divided into classes that determined the size of the network and host portions:
- Class A (1.0.0.0 – 126.255.255.255) — Large networks with millions of hosts. Used by major corporations and ISPs.
- Class B (128.0.0.0 – 191.255.255.255) — Medium-sized networks supporting up to 65,534 hosts per network.
- Class C (192.0.0.0 – 223.255.255.255) — Small networks with up to 254 hosts. Common for small businesses and home networks.
- Class D (224.0.0.0 – 239.255.255.255) — Reserved for multicast groups.
- Class E (240.0.0.0 – 255.255.255.255) — Reserved for experimental use.
Modern networking largely uses CIDR (Classless Inter-Domain Routing) instead of rigid classes, allowing more flexible allocation of address space.
IPv6: The Next Generation
IPv6 was designed to solve the address exhaustion problem once and for all. Using 128-bit addresses instead of 32-bit, IPv6 provides approximately 340 undecillion (3.4 × 10³⁸) unique addresses—enough to assign a unique address to every atom on the surface of the Earth, many times over.
# IPv6 address format (eight groups of four hex digits)
2001:0db8:85a3:0000:0000:8a2e:0370:7334
# Shortened form (omit leading zeros, collapse consecutive zero groups)
2001:db8:85a3::8a2e:370:7334
# IPv6 loopback address
::1
# Check IPv6 connectivity
ping6 google.com
curl -6 ifconfig.me
Beyond the vastly larger address space, IPv6 introduces several improvements over IPv4:
- Simplified header format — Faster packet processing by routers with a streamlined 40-byte fixed header.
- Built-in IPsec — Mandatory security support at the protocol level, enabling end-to-end encryption.
- No more NAT — Every device can have a globally unique address, eliminating the complexity of Network Address Translation.
- Auto-configuration (SLAAC) — Devices can automatically generate their own IPv6 addresses without a DHCP server.
- Better multicast support — More efficient one-to-many communication replaces broadcast.
Public vs Private IP Addresses
Not all IP addresses are created equal. The distinction between public and private addresses is fundamental to understanding how networks operate.
Public IP addresses are globally unique and routable on the internet. They're assigned by your Internet Service Provider (ISP) and are how the rest of the internet identifies your network. You can discover your public IP using our IP Lookup tool.
Private IP addresses are reserved for internal network use and cannot be routed on the public internet. Three ranges are designated as private:
# Private IP ranges (RFC 1918)
10.0.0.0 – 10.255.255.255 (Class A: 16 million addresses)
172.16.0.0 – 172.31.255.255 (Class B: 1 million addresses)
192.168.0.0 – 192.168.255.255 (Class C: 65,536 addresses)
# Your home router typically uses
192.168.0.1 or 192.168.1.1
Your home router uses NAT (Network Address Translation) to map multiple private addresses to a single public IP, allowing all your devices to share one public address. This has been a crucial technique in extending the life of IPv4.
How IP Address Lookup Works
IP geolocation databases map IP addresses to approximate physical locations. When you perform an IP lookup, the service queries these databases to return information such as country, city, ISP, and sometimes the organization that owns the IP block.
This information is gathered from Regional Internet Registries (RIRs) like ARIN, RIPE NCC, APNIC, LACNIC, and AFRINIC, which manage IP address allocation worldwide. While IP geolocation can identify the general area of an IP address, it's typically accurate only to the city level—not to a specific street address.
# Command-line IP lookup
whois 8.8.8.8
# Using dig for reverse DNS
dig -x 8.8.8.8
# Quick geolocation check
curl ipinfo.io/8.8.8.8
IP Addresses and DNS
The Domain Name System (DNS) is the bridge between human-readable domain names and machine-readable IP addresses. When you visit "google.com," DNS resolves that name to an IP address like 142.250.80.46, allowing your browser to connect to the correct server.
Understanding the relationship between IP addresses and DNS is crucial for troubleshooting connectivity issues. If a website isn't loading, the problem might be a DNS resolution failure rather than a server issue. Use our DNS Lookup tool to check how domain names resolve to IP addresses and diagnose potential DNS problems.
# Resolve a domain to its IP
nslookup example.com
dig example.com A # IPv4
dig example.com AAAA # IPv6
# Check which DNS server you're using
cat /etc/resolv.conf
Security and Privacy
Your IP address can reveal more about you than you might expect. It exposes your approximate location, your ISP, and can be used to track your online activity across websites. Here are essential practices to protect your IP privacy:
- Use a VPN — A Virtual Private Network masks your real IP address by routing traffic through an encrypted tunnel to a server in another location.
- Use proxy servers — Forward proxies act as intermediaries, hiding your IP from destination servers.
- Tor network — Routes traffic through multiple encrypted relays for maximum anonymity, though at the cost of speed.
- Secure your router — Change default credentials, enable WPA3 encryption, and keep firmware updated to prevent unauthorized access.
- Monitor your exposure — Regularly check what information your IP reveals using lookup tools.
IP Spoofing and DDoS
IP spoofing—forging the source address in IP packets—is a common technique in DDoS attacks and other malicious activities. Attackers send packets with fake source IPs to overwhelm targets while hiding their identity. Network administrators combat this with ingress filtering (BCP38), rate limiting, and advanced DDoS mitigation services.
Key Takeaways
- IP addresses are the fundamental identifiers for devices on the internet, enabling data routing and communication.
- IPv4 uses 32-bit addresses (4.3 billion total) and is running out; IPv6 uses 128-bit addresses with virtually unlimited supply.
- Private IP addresses are used within local networks, while public IPs identify you on the internet.
- DNS translates domain names to IP addresses, forming a critical layer of internet infrastructure.
- Protecting your IP address through VPNs, proxies, or Tor helps maintain online privacy and security.