Thursday, April 10, 2014

What is a network/subnet mask


What is a network / subnet mask? Explain how host A sends a message / packet to host B when:
(a) both are on same network and
(b) both are on different networks.

Explain which layer makes the routing decision and how.


A mask is a bit pattern used to identify the network/subnet address. The IP address consists of two components: the network address and the host address.

The IP addresses are categorized into different classes which are used to identify the network address, i.e. class A, B and C.

Example: Consider IP address This address belongs to Class B, so:
Network Mask: 11111111.11111111.00000000.00000000
Given Address: 10011000.11010101.00001011.00000010
By ANDing Network Mask and IP Address, we get the following network address:
10011000.11010101.00000000.00000000 (
Host address: 00001011.00000010

Historical table taken from wikipedia:
Historical classful network architecture
Class Leading
Size of network
bit field
Size of rest
bit field
of networks
per network
Start address End address
A 0 8 24 128 (27) 16,777,216 (224)
B 10 16 16 16,384 (214) 65,536 (216)
C 110 24 8 2,097,152 (221) 256 (28)

Similarly, a network administrator can divide any network into sub-networks by using subnet mask. To do this, we further divide the host address into two or more subnets.

For example, if the above network is divided into 18 subnets (requiring a minimum of 5 bits to represent 18 subnets), the first 5 bits will be used to identify the subnet address.
Subnet Mask: 11111111.11111111.11111000.00000000 (
Given Address: 10011000.11010101.00001011.00000010
So, by ANDing the subnet mask and the given address, we get the following subnet address: 10011000.11010101.00001000.00000000 (

How Host A sends a message/packet to Host B:
When both are on same network: the host address bits are used to identify the host within the network.
Both are on different networks: the router uses the network mask to identify the network and route the packet. The host can be identified using the network host address.
The network layer is responsible for making routing decisions. A routing table is used to store the path information and the cost involved with that path, while a routing algorithm uses the routing table to decide the path on which to route the packets.
Routing is broadly classified into Static and Dynamic Routing based on whether the table is fixed or it changes based on the current network condition.



Post a Comment