IP Addresses: IPv4, IPv6, Public vs Private

· 12 min read

Table of Contents

Every device connected to the internet needs a unique identifier to send and receive data. That identifier is an IP address—the fundamental addressing system that makes modern networking possible. Whether you're troubleshooting connectivity issues, setting up a home network, or simply curious about how the internet works, understanding IP addresses is essential.

This comprehensive guide explores everything you need to know about IP addresses, from the technical differences between IPv4 and IPv6 to practical security considerations. We'll cover how to find your own IP addresses, when to use static versus dynamic assignments, and how public and private addresses work together to keep the internet functioning.

Understanding IPv4 Addresses

IPv4 (Internet Protocol version 4) addresses are the most widely recognized form of IP addressing. These 32-bit addresses form the backbone of current network communication, formatted as four octets separated by periods, such as 192.168.1.1.

Each octet represents 8 bits and can range from 0 to 255, creating a theoretical maximum of approximately 4.3 billion unique addresses (232 = 4,294,967,296). While this seemed like an enormous number when IPv4 was standardized in 1981, the explosive growth of the internet led to complete allocation of all available IPv4 addresses by 2011.

IPv4 Address Structure

An IPv4 address consists of two main components:

The division between network and host portions is determined by the subnet mask, which we'll explore in detail later. For example, in the address 192.168.1.100 with a subnet mask of 255.255.255.0, the first three octets (192.168.1) represent the network, while the last octet (100) identifies the specific host.

IPv4 Address Classes

IPv4 addresses were originally divided into five classes (A through E), though modern networking primarily uses classless addressing. Understanding these classes still provides valuable context:

Class Range Default Mask Purpose Number of Networks
A 1.0.0.0 to 126.255.255.255 255.0.0.0 (/8) Large networks 128 networks, 16M hosts each
B 128.0.0.0 to 191.255.255.255 255.255.0.0 (/16) Medium networks 16,384 networks, 65K hosts each
C 192.0.0.0 to 223.255.255.255 255.255.255.0 (/24) Small networks 2M networks, 254 hosts each
D 224.0.0.0 to 239.255.255.255 N/A Multicast Reserved for multicast groups
E 240.0.0.0 to 255.255.255.255 N/A Experimental Reserved for research

Practical Usage of IPv4

Despite its limitations, IPv4 remains the dominant protocol across residential and small enterprise networks. Most routers assign IPv4 addresses dynamically using the Dynamic Host Configuration Protocol (DHCP). This protocol automates the assignment of a new IP address when a device joins the network, eliminating manual configuration and reducing errors.

To view your IPv4 address on various systems, use these commands:

# Linux/macOS
ip addr show | grep 'inet '
# or
ifconfig | grep 'inet '

# Windows Command Prompt
ipconfig | findstr /C:"IPv4 Address"

# Windows PowerShell
Get-NetIPAddress -AddressFamily IPv4

Pro tip: Use our IP Lookup tool to instantly check your public IPv4 address without running any commands. It also provides geolocation data and ISP information.

IPv4's continued use is bolstered by compatibility with essential network tools. The DNS Lookup tool resolves domain names into IP addresses, an essential function for troubleshooting and validating network configurations. Similarly, the Ping Tool helps verify connectivity between devices using their IPv4 addresses.

Exploring IPv6 Addresses

IPv6 (Internet Protocol version 6) represents the next generation of internet addressing, designed to solve IPv4's address exhaustion problem. With 128-bit addresses, IPv6 provides an almost incomprehensibly large address space—approximately 340 undecillion (3.4 × 1038) unique addresses.

An IPv6 address is formatted as eight groups of four hexadecimal digits separated by colons, like 2001:0db8:85a3:0000:0000:8a2e:0370:7334. This format allows for much more compact representation than IPv4 while providing exponentially more addresses.

IPv6 Address Notation

IPv6 addresses can be shortened using two rules:

  1. Leading zeros: Can be omitted from any group. For example, 0db8 becomes db8
  2. Consecutive zeros: One sequence of consecutive zero groups can be replaced with ::

Using these rules, the address 2001:0db8:0000:0000:0000:0000:0000:0001 can be shortened to 2001:db8::1. The double colon can only appear once in an address to avoid ambiguity.

Types of IPv6 Addresses

IPv6 defines several address types, each serving specific purposes:

IPv6 eliminated broadcast addresses entirely, replacing them with more efficient multicast addressing.

Benefits and Transition Strategies

IPv6 brings numerous improvements beyond just more addresses:

The transition from IPv4 to IPv6 is happening gradually through several mechanisms:

Quick tip: Most modern operating systems prefer IPv6 when available. You can check if your connection supports IPv6 using our IPv6 Test tool.

Differentiating Public and Private IP Addresses

Understanding the distinction between public and private IP addresses is crucial for network configuration and security. These two categories serve fundamentally different purposes in network architecture.

Public IP Addresses

Public IP addresses are globally unique and routable on the internet. Your Internet Service Provider (ISP) assigns your network a public IP address, which serves as your network's identity on the internet. Any device on the internet can potentially communicate with your public IP address.

Key characteristics of public IPs:

Private IP Addresses

Private IP addresses are reserved for use within local networks and cannot be routed on the public internet. These addresses can be reused across different private networks without conflict, making them ideal for internal network organization.

The Internet Assigned Numbers Authority (IANA) has reserved three ranges for private use:

Range CIDR Notation Number of Addresses Typical Use
10.0.0.0 – 10.255.255.255 10.0.0.0/8 16,777,216 Large enterprise networks
172.16.0.0 – 172.31.255.255 172.16.0.0/12 1,048,576 Medium-sized networks
192.168.0.0 – 192.168.255.255 192.168.0.0/16 65,536 Home and small office networks

Most home routers default to the 192.168.x.x range, with common router addresses being 192.168.1.1 or 192.168.0.1.

How They Work Together

In a typical home or office network, devices use private IP addresses internally while sharing a single public IP address for internet access. This is accomplished through Network Address Translation (NAT), which we'll explore in detail later.

For example, your laptop might have the private IP 192.168.1.105, your phone 192.168.1.106, and your smart TV 192.168.1.107. All three devices share your router's public IP address (something like 203.0.113.45) when accessing the internet.

Pro tip: You can find your public IP address using our What Is My IP tool, while your private IP is visible in your device's network settings or through command-line tools.

Finding Your IP Addresses

Knowing how to locate both your public and private IP addresses is essential for network troubleshooting, configuration, and security auditing. The methods vary depending on your operating system and whether you need your public or private address.

Finding Your Private IP Address

Windows:

  1. Press Win + R, type cmd, and press Enter
  2. Type ipconfig and press Enter
  3. Look for "IPv4 Address" under your active network adapter

Alternatively, navigate to Settings → Network & Internet → Properties to view your IP address in the GUI.

macOS:

  1. Open System Preferences → Network
  2. Select your active connection (Wi-Fi or Ethernet)
  3. Your IP address is displayed on the right side

Or use Terminal: ifconfig | grep "inet "

Linux:

# Modern systems
ip addr show

# Older systems
ifconfig

# Specific interface
ip addr show eth0

Mobile Devices:

Finding Your Public IP Address

Your public IP address is what the rest of the internet sees. Several methods can reveal it:

Using Web Tools:

Using Command Line:

# Linux/macOS
curl ifconfig.me
curl icanhazip.com
dig +short myip.opendns.com @resolver1.opendns.com

# Windows PowerShell
(Invoke-WebRequest -Uri "https://api.ipify.org").Content

Router Admin Panel:

Most routers display your public IP address on their status or dashboard page. Access your router by entering its IP address (usually 192.168.1.1 or 192.168.0.1) in a web browser.

Quick tip: If you're troubleshooting connectivity issues, check both your private and public IP addresses. A valid private IP but no public IP often indicates a problem with your router or ISP connection.

Static vs Dynamic IPs

IP addresses can be assigned in two ways: statically (manually configured and permanent) or dynamically (automatically assigned and potentially changing). Each approach has distinct advantages and use cases.

Dynamic IP Addresses

Dynamic IP addresses are automatically assigned by a DHCP server (usually your router for private IPs, or your ISP for public IPs). The address is "leased" to your device for a specific period, after which it may change.

Advantages:

Disadvantages:

Best for: Home users, mobile devices, workstations, and any device that doesn't need to be consistently reachable at the same address.

Static IP Addresses

Static IP addresses are manually configured and remain constant until deliberately changed. They provide predictable, permanent addressing for devices that need consistent network identity.

Advantages:

Disadvantages:

Best for: Web servers, email servers, VPN endpoints, network printers, security cameras, and any device that needs to be consistently reachable.

Configuring Static IP Addresses

When setting up a static IP on your local network, follow these guidelines:

  1. Choose an IP address outside your router's DHCP range to avoid conflicts
  2. Use the same subnet mask as your network (typically 255.255.255.0)
  3. Set your router's IP as the default gateway
  4. Configure DNS servers (use your router's IP or public DNS like 8.8.8.8)
  5. Document all static IP assignments to prevent future conflicts

Pro tip: Many routers support DHCP reservations, which combine the convenience of DHCP with the consistency of static IPs. The router automatically assigns the same IP to a device based on its MAC address. Check this using our MAC Address Lookup tool.

Subnetting and CIDR Notation

Subnetting divides a larger network into smaller, more manageable segments. This practice improves network performance, enhances security, and makes more efficient use of IP address space.

Understanding Subnet Masks

A subnet mask determines which portion of an IP address represents the network and which represents the host. It's written in the same dotted-decimal format as IP addresses, such as 255.255.255.0.

In binary, subnet masks consist of consecutive 1s followed by consecutive 0s. The 1s indicate the network portion, while the 0s indicate the host portion:

CIDR Notation

Classless Inter-Domain Routing (CIDR) provides a more flexible and compact way to represent IP addresses and their subnet masks. Instead of writing out the full subnet mask, CIDR uses a slash followed by the number of network bits.

For example, 192.168.1.0/24 means:

Common CIDR notations and their equivalents:

CIDR Subnet Mask Usable Hosts Typical Use
/8 255.0.0.0 16,777,214 Massive networks
/16 255.255.0.0 65,534 Large organizations
/24 255.255.255.0 254 Small networks, home/office
/25 255.255.255.128 126 Small office subnets
/26 255.255.255.192 62 Department-level subnets
/27 255.255.255.224 30 Small team subnets
/28 255.255.255.240 14 Very small subnets
/30 255.255.255.252 2 Point-to-point links

Practical Subnetting Example

Suppose you have the network 192.168.1.0/24 and need to divide it into four subnets for different departments:

  1. Determine the new subnet mask: You need 2 additional bits (22 = 4 subnets), so /24 becomes /26
  2. Calculate the subnet size: /26 provides 64 addresses per subnet (26 = 64)
  3. Define the subnets:
    • Subnet 1: 192.168.1.0/26 (192.168.1.0 - 192.168.1.63)
    • Subnet 2: 192.168.1.64/26 (192.168.1.64 - 192.168.1.127)
    • Subnet 3: 192.168.1.128/26 (192.168.1.128 - 192.168.1.191)
    • Subnet 4: 192.168.1.192/26 (192.168.1.192 - 192.168.1.255)

Each subnet has 62 usable host addresses (64 total minus network address and broadcast address).

Quick tip: Use our Subnet Calculator to quickly calculate subnet ranges, broadcast addresses, and usable host counts without manual binary conversion.

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. It's the reason your home can have dozens of connected devices while only using one public IP from your ISP.

How NAT Works

When a device on your private network sends data to the internet, NAT performs these steps:

  1. Your device (e.g., 192.168.1.100) sends a request to a website
  2. The router receives the packet and records the private IP and port number
  3. The router replaces the private source IP with its public IP
  4. The router assigns a unique port number to track this connection
  5. The packet is sent to the internet with the public IP as the source
  6. When the response returns, the router uses its translation table to forward it to the correct private IP

Types of NAT

Static NAT: One-to-one mapping between private and public IP addresses. Each private IP is permanently mapped to a specific public IP. Used when you need consistent external addressing for internal servers.

Dynamic NAT: Maps private IPs to a pool of public IPs on a first-come, first-served basis. The mapping changes as connections are established and terminated.

PAT (Port Address Translation): Also called NAT overload, this is the most common type. Multiple private IPs share a single public IP, differentiated by port numbers. This is what most home routers use.

Benefits of NAT

NAT Limitations

While NAT solves many problems, it introduces some challenges:

Port Forwarding

Port forwarding is a NAT configuration that allows external devices to reach specific services on your private network. You configure your router to forward incoming traffic on specific ports to designated internal IP addresses.

For example, to host a web server on 192.168.1.50:

Pro tip: Use our Port Checker tool to verify that your port forwarding rules are working correctly and that external devices can reach your services.

Security Implications of IP Addresses

IP addresses play a crucial role in network security, both as identifiers that need protection and as tools for implementing security measures. Understanding the security implications helps you protect your network and privacy.

Privacy Concerns

Your public IP address reveals information about you:

While this information isn't directly identifying, it can be combined with other data to build a profile of your online behavior.

IP-Based Attacks

Several attack types target IP addresses:

DDoS (Distributed Denial of Service): Attackers flood your IP address with traffic, overwhelming your connection and making services unavailable. Use our Ping Tool to test if your services are responding.

IP Spoofing: Attackers forge the source IP address in packets to impersonate another device or bypass security controls.

We use cookies for analytics. By continuing, you agree to our Privacy Policy.