Subnet Masks
A subnet mask allows you to identify which part of an IP address is reserved for the network, and which part is available for host use. By looking at the IP address alone you can’t tell which part of the address is which.The subnet mask (or netmask) gives you all that information to calculate whether IP addresses are on the same subnet, or not.
Using a subnet mask to determine the network and host portions of an IP address
To determine the network address for any IP address, you have to convert both octal addresses into binary, and do a bitwise AND operation.
For example, an IP address of 156.154.81.56 used with a network mask of 255.255.255.240:
IP Address: 10011100.10011010.01010001.00111000
Subnet mask: 11111111.11111111.11111111.11110000
Bitwise AND ———————————————–
Result: 10011100.10011010.01010001.00110000
• The network address for the IP address and subnet mask in question is 156.154.81.48. To determine the how many hosts are possible to be on this same subnet count the number of bits from the right until you get to the first “1″ in the binary network address display.
• That number will be the power you raise 2 to for the calculation of possible number of hosts.
• You must also subtract 2 from the result because one address is reserved for broadcast and network addresses.
• This leaves you with the final algorithm of 2^n-2.
• In the example there are 4 bits of 0 in the network address, leaving you with 2^4-2 hosts possible (14 hosts).
• This means that your network address is 156.54.81.48, that you have a range of addresses available to hosts from 156.154.81.49 – 156.154.81.62, and that the broadcast address for this network is 156.154.81.63.
Subnet masks are critical to communications on an IP network. Network devices use the targets and defined netmask to determine if the host is on is a local subnet, or on a remote network.
Devices act differently depending on the result: If the subnet is local, the device will send an ARP request to retrieve the MAC or hardware address of the system in question to communicate over the data-link layer and If the address is found to be on a remote network, then the network device routes packets to the gateway in it’s routing table that is set to handle that network.
Additional Reading on Subnet Masks
Comments (1)



Nice and Lucid Article