Please Read: Significant Update Planned, Migrating Forum Software This Month

See more
See less

Subnet masking

  • Filter
  • Time
  • Show
Clear All
new posts

  • Subnet masking

    Subnet masking, or subnetting, is used to break one large group into several smaller subnetworks. These subnets can then be distributed throughout an enterprise. This results in less IP address waste and better logical organization. Formalized with RFC 950 in 1985, subnetting introduced a third level of hierarchy to the IPv4 addressing structure. The number of bits available to the network, subnet, and host portions of a given address varies depending on the size of the subnet mask.
    A subnet mask is a 32-bit number that acts as a counterpart to the IP address. Each bit in the mask corresponds to its counterpart bit in the IP address. Logical anding is applied to the address and mask. If a bit in the IP address corresponds to a 1 bit in the subnet mask, the IP address bit represents a network number. If a bit in the IP address corresponds to a 0 bit in the subnet mask, the IP address bit represents a host number.

    When the subnet mask is known, it overrides the address class to determine whether a bit is either a network or a host. This allows routers to recognize addresses differently than the format dictated by class. The mask can be used to tell hosts that though their addresses are Class B, the first three octets, instead of the first two, are the network number. In this case, the additional octet acts like part of the network number, but only inside the organization where the mask is configured.

    The subnet mask applied to an address ultimately determines the network and host portions of an IP address. The network and host portions change when the subnet mask changes. If a 16-bit mask,, is applied to an IP address only the first 16 bits, or two octets, of the IP address represent the network number. Therefore, the network number for this host address is The green shaded portion of the address in Figure indicates the network number.

    Because the rules of class dictate that the first two octets of a Class B address are the network number, this 16-bit mask does not create subnets within the network.

    To create subnets with this Class B address, a mask must be used that identifies bits in the third or fourth octet as part of the network number.

    If a 24-bit mask such as is applied, then the first 24 bits of the IP address are specified as the network number. The network number for the host in this example is The shaded portion of the address in Figure indicates this.

    Routers and hosts configured with this mask will see all eight bits in the third octet as part of the network number. These eight bits are considered to be the subnet field because they represent network bits beyond the two octets prescribed by classful addressing.

    Inside this network, devices configured with a 24-bit mask will use the eight bits of the third octet to determine what subnet a host belongs. Because eight bits remain in the host field, 254 hosts may populate each network. Just as hosts must have identical network addresses, hosts must also match subnet fields to communicate with each other directly. Otherwise, the services of a router must be used so that a host on one network or subnet can talk to a host on another.

    For a Class B or Class C address, an 8-bit subnet field creates 28, or 256, potential subnets. Because eight bits remain in the host field, 254 hosts may populate each network. Two host addresses are reserved as the network number and broadcast address, respectively. By dividing a Class B network into smaller logical groups, the internetwork can be made more manageable, more efficient, and more scalable.

    Notice that subnet masks are not sent as part of an IP packet header. This means that routers outside of this network will not know what subnet mask is configured inside the network. An outside router will therefore treat as just one of sixty-five thousand hosts that belong to the network. In effect, subnetting classful IP addresses provides a logical structure that is hidden from the outside world.


  • #2
    Re: Subnet masking

    Thanks again Ozgur.
    CCNP 1: Advanced Routing Companion Guide sure is a great book, eh?