Showing posts with label what is subnetmask. Show all posts

What is subnetmask?


Mask
If the network address is given, we can find the block and the range of addresses in the block.  What about the reserves? If an address is given, can we find the given address (the beginning address in the block). This is important because to route a packet to the correct network, a router needs to extract a network address from the destination address (a host address) in the packet header.
One way we can find the network address to first find the class of the address and the net ID. We then set the host ID to zero to find the network address. For example, if the address is 134.45.78.2 is given, we can immediately say that the address belong to class B. the net ID is 134.45 (2 bytes)  and the network address is 134.45.0.0.
The above method is feasible if we not subnetted the network; that is, if we have not divided the network into subnetworks. A general procedure that can be used involves a mask to find the network address from a given address.
A mask is a 32 bits binary number that gives first address in the block (the network address). When bit-wise ANDed with an address in the block.

AND Operation
Masking uses the bit-wise AND operation defined in computer science. The operation is applied bit by bit to the address and the mask.