Subnetting divides an IP network into smaller subnetworks called subnets, distinguishing the network and subnet portions. A subnet mask determines which part of the IP address belongs to the network and which part belongs to the host, defining the boundaries between the network, subnet, and host portions.