VMware ESXi and vSphere Cluster Management

IPv4 Addresses: Purpose, Format, Assignment, and Identification

Learn what IPv4 addresses are, how 32-bit addresses use octets, how subnet masks separate networks and hosts, and how to find addresses on Windows and Linux.

An IPv4 address is a logical network-layer identifier used by a device or, more precisely, a network interface when communicating with other devices over an IP network. IPv4 is the fourth version of the Internet Protocol and remains widely used in homes, offices, data centers, and the public Internet.

An interface participating in TCP/IP communication needs an IP address on the relevant network. IP addresses let network traffic identify a source and a destination. Routers examine these addresses to decide where packets should be forwarded.

IPv4 Address Size and Format

IPv4 addresses contain 32 bits. A bit can have a value of 0 or 1. IPv4 divides these 32 bits into four groups of 8 bits. Each 8-bit group is called an octet.

The usual display form is dotted-decimal notation: four decimal values separated by periods. Each octet can represent a value from 0 through 255.

192.168.0.1

The example contains four octets:

  • 192 — first octet
  • 168 — second octet
  • 0 — third octet
  • 1 — fourth octet

Those four octets together represent one 32-bit IPv4 value. A value such as 256 is not valid inside an IPv4 octet because an 8-bit value has a maximum decimal value of 255.

Network and Host Portions

An IPv4 address is interpreted as two related parts: a network portion, which identifies a subnet, and a host portion, which identifies an interface within that subnet. The dividing line is defined by a subnet mask or a CIDR prefix length.

CIDR, or Classless Inter-Domain Routing, writes the number of network bits after a slash. For example, /24 means that the first 24 of the 32 bits are network-prefix bits, leaving 8 host bits.

Host address:   192.168.0.1/24
Subnet mask:    255.255.255.0
Network:        192.168.0.0
Host portion:   .1

With this particular mask, 192.168.0.0 is the network address and 192.168.0.1 is an example host address on that network. The final octet appears to be the host portion only because /24 places the boundary after the first three octets. A different prefix length can place the boundary elsewhere.

ComponentExampleMeaning
IPv4 address192.168.0.1An address assigned to an interface
CIDR prefix/24The first 24 bits identify the network prefix
Subnet mask255.255.255.0Shows which bits are network bits and which are host bits
Network address192.168.0.0Represents the subnet rather than one individual host
Example host address192.168.0.1Identifies an interface within that subnet

IP Addresses and MAC Addresses

An IP address and a MAC address serve different purposes. An IP address is a logical address used by the Internet Protocol for communication and routing. A MAC address is a link-layer, hardware-oriented identifier associated with a network interface.

CharacteristicIP AddressMAC Address
Network layer roleUsed by IP to address and route packets between networksUsed for delivery on the local network link
Type of identityLogical network identityLink-layer interface identity
Assignment or configurationConfigured manually or supplied by DHCP and other softwareTypically provided by network hardware or firmware, though software changes or overrides may be possible
Can it change?Yes; it commonly changes when an interface joins another network or receives a new leaseIt is often stable for an interface, but it is not correct to assume it is always permanently unchangeable
Where it is usedIP communication across local and routed networksCommunication on the local link

In a typical local network, IP routing determines the next network destination, while local-link protocols use MAC addresses to deliver a frame to the next device on that link.

How IPv4 Addresses Are Assigned

Static Configuration

A static IP address is configured manually or reserved for stable use. Static configuration can be useful for servers, printers, routers, and other systems that should remain reachable at a predictable address. The configuration normally includes an IP address, subnet mask or prefix, and often a default gateway and DNS settings.

Dynamic Configuration with DHCP

DHCP, the Dynamic Host Configuration Protocol, automatically supplies network settings. A DHCP server commonly provides an IPv4 address, subnet mask, default gateway, and DNS server information. The address is usually assigned as a lease, so it can change when the lease expires, is renewed, or the device joins a different network.

Typical Home or Office Flow

  1. A router connects the local network to an ISP or another upstream network.
  2. The router runs a DHCP service for local devices.
  3. A laptop joins Wi-Fi or Ethernet and requests network configuration.
  4. The router gives the laptop a private address such as 192.168.0.25.
  5. The laptop sends traffic through the router, which forwards it toward the Internet.

The router and the laptop do not normally have the same role or address. The laptop has a private local address, while the router has a public-facing address or an upstream address supplied by the ISP.

Private and Public IPv4 Addresses

A private IP address comes from a range reserved for internal networks. Private addresses can be reused independently in many homes and offices. They are not directly routable across the public Internet.

CIDR RangeAddress RangeTypical Use
10.0.0.0/810.0.0.0 through 10.255.255.255Large private networks
172.16.0.0/12172.16.0.0 through 172.31.255.255Private office and enterprise networks
192.168.0.0/16192.168.0.0 through 192.168.255.255Home and small-office networks

192.168.0.1 is a commonly used private local address, often assigned to a router or another local interface. Its exact use depends on the network configuration.

A public IP address is routable on the Internet and is typically assigned to a customer network by an ISP or another provider. The common mechanism that lets many private devices share one public IPv4 address is NAT, or Network Address Translation. The router translates traffic from private local addresses to its public-facing address and tracks the connections so replies can return to the correct local device.

Finding an IPv4 Address on Windows

Open a command-line environment by opening Command Prompt or PowerShell. Then run:

ipconfig

Find the adapter that is currently connected, such as a Wi-Fi or Ethernet adapter. Read its lines for IPv4 Address, Subnet Mask, and Default Gateway.

Wireless LAN adapter Wi-Fi:
   IPv4 Address. . . . . . . . . . . : 192.168.0.25
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . .  : 192.168.0.1

Windows may show several adapters. Wi-Fi, Ethernet, VPN connections, virtual machines, containers, and other software can each have separate addresses. The relevant address depends on the connection being used.

Finding an IPv4 Address on Linux

On current Linux systems, use the ip command:

ip addr

Locate the active interface, which might be named eth0, enp0s3, or wlan0, among other names. Under that interface, look for an inet entry such as:

inet 192.168.0.25/24

The value before the slash is the IPv4 address, and the value after the slash is the CIDR prefix length.

ifconfig is a legacy command that may still be available on some systems:

ifconfig

It may show the IPv4 value under a field named inet or inet addr, depending on the version. Modern Linux distributions may not install the legacy net-tools package by default, so ip addr is the preferred command. Output formats differ between tools and distributions.

Operating SystemCommandWhat to FindNotes
WindowsipconfigIPv4 Address, subnet mask, and default gatewayRun in Command Prompt or PowerShell
Linuxip addrAn inet entry under the active interfaceCurrent standard command
Linux legacyifconfigAn IPv4 field such as inet or inet addrMay require the legacy net-tools package

Troubleshooting Address Lookup

Several IPv4 Addresses Appear

This usually means the computer has multiple active or virtual interfaces. Check the adapter type and status, and identify which interface has the default gateway for the connection you want to use. A VPN or virtual adapter may also have a valid address without being the path used for ordinary local traffic.

No IPv4 Address Appears

The interface may be disconnected, disabled, waiting for a DHCP lease, or configured only for IPv6. Check the cable or Wi-Fi connection, verify that the adapter is enabled, and inspect or renew its DHCP configuration.

ifconfig Is Not Found

Use ip addr instead. The legacy utility may not be installed on a modern Linux distribution. Install legacy tools only when a particular environment or exercise requires them.

The Address Is Private, but an Internet Address Was Expected

An address beginning with 192.168, 10, or 172.16 through 172.31 is likely a private LAN address. The router commonly owns the public address and uses NAT for outbound traffic.

The Final Octet Was Assumed to Be the Host

The final octet is not automatically the host portion. For example, with a /24 prefix, the final octet is host-related, but another prefix may divide the bits differently. Always use the subnet mask or CIDR prefix to identify the boundary.

IPv4 and IPv6

In introductory networking, the phrase IP address often informally means an IPv4 address. However, IP includes multiple versions. IPv6 is a newer version that uses 128-bit addresses rather than IPv4's 32-bit addresses.

IPv4 uses dotted-decimal notation such as 192.168.0.25. IPv6 uses a different hexadecimal notation, such as an address containing groups separated by colons. IPv4 and IPv6 can coexist on the same device and network; a device may have an IPv4 address, an IPv6 address, or both.

Key Points

  • IPv4 is a 32-bit network-layer addressing system.
  • Its four 8-bit octets are normally displayed as four decimal values from 0 through 255.
  • A subnet mask or CIDR prefix determines the network and host portions.
  • IP addresses are logical and can change; MAC addresses operate at the local-link layer and identify interfaces in a different way.
  • Addresses may be manually configured or assigned dynamically through DHCP.
  • Private addresses are used inside local networks, while public addresses are Internet-routable.
  • NAT commonly allows multiple private devices to share one public IPv4 address.
  • Use ipconfig on Windows and ip addr on Linux to inspect local interface addresses.