The classic IP address was based on the hierarchical address scheme. It was based on a two- level hierarchy, where the IP address is divided into the network address and the host address. Later, with the introduction of Classless Interdomain Routing( CIDR), the separation between network address and host address was removed.
Gateways use only the network address until the data packet reaches a gateway that can deliver it directly. If still branching into a subnet, there are further levels of Hierarchical Routing using the subnet mask.