Subnet Mask

    . An IP Address consists of two parts namely network ID and host ID.
    . Subnet Mask is what tells what portion of IP Address is used to represent network and what part is for host.
    . Type in ipconfig in the command prompt and we can see the device's IP Address and Subnet Mask.
    . Most of the home networks have Subnet Masks 255.255.255.0


    Subnetting:

          . It is process of breaking a single network into multiple subnetworks.
          . It is used to limit the traffic in the network.
          . Advantage of subnetting is that it reduces complexity to manage large number of addresses in a network.
          . Subnetting is done by network administrators.

      Default Subnet Masks:

          . Class A:  255.0.0.0

          . Class B:  255.255.0.0

          . Class C:  255.255.255.0

      Determining Network and Host portions of IP using Subnet Mask:

          . Consider IP Address 192.168.0.146
          . Subnet Mask is 255.255.255.0
          . Convert both addresses into binary and perform AND on them.

          . 1's in the subnet mask indicates corresponding bits in IP Address is Network ID.
          . 0's in the subnet mask indicates corresponding bits in IP Address is Host ID.
          . This means that, 192.168.0 is Network ID and last portion indicates it is for Hosts in the network.

       Determining number of Hosts from Subnet Mask:

           . Calculate number of zeros in subnet mask. Lets say it x.
           . Perform (2^x)-2.
           . We are subtracting 2 addresses because the first ip address is reserved for network address and the last is for broadcast address.