5 IPv4 Addressing Fundamentals
Learn how IPv4 addresses, subnet prefixes, private address ranges, and default gateways determine local and external network communication.
IPv4 addresses and interfaces
An is a 32-bit number usually written as four decimal octets separated by periods. Each octet ranges from 0 to 255; 192.168.1.34 is one example. An address identifies an interface on an IP network, not necessarily an entire device, since a device may have multiple interfaces.
Subnet masks and prefixes
An has a and a . A marks the division: bits set to 1 identify the , while bits set to 0 identify the . notation gives the number of network bits. For example, /24 corresponds to 255.255.255.0.
Modern IPv4 uses classless prefixes, so the mask cannot be inferred from the address alone. Both the address and its prefix are needed to determine the subnet boundaries; those boundaries do not have to fall on familiar octet boundaries.
Example: 192.168.1.34/24
With a /24 prefix, the first 24 bits—the first three octets—are the , and the remaining 8 bits are the . The subnet is 192.168.1.0/24. On a typical LAN subnet, .0 is the , .255 is the , and addresses from 192.168.1.1 through 192.168.1.254 are available for interfaces.
A /26 prefix corresponds to 255.255.255.192 and divides a /24 into four smaller subnets.
Private IPv4 ranges
Three IPv4 blocks are reserved for private networks:
10.0.0.0/8, covering10.0.0.0to10.255.255.255.172.16.0.0/12, covering172.16.0.0to172.31.255.255.192.168.0.0/16, covering192.168.0.0to192.168.255.255.
Organizations and home networks can use these addresses internally, and different networks may reuse them. Because private addresses are not globally unique, they are not routed across the public Internet. A router commonly uses to provide Internet access for devices using private addresses. Private addressing itself is not a security measure.
Local traffic and default gateways
A host uses its address and to decide whether a destination is on a directly connected network. If it is, the host sends traffic directly to that destination. If the destination is outside the local subnet and no more specific route applies, the host sends traffic to its , typically a router interface on the same subnet. The gateway forwards the traffic toward its destination.
For example, a computer configured as 192.168.1.34/24 might use 192.168.1.1 as its . It can send traffic directly to 192.168.1.50, which is on the same /24; traffic for an Internet address is sent to the gateway instead. A wrong or an unreachable gateway can prevent communication beyond the local network.