Open In App

How do You Calculate the Subnet Address from an IP Address and Subnet Mask?

Last Updated : 24 Apr, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Answer: To calculate the subnet address from an IP address and subnet mask we first convert both into its binary form and perform the bitwise AND operation between IP address and subnet mask.

Subnet Mask

The subnet mask of a network is the number in which all the network bits are set to 1 and all host bits are set to 0.

Subnet ID or Subnet Address

The subnet to which the given IP address is belongs to is called as its subnet ID or subnet address.

Steps to Calculate the Subnet Address from IP Address and Subnet Mask

Below are the steps to calculate the subnet address from an IP address and subnet mask.

  • Find take the given IP address and subnet mask and convert into its binary form.
  • Then perform bitwise AND of the subnet mask and given IP address.
  • The resultant gives the subnet address of given IP address.

Example

Consider an IP address of a network is X is 200. 1. 2. 10 and the subnet mask of the network is 255.255.255.128 then find the subnet address of given IP.

Solution:

Given IP address = 200. 1. 2. 10
Given Subnet mask = 255. 255. 255. 128
First convert the above IP address and subnet mask into binary form.
IP address = 11001000. 00000001. 00000010. 00001010
Subnet Mask = 11111111. 11111111. 11111111. 10000000
Now perform bitwise AND operation.
We get, the subnet address as 11111111. 11111111. 11111111. 00000000
Now convert the subnet address into decimated form.
Subnet address = 200. 1. 2. 0
So, the subnet address of given IP address and subnet mask is 200. 1. 2. 0


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads