How a Mask Finds the Network Address

An IPv4 address is a 32-bit number, usually written as four decimal numbers. A subnet mask is another 32-bit number: its leading 1 bits mark the network portion, and its remaining 0 bits mark the device portion. A computer compares the address and mask bit by bit; this operation, called a bitwise AND, leaves the network address.

For example, with `192.168.1.42/24`, the `/24` means the first 24 bits identify the network. The equivalent mask is `255.255.255.0`, so the network address is `192.168.1.0`; the final number distinguishes the device within that subnet.

Why the Boundary Changes Traffic

When a computer needs to contact another IP address, it applies its mask to both addresses. If the resulting network addresses match, it treats the destination as local and tries to reach it directly on the local link. If they differ, it sends the traffic to a router, which can forward it toward another network.

That boundary gives administrators a way to organize a larger address space into smaller subnets. But a mask alone does not block communication: routers and their configuration determine whether traffic can pass between subnets, and additional rules may be needed for security. The practical consequence is that changing a mask can alter whether a device tries to find a destination nearby or hands the job to a router.