IP Addresses Explained: IPv4, IPv6, and How They Work
· 12 min read
Table of Contents
- What Is an IP Address?
- IPv4: The Original Standard
- IPv6: The Next Generation
- Public vs Private IP Addresses
- Understanding IP Address Classes and Subnetting
- How IP Address Lookup Works
- IP Addresses and DNS: The Internet's Phone Book
- Network Address Translation (NAT)
- Security and Privacy Considerations
- Troubleshooting IP Address Issues
- Frequently Asked Questions
- Related Articles
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. Each version has distinct characteristics, addressing schemes, and use cases that make them suitable for different networking scenarios.
IP addresses work at Layer 3 (the Network Layer) of the OSI model, providing the logical addressing necessary for routing data across interconnected networks. Unlike MAC addresses, which are physically burned into network hardware, IP addresses can be dynamically assigned and changed as needed.
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
# Windows command
ipconfig | findstr IPv4
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 officially allocated in 2011, though various conservation techniques have extended their usability.
IPv4 addresses are typically written in dotted-decimal notation, making them human-readable. Each octet represents 8 bits, and when converted to binary, you can see the full 32-bit structure:
Decimal: 192.168.1.100
Binary: 11000000.10101000.00000001.01100100
Pro tip: Use our IP Lookup Tool to instantly check your current public IP address and get detailed geolocation information about any IP address worldwide.
Despite the address exhaustion problem, IPv4 remains the dominant protocol on the internet. Technologies like Network Address Translation (NAT) and Classless Inter-Domain Routing (CIDR) have helped extend the life of IPv4 by allowing multiple devices to share a single public IP address.
IPv6: The Next Generation
IPv6 (Internet Protocol version 6) was developed to solve the IPv4 address exhaustion problem. Introduced in 1998, IPv6 uses 128-bit addresses, providing an almost incomprehensibly large address space—approximately 340 undecillion (3.4 × 10³⁸) unique addresses.
# IPv6 address format
2001:0db8:85a3:0000:0000:8a2e:0370:7334
# Shortened format (removing leading zeros)
2001:db8:85a3:0:0:8a2e:370:7334
# Further shortened (consecutive zero groups as ::)
2001:db8:85a3::8a2e:370:7334
# Finding your IPv6 address (Linux/Mac)
ifconfig | grep inet6
# Windows command
ipconfig | findstr IPv6
IPv6 addresses are written in hexadecimal notation, divided into eight groups of four hexadecimal digits separated by colons. This format is more complex than IPv4 but provides several advantages beyond just more addresses.
Key improvements in IPv6:
- Simplified header format: IPv6 headers are more efficient, improving routing performance
- Built-in security: IPsec is mandatory in IPv6, providing end-to-end encryption
- No NAT required: Every device can have a globally unique address
- Better multicast support: Improved efficiency for one-to-many communications
- Stateless address autoconfiguration: Devices can automatically configure themselves without DHCP
- No broadcast traffic: Replaced with more efficient multicast and anycast
Despite these advantages, IPv6 adoption has been slower than anticipated. As of 2026, approximately 45% of internet traffic uses IPv6, with significant regional variations. Google reports that countries like India, Malaysia, and Germany have adoption rates exceeding 60%, while others lag behind.
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address Length | 32 bits | 128 bits |
| Address Format | Dotted decimal (192.168.1.1) | Hexadecimal (2001:db8::1) |
| Total Addresses | ~4.3 billion | ~340 undecillion |
| Header Size | 20-60 bytes (variable) | 40 bytes (fixed) |
| IPsec Support | Optional | Mandatory |
| Fragmentation | Routers and hosts | Hosts only |
| Checksum | Included in header | Not included |
Public vs Private IP Addresses
Not all IP addresses are created equal. The distinction between public and private IP addresses is fundamental to understanding how modern networks operate.
Public IP addresses are globally unique and routable on the internet. Your Internet Service Provider (ISP) assigns your home or business a public IP address that identifies your network to the outside world. These addresses are managed by regional internet registries and must be unique across the entire internet.
Private IP addresses are used within local networks and are not routable on the public internet. These addresses can be reused across different private networks without conflict. The Internet Assigned Numbers Authority (IANA) has reserved specific ranges for private use:
| Class | Private IP Range | CIDR Notation | Number of Addresses |
|---|---|---|---|
| Class A | 10.0.0.0 - 10.255.255.255 | 10.0.0.0/8 | 16,777,216 |
| Class B | 172.16.0.0 - 172.31.255.255 | 172.16.0.0/12 | 1,048,576 |
| Class C | 192.168.0.0 - 192.168.255.255 | 192.168.0.0/16 | 65,536 |
When you check your device's IP address on a home network, you'll typically see something like 192.168.1.100—a private address. However, when you visit a website like our IP lookup tool, you'll see your public IP address, which is shared by all devices on your network.
This dual-address system is made possible by Network Address Translation (NAT), which we'll explore in detail later. The key takeaway is that private addresses allow organizations to build large internal networks without consuming scarce public IP addresses.
Quick tip: If you're troubleshooting network connectivity, always distinguish between your private (local) IP and public IP. Connection issues to external services relate to your public IP, while problems accessing local devices involve private IPs.
Understanding IP Address Classes and Subnetting
Originally, IPv4 addresses were divided into five classes (A through E) based on the first few bits of the address. While classful networking is largely obsolete, replaced by Classless Inter-Domain Routing (CIDR), understanding these classes helps grasp fundamental networking concepts.
IPv4 Address Classes:
- Class A (0.0.0.0 to 127.255.255.255): Designed for very large networks, with the first octet identifying the network and the remaining three octets identifying hosts. Supports up to 16 million hosts per network.
- Class B (128.0.0.0 to 191.255.255.255): For medium-sized networks, using the first two octets for the network and the last two for hosts. Supports up to 65,534 hosts per network.
- Class C (192.0.0.0 to 223.255.255.255): For smaller networks, with three octets for the network and one for hosts. Supports up to 254 hosts per network.
- Class D (224.0.0.0 to 239.255.255.255): Reserved for multicast groups, not assigned to individual hosts.
- Class E (240.0.0.0 to 255.255.255.255): Reserved for experimental purposes and future use.
Subnetting is the practice of dividing a network into smaller sub-networks. This improves network performance, enhances security, and makes more efficient use of IP address space. A subnet mask determines which portion of an IP address represents the network and which represents the host.
# Common subnet masks
255.255.255.0 = /24 (254 usable hosts)
255.255.255.128 = /25 (126 usable hosts)
255.255.255.192 = /26 (62 usable hosts)
255.255.255.224 = /27 (30 usable hosts)
# Example: Dividing 192.168.1.0/24 into 4 subnets
Subnet 1: 192.168.1.0/26 (192.168.1.1 - 192.168.1.62)
Subnet 2: 192.168.1.64/26 (192.168.1.65 - 192.168.1.126)
Subnet 3: 192.168.1.128/26 (192.168.1.129 - 192.168.1.190)
Subnet 4: 192.168.1.192/26 (192.168.1.193 - 192.168.1.254)
CIDR notation (the "/24" suffix) indicates how many bits are used for the network portion. A /24 network uses 24 bits for the network, leaving 8 bits for hosts (2⁸ - 2 = 254 usable addresses, subtracting the network and broadcast addresses).
How IP Address Lookup Works
IP address lookup is the process of determining information about an IP address, including its geographic location, ISP, organization, and other metadata. This process relies on databases maintained by regional internet registries and third-party services.
When you use an IP lookup tool, several things happen behind the scenes:
- Database Query: The tool queries one or more IP geolocation databases (like MaxMind, IP2Location, or IPinfo) that map IP address ranges to geographic locations and organizations.
- WHOIS Lookup: For detailed ownership information, the tool may perform a WHOIS query against the appropriate regional internet registry (ARIN, RIPE, APNIC, LACNIC, or AFRINIC).
- Reverse DNS: The tool may perform a reverse DNS lookup to find the hostname associated with the IP address.
- ASN Information: Autonomous System Number data reveals which organization controls the routing for that IP address.
The accuracy of IP geolocation varies significantly. While country-level accuracy typically exceeds 95%, city-level accuracy ranges from 50-80% depending on the database and region. Factors affecting accuracy include:
- VPN and proxy usage masking true locations
- Mobile networks with dynamic IP allocation
- Corporate networks with centralized internet gateways
- Database update frequency and quality
Pro tip: For accurate geolocation of your own users, consider using HTML5 Geolocation API in combination with IP geolocation. The browser-based API provides much more precise location data when users grant permission.
IP lookup tools are invaluable for various use cases:
- Security analysis: Identifying the source of suspicious traffic or attacks
- Content localization: Serving region-specific content to users
- Compliance: Enforcing geographic restrictions for licensing or regulatory reasons
- Network troubleshooting: Diagnosing routing issues and verifying network paths
- Marketing analytics: Understanding visitor demographics and traffic sources
IP Addresses and DNS: The Internet's Phone Book
The Domain Name System (DNS) is the bridge between human-readable domain names and machine-readable IP addresses. When you type "example.com" into your browser, DNS translates that name into an IP address like 93.184.216.34 so your computer can establish a connection.
The DNS resolution process involves multiple steps:
- Browser cache check: Your browser first checks if it has recently resolved this domain
- Operating system cache: If not in browser cache, the OS checks its DNS cache
- Recursive resolver: Your ISP's DNS server (or a public DNS like Google's 8.8.8.8) receives the query
- Root nameserver: The recursive resolver queries a root nameserver for the TLD nameserver
- TLD nameserver: The .com nameserver provides the authoritative nameserver for the domain
- Authoritative nameserver: Finally, the domain's nameserver returns the IP address
- Response cached: The IP address is cached at multiple levels for future requests
# Performing DNS lookups from command line
# Basic DNS lookup (A record)
nslookup example.com
# Detailed DNS information
dig example.com
# Reverse DNS lookup (IP to hostname)
nslookup 93.184.216.34
dig -x 93.184.216.34
# Query specific DNS record types
dig example.com MX # Mail servers
dig example.com TXT # Text records
dig example.com AAAA # IPv6 address
DNS records come in various types, each serving a specific purpose:
- A record: Maps a domain to an IPv4 address
- AAAA record: Maps a domain to an IPv6 address
- CNAME record: Creates an alias pointing to another domain
- MX record: Specifies mail servers for the domain
- TXT record: Stores text information, often for verification or security
- NS record: Identifies authoritative nameservers for the domain
- PTR record: Used for reverse DNS lookups
DNS caching significantly improves internet performance by reducing the need for repeated lookups. However, it also means that DNS changes can take time to propagate globally—a phenomenon known as DNS propagation, which typically takes 24-48 hours but can be longer.
Use our DNS Lookup Tool to query DNS records for any domain and troubleshoot DNS-related issues quickly.
Network Address Translation (NAT)
Network Address Translation (NAT) is the technology that allows multiple devices on a private network to share a single public IP address. Without NAT, the IPv4 address exhaustion problem would have been catastrophic years ago.
NAT operates at the network gateway (typically your router) and performs address translation in both directions:
Outbound traffic: When a device on your private network (e.g., 192.168.1.100) sends data to the internet, the NAT router replaces the private source IP with its public IP address and tracks the connection in a translation table.
Inbound traffic: When response packets arrive at the public IP, the router consults its translation table to determine which private IP address should receive the data and forwards it accordingly.
# Example NAT translation table
Private IP:Port → Public IP:Port → Destination
192.168.1.100:5432 → 203.0.113.5:12345 → 93.184.216.34:80
192.168.1.101:6789 → 203.0.113.5:12346 → 172.217.14.206:443
192.168.1.102:8901 → 203.0.113.5:12347 → 151.101.1.140:80
There are several types of NAT:
- Static NAT: One-to-one mapping between private and public addresses, used for servers that need consistent external addresses
- Dynamic NAT: Maps private addresses to a pool of public addresses on a first-come, first-served basis
- PAT (Port Address Translation): Also called NAT overload, this is the most common type, using port numbers to multiplex many private addresses onto one public address
- Double NAT: Occurs when NAT is performed twice in the path, often causing connectivity issues for certain applications
While NAT has been essential for IPv4 conservation, it introduces some complications:
- Breaks end-to-end connectivity: Devices behind NAT cannot be directly addressed from the internet
- Complicates peer-to-peer applications: Requires techniques like STUN, TURN, or UPnP for direct connections
- Interferes with some protocols: Protocols that embed IP addresses in payload data may not work correctly
- Adds processing overhead: The router must maintain translation tables and modify packets
Quick tip: If you're hosting a server or service behind NAT, you'll need to configure port forwarding on your router to allow inbound connections. Each service requires its specific port to be forwarded to the correct internal IP address.
Security and Privacy Considerations
Your IP address reveals more information than you might think. While it doesn't directly identify you as an individual, it can be used to approximate your location, identify your ISP, and track your online activities across websites.
Privacy concerns with IP addresses:
- Geolocation tracking: Websites can determine your approximate location and serve targeted content or ads
- Activity correlation: Multiple websites can correlate visits from the same IP address to build user profiles
- ISP monitoring: Your ISP can see all websites you visit (though not encrypted content)
- Legal requests: Law enforcement can request logs from ISPs to identify users behind IP addresses
- DDoS attacks: Exposed IP addresses can become targets for distributed denial-of-service attacks
Security best practices:
- Use a VPN: Virtual Private Networks mask your real IP address by routing traffic through remote servers
- Enable firewall: Block unsolicited inbound connections to your IP address
- Keep software updated: Patch vulnerabilities that could be exploited through your IP
- Use HTTPS: Encrypt web traffic so ISPs and intermediaries can't see content
- Consider Tor: For maximum anonymity, the Tor network routes traffic through multiple nodes
- Disable UPnP: Universal Plug and Play can automatically open ports, creating security risks
For businesses and server administrators, additional security measures are critical:
- Implement rate limiting: Prevent brute force attacks and abuse
- Use IP whitelisting: Restrict access to sensitive resources to known IP addresses
- Deploy DDoS protection: Services like Cloudflare can absorb large-scale attacks
- Monitor access logs: Watch for suspicious patterns in IP address access
- Implement fail2ban: Automatically block IPs after repeated failed authentication attempts
Check your current IP address and see what information is publicly visible using our IP Lookup Tool. Understanding what data is exposed helps you make informed decisions about privacy protection.
Troubleshooting IP Address Issues
IP address problems are among the most common network issues. Understanding how to diagnose and resolve them is essential for maintaining connectivity.
Common IP address problems:
- DHCP failures: Device unable to obtain an IP address automatically
- IP conflicts: Two devices assigned the same IP address on a network
- Incorrect subnet mask: Prevents communication with devices on the same network
- Wrong gateway: Blocks access to external networks and the internet
- DNS issues: IP connectivity works but domain names don't resolve
Diagnostic commands for troubleshooting:
# Check current IP configuration
# Windows
ipconfig /all
# Linux/Mac
ifconfig -a
ip addr show
# Release and renew DHCP lease
# Windows
ipconfig /release
ipconfig /renew
# Linux
sudo dhclient -r
sudo dhclient
# Test connectivity to gateway
ping 192.168.1.1
# Test connectivity to external IP
ping 8.8.8.8
# Test DNS resolution
nslookup google.com
# Trace route to destination
# Windows
tracert google.com
# Linux/Mac
traceroute google.com
# Display routing table
# Windows
route print
# Linux/Mac
netstat -rn
ip route show
Step-by-step troubleshooting process:
- Verify physical connection: Check cables, WiFi connection, and network adapter status
- Check IP configuration: Ensure you have a valid IP address (not 169.254.x.x, which indicates DHCP failure)
- Test local connectivity: Ping your gateway to verify local network communication
- Test external connectivity: Ping a public IP address like 8.8.8.8 to check internet access
- Test DNS resolution: Use nslookup to verify DNS is working correctly
- Check firewall rules: Ensure firewall isn't blocking necessary traffic
- Review DHCP server: Verify DHCP server is running and has available addresses
Pro tip: If you see an IP address starting with 169.254, your device failed to get an address from DHCP and assigned itself an APIPA (Automatic Private IP Addressing) address. This indicates a DHCP server problem or network connectivity issue.
For persistent issues, consider these advanced troubleshooting steps:
- Reset network stack: On Windows, use
netsh int ip resetandnetsh winsock reset - Update network drivers: Outdated drivers can cause connectivity problems
- Check for IP conflicts: Use
arp -ato see if multiple devices claim the same IP - Verify VLAN configuration: In managed networks, incorrect VLAN settings prevent communication
- Test with static IP: Temporarily assign a static IP to isolate DHCP issues
Frequently Asked Questions
What's the difference between a static and dynamic IP address?