CCNA online course

What Is an IP Address? IPv4 Addressing Basics

Learn how IPv4 addresses identify network interfaces, how subnet masks divide network and host portions, how DHCP and NAT work, and how to view IP settings in Windows and Linux.

What Is an IP Address?

An IP address is a logical Layer 3 address used by the Internet Protocol to identify a network interface and support communication across IP networks. A network interface can be physical, such as an Ethernet or Wi-Fi adapter, or virtual, such as a VPN or virtual machine adapter.

A device participating in TCP/IP communication needs an appropriate IP configuration on its active interface. That configuration normally includes an IP address, a subnet mask or CIDR prefix length, a default gateway, and DNS server addresses.

IP addressing helps a host determine where to send traffic. Communication with a device on the same local subnet can usually be sent directly through the local network. Communication with a remote subnet or the Internet is sent to a router identified by the default gateway.

For background on how IP fits into networking layers, see the OSI reference model and computer network basics.

IPv4 Address Format

IPv4 is a version of the Internet Protocol that uses 32-bit addresses. An IPv4 address is conventionally written in dotted-decimal notation: four decimal numbers separated by periods.

Each number is an octet, which contains 8 bits. An octet can have a decimal 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

Four octets of 8 bits each give IPv4 its 32-bit size: 8 + 8 + 8 + 8 = 32 bits. The dotted-decimal form is easier for people to read than a 32-bit binary string.

Network and Host Portions

An IPv4 address is interpreted as two logical parts:

  • The network portion identifies the subnet.
  • The host portion identifies an interface within that subnet.

A subnet mask or CIDR prefix length determines where the network portion ends and the host portion begins. CIDR, pronounced “cider,” uses slash notation such as /24 to state how many of the 32 bits belong to the network portion.

Do not assume that the first octet is always the network portion or that the last octet is always the host portion. The prefix length controls the division.

Example: 192.168.0.1/24

A /24 prefix means that 24 bits are network bits and 8 bits are host bits. Its dotted-decimal subnet mask is 255.255.255.0.

Example addressPrefix length or maskNetwork addressHost/interface portionExplanation
192.168.0.1/24 or 255.255.255.0192.168.0.0/241The first 24 bits identify the network; the final 8 bits identify the interface.
192.168.0.10/24 or 255.255.255.0192.168.0.0/2410This interface belongs to the same subnet as 192.168.0.1/24.
192.168.1.10/24 or 255.255.255.0192.168.1.0/2410The different third octet places this interface in a different /24 subnet.

With 192.168.0.1/24, the network address is 192.168.0.0/24. The address 192.168.0.1 is an interface address within that network, not the network address itself.

Same-Subnet and Routed Communication

Consider two interfaces:

Host A: 192.168.0.10/24
Host B: 192.168.0.20/24

Both addresses belong to 192.168.0.0/24, so the hosts are on the same subnet. Their traffic can use the local network directly, typically with Ethernet delivery and address resolution.

Now compare:

Host A: 192.168.0.10/24
Host B: 192.168.1.10/24

These addresses belong to different subnets. Host A sends traffic for Host B to its default gateway, and a router or other Layer 3 device must forward the packet between the networks.

IP Addresses Are Logical Addresses

An IP address is software-configured and can change. For example, a laptop may receive one address on a home network and a different address when it joins a school or office network. Even on the same network, a DHCP lease can expire or be renewed with a different address.

A MAC address is different. It is a Layer 2 interface identifier used for local network delivery, especially on Ethernet. A MAC address and an IP address can both be involved when two devices communicate locally, but they serve different roles:

CharacteristicIP addressMAC address
Primary layerLayer 3, the network layerLayer 2, the data-link layer
PurposeLogical addressing and routing between IP networksLocal interface identification and frame delivery
Typical notationIPv4 dotted decimal, such as 192.168.1.25Hexadecimal pairs, such as 00-1A-2B-3C-4D-5E
Can it change when joining another network?Yes, commonlyUsually remains associated with the interface, although software can change or randomize it

For example, the same laptop can keep its Wi-Fi interface MAC address while receiving a different IPv4 address from a new DHCP server.

How Devices Receive IPv4 Configuration

Static or Manual Configuration

A static IP address is entered manually by an administrator or user. The address, prefix or subnet mask, gateway, and DNS settings are configured directly on the device. Static addressing is useful for infrastructure such as servers, printers, and network devices when a stable address is needed.

Dynamic Configuration Through DHCP

DHCP, the Dynamic Host Configuration Protocol, supplies network settings to clients automatically. A DHCP service can provide an address lease along with the subnet mask or prefix length, default gateway, DNS servers, lease duration, and other options.

MethodConfigured byTypical use caseCan the address change?
Static IP addressManually by an administrator or userServers, routers, printers, and other devices needing predictable settingsNot normally, unless manually changed
DHCPA DHCP serverClient computers, phones, and typical end-user devicesYes; the lease or network may provide a different address

Typical Home-Network Path

In a common home network, a laptop might receive these settings from the home router through DHCP:

IPv4 address:   192.168.1.25
Prefix:         /24
Subnet mask:    255.255.255.0
Default gateway:192.168.1.1
DNS servers:    supplied by the router or ISP

The router has a separate interface facing the ISP. That interface may receive a public IP address from the Internet service provider. The laptop's private address and the router's ISP-facing address are not the same.

Private and Public IPv4 Addresses

A private IPv4 address is intended for internal networks and is not globally routable on the public Internet. The commonly used private ranges defined by RFC 1918 are:

  • 10.0.0.0/8 — 10.0.0.0 through 10.255.255.255
  • 172.16.0.0/12 — 172.16.0.0 through 172.31.255.255
  • 192.168.0.0/16 — 192.168.0.0 through 192.168.255.255

A public IP address is globally routable and can be used on the public Internet, subject to routing and security controls. Private addresses can be reused independently in many homes and offices because Internet routers do not route them globally.

NAT, or Network Address Translation, is commonly performed by a home or office router. NAT translates traffic between internal private addresses and a public address on the router's Internet-facing interface, allowing many private-addressed devices to share Internet connectivity.

Viewing IP Configuration in Windows

Open Command Prompt

  1. Open the Start menu.
  2. Type Command Prompt or cmd.
  3. Open Command Prompt. Administrator privileges are not normally required just to view settings.

Run ipconfig

ipconfig

The output is grouped by adapter. Under the connected Ethernet or Wi-Fi adapter, locate:

  • IPv4 Address — the address assigned to that adapter
  • Subnet Mask — the mask that separates network and host bits
  • Default Gateway — the router used for destinations outside the local subnet
  • DNS Servers — shown in detailed output or in the adapter's configuration information

For more complete information, run:

ipconfig /all

ipconfig /all includes the physical address, DHCP enabled status, DHCP server, lease times, DNS servers, and other adapter details.

Viewing IP Configuration in Linux

Display IPv4 Addresses

Use the modern ip utility:

ip -4 addr

Look for an inet entry beneath the relevant interface. For example:

2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP>
    inet 192.168.1.25/24 brd 192.168.1.255 scope global enp3s0

The value 192.168.1.25/24 is the interface's IPv4 address and prefix length. The interface name might be enp3s0, eth0, wlan0, or another distribution-specific name.

To display both IPv4 and IPv6 addresses, use:

ip addr

Find the Default Gateway

Use:

ip route

Look for a route beginning with default via:

default via 192.168.1.1 dev enp3s0

This indicates that 192.168.1.1 is the default gateway and that traffic uses interface enp3s0.

ifconfig is a legacy utility. It may still work when the legacy net-tools package is installed, but it may be unavailable on modern Linux systems. Prefer ip addr and ip route.

IPv4 and IPv6

The term IP address can refer to either IPv4 or IPv6. IPv6 is the newer IP version and uses 128-bit addresses written as colon-separated hexadecimal groups, for example 2001:db8::10.

This lesson focuses on IPv4, whose 32-bit dotted-decimal format is common in introductory networking. Modern networks may use dual-stack operation, in which an interface has both an IPv4 address and an IPv6 address and can use either protocol.

Troubleshooting Common IP-Address Problems

No IPv4 Address Appears

Possible causes include a disconnected or disabled adapter, a failed DHCP exchange, or viewing the wrong adapter.

  • Identify the active Ethernet or Wi-Fi interface.
  • Confirm that the cable or wireless connection is working.
  • Use detailed output such as ipconfig /all on Windows to review DHCP status.
  • On Linux, compare ip -4 addr with ip route to identify the interface in use.

A Windows Host Has a 169.254.x.x Address

An address in 169.254.0.0/16 is commonly an automatic link-local address. It often indicates that DHCP was unavailable or that the host did not obtain a lease.

  • Check connectivity to the router or DHCP server.
  • Confirm that the host is connected to the intended VLAN or wireless network.
  • Review DHCP information and renew or troubleshoot the lease as appropriate.

Local Devices Work, but Internet Access Fails

If local communication works but remote destinations do not, check the default gateway first. The gateway must be reachable and must belong to the local subnet.

  • Verify the configured default gateway.
  • Check the router's upstream or ISP connectivity.
  • Test an IP destination separately from a DNS name. If an IP destination works but a name does not, investigate DNS.

Multiple Addresses Are Listed

Multiple entries are normal when a system has VPN software, virtual machines, containers, loopback interfaces, or more than one active network connection.

  • Match the address to the interface currently carrying traffic.
  • Use ip route on Linux to identify the interface with the default route.
  • On Windows, compare the adapter name and connection status in ipconfig /all.
  • Recognize that loopback and virtual adapters are not necessarily the path to the local network or Internet.

Key Points

  • An IP address is a logical Layer 3 address assigned to a network interface for IP communication.
  • IPv4 uses 32 bits, written as four decimal octets from 0 through 255.
  • The subnet mask or CIDR prefix length determines the network and host portions.
  • Interfaces on the same subnet can communicate locally; remote-subnet traffic normally uses a default gateway.
  • DHCP assigns settings dynamically, while static addressing is configured manually.
  • Private IPv4 addresses are used internally and commonly reach the Internet through router NAT.
  • Use ipconfig or ipconfig /all on Windows, and ip -4 addr plus ip route on Linux.
  • IP addresses and MAC addresses have different roles: IP supports logical addressing and routing, while MAC addresses support local Layer 2 delivery.