VMware ESXi and vSphere Cluster Management

What Is an IP Address? IPv4, IPv6, Public, and Private Addresses

Learn what IP addresses do, how IPv4 and IPv6 work, and how public, private, DHCP, subnetting, NAT, and Linux network commands fit together.

An IP address is a logical network-layer address used by Internet Protocol networks to identify a network interface or host and deliver packets to it. IP addressing lets a sender identify a source, identify a destination, and choose routes across one or more networks.

A device communicating with TCP/IP normally needs more than an address alone. Its configuration commonly includes an IP address, a subnet mask or CIDR prefix, a default gateway, and DNS servers. Together, these settings tell the device which destinations are local, where to send off-network traffic, and how to translate names such as example.com into addresses.

What an IP Address Does

A host is a participating device or endpoint, such as a laptop, server, printer, phone, or virtual machine. A network interface is a physical or virtual connection through which a host communicates. One host can have several interfaces, such as Ethernet, Wi-Fi, a VPN interface, and a loopback interface.

IP packets contain source and destination IP addresses. Routers examine the destination address and forward the packet toward the appropriate network. The address identifies an endpoint in a network context; it does not permanently identify a person or a particular physical device.

IP Addresses and MAC Addresses

An IP address is a logical address. It can change when a device joins another network, changes configuration, or receives a different DHCP lease. A MAC address is a link-layer, hardware-style address used for delivery on a local network segment. Ethernet and Wi-Fi devices commonly use MAC addresses for local frames.

IP addresses support communication between different networks. MAC addresses generally have meaning only on the local link and are replaced at each routed hop. For IPv4, ARP associates a local IP address with the MAC address needed to deliver a frame. IPv6 uses Neighbor Discovery for a similar local-link neighbor-resolution function.

For example, a workstation can decide that 192.168.1.50 is on its local subnet. It uses ARP to learn the printer's MAC address, then sends an Ethernet or Wi-Fi frame directly to the printer. If the destination is outside the local subnet, the workstation resolves the default gateway's MAC address and sends the frame to the router instead.

IPv4 Addressing

IPv4 is a 32-bit version of Internet Protocol addressing. It is normally written as four decimal octets separated by periods, such as 10.50.201.1 or 192.168.1.25. Each octet represents 8 bits and ranges from 0 through 255.

An IPv4 address by itself does not tell you which portion represents the local network. You also need a subnet mask or CIDR prefix length. The notation 192.168.1.25/24 means that the first 24 bits are the network portion and the remaining 8 bits are available for host addressing within that subnet.

Reading CIDR Notation

CIDR prefix length is the number after the slash. A prefix of /24 has 24 network bits and 8 host bits. Its equivalent IPv4 subnet mask is 255.255.255.0. The address 192.168.1.25/24 belongs to the network 192.168.1.0/24.

The prefix determines whether a destination is local. A workstation at 10.50.201.1/24 and a printer at 10.50.201.50/24 share the network 10.50.201.0/24, so the workstation can send traffic directly to the printer. A host at 192.168.10.20/24 sending to 8.8.8.8 sees that the destination is outside 192.168.10.0/24 and sends the packet to its default gateway.

IPv4 Address Categories

CategoryExampleScope and routing behaviorTypical use
Private IPv4192.168.1.25Internal use; not publicly routed on the InternetHome, office, and lab LANs
Public IPv4203.0.113.20Globally routable when assigned and announced appropriatelyInternet connections, services, and cloud resources
Loopback127.0.0.1Stays inside the local hostTesting local services
Link-local IPv4169.254.10.4Limited to the local link; normally appears when automatic configuration cannot obtain a usable IPv4 addressLocal-link fallback communication
Unspecified address0.0.0.0Means “no particular address” in contexts such as listening on all IPv4 interfaces or selecting a default routeStartup and configuration operations

Private IPv4 Addresses

Private IP addresses are reserved for internal networks such as home, office, and laboratory LANs. Routers on the public Internet do not publicly route these ranges as ordinary Internet destinations. The same private range can be reused independently by many organizations and homes.

CIDR blockFirst addressLast addressCommon usage
10.0.0.0/810.0.0.010.255.255.255Large corporate, cloud, and lab networks
172.16.0.0/12172.16.0.0172.31.255.255Office and enterprise networks
192.168.0.0/16192.168.0.0192.168.255.255Home and small-office networks

The ranges above are the RFC 1918 private IPv4 ranges. A private address can be valid and useful inside a LAN even though an Internet host cannot route directly back to it.

Public IPv4 Addresses

A public IP address is a globally routable address used for communication across the public Internet. An ISP commonly assigns one to a home router, modem-router, or directly connected host. Public addresses can also be assigned to organizations, hosting services, cloud resources, and ISP subscriber connections.

A public address may be static, meaning it remains assigned according to a service agreement or administrator configuration, or dynamic, meaning it is assigned for a period and may change. Dynamic public addressing is common for consumer connections. A change can occur after a lease expires, a router reconnects, or the ISP changes its allocation.

NAT: Connecting Private Devices to the Internet

Network Address Translation (NAT) changes address information as traffic crosses a router. In a common home design, many devices use private addresses while the router has one public IPv4 address. For outbound traffic, the router performs source NAT, often called masquerading, replacing a private source address and source port with its public address and a chosen source port. It records the translation so returning traffic can be sent to the correct internal device.

For example, a laptop may use 192.168.1.25/24, while the home router uses 192.168.1.1 on the LAN and receives one public IPv4 address from the ISP. When the laptop accesses an Internet service, the router translates the laptop's private source address to the public address.

NAT is common partly because IPv4 addresses are scarce, but NAT is separate from routing. Routing chooses where packets should go; translation changes address or port information. Inbound Internet access to a private device generally requires port forwarding or an equivalent firewall and translation rule. The service must also be listening on the intended interface, and the ISP must permit inbound access.

Obtaining an IP Address

A host can receive network settings manually, automatically through DHCP, or through a DHCP reservation.

MethodHow configuration is receivedAdvantagesConsiderations
DHCPA DHCP server supplies an address and related options for a lease durationSimple administration and automatic configurationThe address may change when the lease changes or expires
Static/manual configurationAn administrator enters the address, prefix or mask, gateway, and DNS serversPredictable address for infrastructure such as servers and printersRequires careful documentation and avoidance of duplicate addresses
DHCP reservationThe DHCP server assigns a predictable address to a recognized device, commonly by MAC addressCentral management with stable addressingDepends on the DHCP server and its reservation configuration

Common DHCP-provided settings include the IP address, subnet mask or prefix, default gateway, DNS servers, and lease duration. For a manually configured local service, an example set of parameters might be:

address:     192.168.1.50/24
gateway:     192.168.1.1
dns_servers: 192.168.1.1, 1.1.1.1

Use values appropriate for the actual LAN. A manually selected address should not overlap the DHCP pool unless the router has a matching reservation.

IPv6 Overview

IPv6 is the newer Internet Protocol addressing version and uses 128-bit addresses. IPv6 is not written as four larger IPv4-style numbers. It uses hexadecimal groups separated by colons, for example 2001:db8:1234::10. Consecutive groups of zeros can be compressed with ::, once per address.

IPv4 and IPv6 can operate together using dual-stack networking. A Linux host might have 192.168.1.25 as an IPv4 address and an IPv6 address at the same time. Applications may use either protocol depending on available connectivity, name-resolution results, and application behavior.

IPv6 local-use addressing is different from RFC 1918 private IPv4 addressing. Unique local addresses, commonly from fc00::/7, are intended for private IPv6 networks and are not expected to be routed globally. Link-local addresses use fe80::/10 and operate only on the local link. IPv6 also commonly uses globally routable addresses for hosts, reducing the need for IPv4-style address sharing through NAT.

CharacteristicIPv4IPv6
Address length32 bits128 bits
Written formatFour decimal octets separated by periodsHexadecimal groups separated by colons
Example address192.168.1.252001:db8:1234::10
Local-use addressingRFC 1918 private ranges and link-local 169.254.0.0/16Unique local addresses and link-local fe80::/10
Coexistence approachCan operate alongside IPv6Dual-stack allows both protocols on one host or network

Viewing IP Addresses on Linux

The ip command from the iproute2 package is the standard way to inspect Linux interfaces and routes.

# Display IPv4 and IPv6 addresses on all interfaces
ip addr show

# Display IPv4 addresses only
ip -4 addr show

# Display IPv6 addresses only
ip -6 addr show

# Inspect one interface
ip addr show dev enp0s3

# Display routes and find the default gateway
ip route show

Interface names may look like eth0, enp0s3, or wlan0. In the output, look for inet entries for IPv4 and inet6 entries for IPv6. A default route commonly appears in this form:

default via <gateway-address> dev <interface>

On systems managed by NetworkManager, use:

nmcli device show

This can show addresses, gateways, DNS information, device state, and other connection details. NetworkManager is not present or managing every Linux interface, so use the tools appropriate to the distribution and network stack.

Local Address Versus Public Address

ip addr show displays addresses assigned to the local host's interfaces. It does not necessarily show the Internet-facing public address. On a NAT network, the local host normally displays a private address, while the router or an upstream ISP device owns the public address.

You can ask an external HTTPS service which address it observes:

curl https://api.ipify.org; echo

This normally reports the router's or upstream NAT device's public address rather than the host's private LAN address. A VPN, proxy, corporate gateway, or carrier-grade NAT can cause the observed address to differ from the address assigned directly by the ISP.

Testing Connectivity

Test progressively: first inspect the local address, then the route, then the gateway, then an external IP address, and finally a domain name. This helps separate interface, routing, Internet, and DNS problems.

# Test the local gateway
ping -c 4 192.168.1.1

# Test name resolution and IP reachability together
ping -c 4 example.com

If a known IP-address test succeeds but a domain-name test fails, DNS configuration or the local resolver may be the problem. A successful ping is not proof that every service is available: firewalls may block ICMP while allowing web or other application traffic.

Common Problems and Checks

No IPv4 Address on an Interface

Possible causes include a disconnected cable, failed Wi-Fi association, disabled interface, unavailable DHCP server, or incorrect NetworkManager or static configuration.

  • Run ip -4 addr show and confirm the intended interface is present and operational.
  • Inspect nmcli device show where NetworkManager manages the device.
  • Check DHCP client and network-service logs when applicable.
  • Verify the physical connection, wireless association, and interface state.

Private Address but No Internet Access

The host may have a valid local address but lack a default route, or the router may have no upstream connectivity. DNS or firewall policy can also cause the failure.

  • Run ip route show and verify a default route.
  • Ping the configured default gateway.
  • Test a known external IP address before testing a domain name.
  • Compare the configured DNS servers with the expected network settings.

Duplicate Address Problems

If two devices use the same IPv4 address, connectivity may work intermittently as other hosts learn different MAC-address associations. This commonly occurs when a static address overlaps a DHCP pool or when a reservation is incorrect.

  • Verify that every static address is unique.
  • Review DHCP leases and reservations on the router or DHCP server.
  • Move static assignments outside the dynamic pool or create matching reservations.

Local and Public Addresses Do Not Match

This is usually normal NAT behavior. It can also result from carrier-grade NAT, a VPN, or a proxy. Compare ip addr output with the address reported by the external service and identify which router, gateway, VPN, or ISP device performs translation.

Internet Service Cannot Reach a Private Device

Check that the service listens on the intended LAN address rather than only on 127.0.0.1. Then verify port forwarding, router firewall rules, the host firewall, the public address or DNS record, and whether the ISP uses carrier-grade NAT or blocks inbound traffic. Test from a genuinely external network.

Misconceptions and Limitations

  • An IP address identifies an interface or endpoint in context. It is not necessarily a permanent identity for one person or device.
  • A device can have multiple addresses across multiple interfaces and protocol versions. It can also have several IPv6 addresses on one interface.
  • A home router may hold the public IPv4 address while individual LAN devices have only private addresses.
  • An IP address does not replace DNS names, MAC addresses, ports, or firewall rules. Each serves a different networking purpose.
  • Knowing an address does not automatically grant access. Routing, service listeners, authentication, and firewall policy still control communication.

Quick Review

  1. IP addresses are logical network-layer addresses used to identify source and destination endpoints and route packets.
  2. IPv4 uses 32-bit dotted-decimal addresses; IPv6 uses 128-bit colon-separated hexadecimal addresses.
  3. A subnet mask or CIDR prefix is required to determine local-network membership.
  4. Private IPv4 addresses are for internal networks and are not publicly routed; public IPv4 addresses support Internet connectivity.
  5. NAT commonly lets many private devices share one public IPv4 address.
  6. DHCP supplies addresses and related settings automatically, while static configuration supplies them manually.
  7. Linux administrators can inspect addresses with ip addr, routes with ip route, and NetworkManager details with nmcli.

For a compact visual introduction, see the IP address overview.