Subnet mask
Subnet addressing extends the IP address scheme and allows a site to use a single network ID for multiple physical networks.
Routing outside of the site continues by dividing the IP address into a network ID and a host ID based on the class. Within the site, the subnet mask divides the IP address into a custom network ID portion and a host ID portion. For example, you can add another physical network when using the Class B network Network 2. Selecting the following subnet mask will add two additional network ID bits, allowing for four physical networks:
11111111 11111111 11000000 00000000 = 255.255.192.0
In the example, two bits of the Class B host ID are used to extend the network ID. Each unique combination of bits that constitute the host ID where the subnet mask bits are 1 specifies a different physical network, as illustrated in the following figure.
Subnet mask example

A second network with hosts D and E are added. Gateway G2 connects Network 2.1 with Network 2.2, through which D and E can communicate with hosts not on Network 2.2. B and C use the gateway G to communicate with hosts not on Network 2.1. When B is communicating with D, B's configured gateway G will route the data from B to D through G2.
Provide Feedback