|
|
A network mask, or ``netmask'', is used to divide an IP address into a network address and a host address. When you set up a network, the network mask must be common to all network interfaces on that network. The default network masks are 255.0.0.0 for class A, 255.255.0.0 for class B, and 255.255.255.0 for class C networks, as illustrated here:

Subnets are created by extending the network ID portion of an address by taking some bits from the host portion to create a subnet portion. The remaining bits can be used for host addresses within the subnet. The number of subnets that can be created from an m-bits long subnet address is 2^m. The number of host addresses per subnet that are available from an n-bits long host address is (2^n)-2. Unlike the subnet portion of the network address, the host portion cannot consist of all 0's or 1's. See RFC 1812 and RFC 1878 for more information.
``Subnetting a class B network'' illustrates the effect on a class B address of extending a network mask from 255.255.0.0 to 255.255.255.0:

Subnetting a class B network
This scheme creates 256 (2^8) possible subnet addresses (0 through 255) with 254 (2^8-2) host addresses (1 through 254) per subnet. In this way, you can create subnets for class A and B networks by converting the second and third octets, respectively, from host addresses to subnet addresses. Notice how the netmask changes accordingly:

The class A network 16 can now have up to 256 subnets (16.0 through 16.255). The class B network 172.16 can also have up to 256 subnets (172.16.0 through 172.16.255). While the netmask masks the network portion of the address, the broadcast address exposes the network address and hides the host portion. For example, the broadcast address for the subnet 172.16.246, with a netmask of 255.255.255.0, is 172.16.246.255.
For more information on setting netmask and broadcast addresses using the Network Configuration Manager, see ``Basic TCP/IP configuration parameters''.
For example, if an organization has a class B network, you could assign each physical network in that network a subnet number within that network. The sixteen bits for the host ID could be allocated as eight for subnet and eight for host, or nine for subnet and seven for host, and so on. Your decision would be transparent to everyone outside that organization.
A common example of subnetworking is to apply a class C type subnet mask (255.255.255.0) to a class B network. Applying this mask to a class B network provides you with 256 possible subnets, each one of which can accommodate 254 possible hosts (the host addresses 0 and 255 are not acceptable). If you know that none of your subnets will ever have more than 126 hosts but you need more than 256 but less than 513 subnets, you could decide to use nine bits for the subnet number, and seven bits for the host addresses. The appropriate mask for this would be 255.255.255.128.
Given this scheme and a network address of, for example, 131.60, the addresses of the first and last hosts on the first subnet (131.60.0.0) would be 131.60.0.1 and 131.60.0.126. The broadcast address on this subnet would be 131.60.0.127.
Partitioning a class C address is a similar process as you must take a portion of the fourth octet as the subnet address. For example, you might partition the first three (high order) bits of the fourth octet to represent the subnet, with the last five bits representing the host:

This scheme allows for up to 8 subnets of 30 hosts each, for a total of 240 hosts. The netmask for the hosts on these subnets is 255.255.255.224. The number 224 is a decimal representation of the binary octet 11100000, which masks the subnet portion of the IP address.
Possible subnets for the class C network 221.138.62.0, with associated broadcast addresses, are:
| Subnet | Hosts | Broadcast address |
|---|---|---|
| 221.138.62.0 | .1-.30 | 221.138.62.31 |
| 221.138.62.32 | .33-.62 | 221.138.62.63 |
| 221.138.62.64 | .65-.94 | 221.138.62.95 |
| 221.138.62.96 | .97-.126 | 221.138.62.127 |
| 221.138.62.128 | .129-.158 | 221.138.62.159 |
| 221.138.62.160 | .161-.190 | 221.138.62.191 |
| 221.138.62.192 | .193-.222 | 221.138.62.223 |
| 221.138.62.224 | .225-.254 | 221.138.62.255 |