A router is necessary for devices on different networks to communicate. Devices on a network use the router interface attached to their LAN as their default gateway. Traffic that is destined for a device on a remote network will be processed by the router and forwarded toward the destination. To determine if traffic is local or remote, the router uses the subnet mask.

In a subnetted network space, this works exactly the same way. As shown in the figure, subnetting creates multiple logical networks from a single address block or network address. Each subnet is treated as a separate network space. Devices on the same subnet must use an address, subnet mask, and default gateway that correlates to the subnet that they are a part of.

Traffic cannot be forwarded between subnets without the use of a router. Every interface on the router must have an IPv4 host address that belongs to the network or subnet to which the router interface is connected.