The word subnetwork (usually shortened to subnet) has two related meanings. In the older and more general meaning, it meant one physical network of an internetwork. In the Internet Protocol (IP), a subnetwork is a division of a classful network. The rest of this article is about the second meaning.
Subnetting an IP network allows a single large network to be broken down into what appear (logically) to be several smaller ones. It was originally introduced before the introduction of classful network numbers in IPv4, to allow a single site to have a number of local area networks. Even after the introduction of classful network numbers, subnetting continued to be useful, as it reduced the number of entries in the Internet-wide routing table (by hiding information about all the individual subnets inside a site). As a side benefit, it also resulted in reduced network overhead, by dividing the parts which receive IP broadcasts.
A network mask, also known as a subnet mask, netmask or address mask, is a bitmask used to tell how many bits in an octet(s) identify the subnetwork, and how many bits provide room for host addresses. They are typically used to determine whether to send a packet to the MAC address of the default gateway (for packets with destinations outside the subnet) or of the actual machine (for inside the subnet), as determined by ARP.
Subnet masks are usually represented in the same representation used for addresses themselves; in IPv4, dotted decimal notation, four numbers from zero to 255 separated by periods, e.g. 255.128.0.0. Since the mask consists of only a series of all ones followed by all zeroes, only those numbers representing such sequences are allowed: 0, 128, 192, 224, 240, 248, 252, 254, and 255.
(From Wikipedia, the free encyclopedia)