Note: The subnet ID does not have to be identified by contiguous bits in the host
ID portion of the internet address. The subnet ID can be identified by using
noncontiguous bits in the host ID portion of the internet address. It is strongly
recommended to use contiguous bits to identify the subnet ID.
Assume, for example, two networks where subnetting is used: subnetwork 9.4.70
and subnetwork 9.4.73.192. The first byte of the internet address is 9, which makes
it a class Anetwork. 9.4.70 is an example of a network where two complete bytes
of the host ID have been used for the subnet ID. 9.4.73.192 is an example where
two complete bytes and part of a third byte of the host ID have been used for the
subnet ID. For 9.4.70, the range of host IDs available is 9.4.70.1 through
9.4.70.254. For 9.4.73.192, the range of host IDs available is 9.4.73.193 through
9.4.73.254.
A subnet mask is used to distinguish between a subnet ID and a host ID. Bits in the
subnet mask are set to 1 if the network treats the corresponding bit in the internet
address as part of the network ID and subnet ID and to 0 if it treats the bit as part
of the host ID. For example, a subnet mask of:
Subnet mask = 11111111 11111111 11111111 00000000
specifies that the first three bytes identify the subnetwork and the fourth byte
identifies the host. Remember that the network portion of the internet address is
based on the class of internet address (A, B, C, D or E). The subnet mask must at
a minimum mask off the network portion of the address. In this case, because we
are discussing a class Aaddress, the first byte must be all 1s. A subnet mask would
normally be specified in the same dotted decimal notation as an internet address.
Because the second and third bytes are being used to identify the subnet ID, those
two bytes should also be all 1s. Thus, in this example, the subnet mask is
255.255.255.0. If an internet address of 9.4.70.254 is compared against the subnet
mask:
Subnet mask = 11111111 11111111 11111111 00000000
Internet address = 00001001 00000100 01000110 11111110
(logical and) -------- -------- -------- --------
Subnetwork = 00001001 00000100 01000110 00000000
the subnetwork is 9.4.70 and the host ID is 254.
In the second example, the subnet mask for subnetwork 9.4.70 is 255.255.255.0.
The subnet mask for subnetwork 9.4.73.192 is 255.255.255.192. This is an example
of a subnetwork where part of a host ID byte has been used for the subnet ID. In
this case, the upper 2 bits of the fourth byte are used as part of the subnet ID. In bit
form, the subnet mask is:
Subnet mask = 11111111 11111111 11111111 11000000
This means that the first 3 bytes and the first 2 bits of the fourth byte identify the
subnetwork, and the last 6 bits of the fourth byte identify the host. If an internet
address of 9.4.73.212 is compared against the above subnet mask:
Subnet mask = 11111111 11111111 11111111 11000000
Internet address = 00001001 00000100 01001001 11010100
(logical and) -------- -------- -------- --------
Subnetwork = 00001001 00000100 01001001 11000000
The subnetwork is 9.4.73.192 and the host ID is 20.
It is also possible to have a subnet mask where the network ID part is not
contiguous. For example:
Chapter1. TCP/IP on AS/400 7