VMware ESXi and vSphere Cluster Management

What Is an IP Address? IPv4 Basics and How to Find Your Address

Learn what an IP address does, how IPv4, subnet masks, gateways, DHCP, NAT, and MAC addresses work, and how to find local IP settings in Windows and Linux.

An IP address is a logical network-layer address used by Internet Protocol (IP) to identify a network interface and help deliver packets to it. A computer, phone, printer, or virtual machine needs a usable IP configuration to communicate on a TCP/IP network and typically to reach the internet.

IP addresses normally belong to network interfaces, not permanently to an entire device. For example, a laptop with Wi-Fi, Ethernet, a VPN, and virtual adapters can have several interfaces and several IP addresses at the same time.

IPv4 Address Format

IPv4 is the widely deployed fourth version of Internet Protocol. It uses a 32-bit address. A 32-bit IPv4 address is usually written in dotted-decimal notation: four decimal sections called octets, separated by periods.

Each octet contains 8 bits and has a value from 0 through 255. For example:

192.168.0.1
  • 192 is the first octet.
  • 168 is the second octet.
  • 0 is the third octet.
  • 1 is the fourth octet.

These four octets represent 32 bits in total: 4 × 8 bits. The address itself is an individual interface address. It is not correct to assume that the first fixed number of octets is always the network portion. The network and host portions are determined by a subnet mask or CIDR prefix length.

Network and Host Portions

A subnet mask identifies which bits of an IPv4 address represent the network and which bits represent the host or interface. The same information can be written using a CIDR prefix length, such as /24. The number after the slash tells you how many leading bits form the network prefix.

Consider this address:

192.168.0.1/24

With a /24 prefix, the first 24 bits identify the subnet and the remaining 8 bits identify an address within that subnet.

  • Network: 192.168.0.0/24
  • Interface address: 192.168.0.1
  • Equivalent subnet mask: 255.255.255.0

In a typical home network, a router might use 192.168.0.1 as its local address and default gateway, while a laptop might use 192.168.0.25. Both addresses belong to the 192.168.0.0/24 subnet.

Example valueMeaningPurpose
192.168.0.1Individual IPv4 interface addressIdentifies one interface on the subnet
/24 or 255.255.255.0CIDR prefix length or subnet maskSeparates network bits from host bits
192.168.0.0/24Network address and prefixRepresents the subnet
192.168.0.1 as default gatewayLocal router addressForwards traffic to remote networks

The default gateway is usually the local router. When a host needs to send traffic outside its own subnet, it sends the traffic to the gateway, which forwards it toward the destination.

IP Addresses and MAC Addresses

An IP address and a MAC address serve different purposes.

CharacteristicIP addressMAC address
Network layerNetwork layer, used by IP routingLink layer, used on Ethernet or Wi-Fi
Address typeLogical and configurableLink-layer identifier associated with an interface
How it is assignedManually, by DHCP, or by another network configuration methodUsually supplied by the interface manufacturer or virtualization system
Whether it can changeCan change with configuration or DHCP lease renewalCan sometimes be administratively changed or virtualized
Primary communication scopeIdentifies IP endpoints across interconnected networksSupports delivery on the local Ethernet or Wi-Fi link

On a local network, Ethernet or Wi-Fi frames use MAC addresses for local delivery. IP addresses identify the source and destination endpoints, even when traffic must cross several routers. Address-resolution mechanisms connect these layers when a host needs to deliver an IP packet on its local link.

How IP Addresses Are Assigned

Static or manual configuration

A static IP address is configured manually or persistently reserved for a device. Static settings can be useful for servers, printers, routers, and other devices that should have a predictable address. The configuration normally includes an IP address, subnet mask or prefix, default gateway, and DNS servers.

Dynamic configuration with DHCP

DHCP, or Dynamic Host Configuration Protocol, automatically provides clients with network settings. A DHCP server can supply an address, subnet mask, default gateway, DNS servers, and a lease duration.

Unless a reservation or static configuration is used, an address may change when a DHCP lease is renewed or when the device joins a different network.

Typical home-network arrangement

In a home network, the router commonly receives a public-facing address from the Internet service provider. Its DHCP service assigns private addresses to local devices such as laptops and phones. A laptop uses the router as its default gateway, and the router forwards traffic to the internet.

Private and Public IPv4 Addresses

Private IPv4 addresses are reserved for internal networks. They are not globally routed across the public internet.

CIDR rangeAddress rangeTypical use
10.0.0.0/810.0.0.010.255.255.255Large private networks and enterprise environments
172.16.0.0/12172.16.0.0172.31.255.255Private organizational networks
192.168.0.0/16192.168.0.0192.168.255.255Home and small-office networks

A public IP address is globally routable and can be used on the public internet. A local operating-system command often shows a private LAN address such as 192.168.0.25, not the public address visible to internet services.

NAT, or Network Address Translation, is commonly used by a home router to translate traffic from many private local addresses to one public IPv4 address. This allows multiple devices to share the router's public internet connection.

Finding an IP Address in Windows

  1. Open Command Prompt or Windows Terminal.
  2. Run ipconfig.
  3. Find the adapter currently connected through Wi-Fi or Ethernet.
  4. Read its IPv4 Address, Subnet Mask, and Default Gateway fields.
C:\> ipconfig

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

Use ipconfig /all for additional information, including DHCP status, DNS servers, lease details, and the physical address (MAC address).

Windows may list loopback, virtual, VPN, Bluetooth, disconnected, and unused adapters. Do not automatically choose the first address shown. The active adapter is normally connected to the network you are using and has an appropriate default gateway.

Finding an IP Address in Linux

The preferred modern command is ip addr, also written as ip address. To show only IPv4 addresses, use:

$ ip addr
$ ip -4 addr

Look for an inet entry on the active interface. Common interface names include eth0, enp0s3, and wlan0.

2: enp0s3: <UP,LOWER_UP> ...
    inet 192.168.0.25/24 ...

1: lo: <LOOPBACK,UP> ...
    inet 127.0.0.1/8 ...

The 192.168.0.25/24 entry is a representative LAN address. The 127.0.0.1/8 entry belongs to the loopback interface, named lo. A loopback address lets a host communicate with itself; it is not the address used to reach that host from the LAN.

Run ip route to identify the default route and gateway:

$ ip route
default via 192.168.0.1 dev enp0s3

ifconfig is a legacy method for viewing interface configuration. It may not be installed by default because it is provided by older net-tools packages on many Linux distributions. Prefer ip addr unless an older environment specifically requires ifconfig.

Operating systemCommandWhat to look forNotes
WindowsipconfigIPv4 Address, Subnet Mask, Default GatewayInspect the connected Wi-Fi or Ethernet adapter
Linuxip addr or ip -4 addrinet on the active interfaceIgnore lo when looking for the LAN address
Legacy LinuxifconfigAddress information for an interfaceMay require legacy net-tools; use ip addr when possible

IPv4 and IPv6

In introductory networking discussions, “IP address” often means IPv4. However, IPv4 and IPv6 are both in use. IPv6 uses 128-bit addresses and commonly displays them as hexadecimal groups separated by colons.

2001:db8::1

Modern hosts may use IPv4 and IPv6 simultaneously. An operating system can therefore show both an IPv4 address and one or more IPv6 addresses for the same interface.

Common Troubleshooting Situations

An address starts with 127

An address such as 127.0.0.1 is a loopback address. You probably inspected the loopback interface instead of the active Ethernet or Wi-Fi interface. Find the connected interface and use its non-loopback IPv4 entry.

Several adapters or addresses appear

Multiple entries can be normal when a computer has virtual adapters, VPN software, Bluetooth networking, multiple physical interfaces, or both IPv4 and IPv6. Choose the interface connected to the current network and associated with the appropriate default gateway.

The local address differs from an internet-facing address

An address such as 192.168.x.x is private. A router may translate it with NAT, so an internet service sees the router's public address instead. The two addresses describe different points in the connection.

Linux says “ifconfig: command not found”

Use ip addr, which is the preferred current command. Install legacy tools only when an older script or environment specifically depends on them.

The device has an address but cannot reach the internet

An IP address alone does not guarantee connectivity. Check the address and subnet mask or prefix, the default gateway, the default route, DNS settings, and upstream connectivity. A missing gateway, incorrect mask, DNS failure, or router problem can prevent internet access.

Exam-Relevant Summary

  • IPv4 addresses are 32 bits, written as four decimal octets from 0 through 255.
  • A subnet mask or CIDR prefix length determines the network and host portions; no fixed number of octets is always the network portion.
  • A network address represents a subnet, while a host address identifies an individual interface within that subnet.
  • The default gateway is normally the local router used to reach remote networks.
  • IP is a logical, routable addressing system; MAC addresses operate at the local link layer.
  • DHCP assigns settings dynamically, while static configuration or reservations provide predictable addresses.
  • Private ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16.
  • NAT commonly lets many private devices share one public IPv4 address.
  • Use ipconfig or ipconfig /all on Windows and ip addr or ip -4 addr on Linux.
  • 127.0.0.1 is IPv4 loopback, not the device's LAN address.
  • IPv6 uses 128-bit colon-separated hexadecimal addresses, and a host may use IPv4 and IPv6 at the same time.

For a concise refresher, see What Is an IP Address?.