Subnet Mask | Subnet Mask Use

Subnet Mask-

 

Before you go through this article, make sure that you have gone through the previous article on Subnet Mask.

 

We have discussed-

  • Subnet mask is a 32 bit address consisting of a sequence of 1’s and 0’s.
  • It is used to determine to which subnet the given IP Address belongs to.

 

In this article, we will discuss how subnet mask is used by the host assigned to it.

 

Concept To Know-

 

When any host connects to the internet, ISP provides following 4 things to the host-

  1. IP Address
  2. Default Gateway
  3. Subnet Mask
  4. DNS

 

1. IP Address-

 

  • ISP assigns an IP Address to the host so that it can be uniquely identified on the Internet.

 

2. Default Gateway-

 

  • Default router connected to the network in which the host is present is the default gateway for the host.

 

3. Subnet Mask-

 

  • Subnet mask is a 32 bit number that is assigned to the host.
  • It is used to determine to which network the given IP Address belongs to.

 

4. Domain Name Service (DNS)-

 

 

Subnet Mask Use-

 

Subnet mask is used to determine to which network the given IP Address belongs to.

 

  • Host use its subnet mask to determine whether the other host it wants to communicate with is present within the same network or not.
  • If the destination host is present within the same network, then source host sends the packet directly to the destination host.
  • If the destination host is present in some other network, then source host routes the packet to the default gateway (router).
  • Router then sends the packet to the destination host.

 

Example-

 

Consider-

  • There is a host A present in some network X.
  • There is a host B.
  • Host A wants to send a packet to host B.

 

Before transmitting the packet, host A determines whether host B is present within the same network or not.

 

 

Here,

  • Host A = Source host
  • Host B = Destination host

 

To determine whether destination host is present within the same network or not, source host follows the following steps-

 

Step-01:

 

  • Source host computes its own network address using its own IP Address and subnet mask.
  • After computation, source host obtains its network address with respect to itself.

 

Step-02:

 

  • Source host computes the network address of destination host using destination IP Address and its own subnet mask.
  • After computation, source host obtains the network address of destination host with respect to itself.

 

Step-03:

 

Source host compares the two results obtained in the above steps.

Then, following two cases are possible-

 

Case-01:

 

If the results are same,

  • Source host assumes that the destination host is present within the same network.
  • Source host sends the packet directly to the destination host.

 

Case-02:

 

If the results are different,

  • Source host assumes that the destination host is present in some other network.
  • Source host sends the packet via router to the destination host.

 

Important Points-

 

Note-01:

 

  • Each host knows only its own subnet mask.
  • It does not know the subnet mask of any other host.

 

Note-02:

 

  • The conclusion drawn by a host about the presence of other host within the same or different network might be wrong.

 

Note-03:

 

  • Consider host A draws some conclusion about host B.
  • Then, same conclusion might not be drawn by host B about host A.
  • Both the hosts have to perform the above procedure separately at their ends to conclude anything.

 

PRACTICE PROBLEMS BASED ON USE OF SUBNET MASK-

 

Problem-01:

 

Two computers C1 and C2 are configured as follows-

  • C1 has IP Address 203.197.2.53 and net mask 255.255.128.0
  • C2 has IP Address 203.197.75.201 and net mask 255.255.192.0

 

Which one of the following statements is true?

  1. C1 and C2 both assume they are on the same network
  2. C2 assumes C1 is on same network but C1 assumes C2 is on a different network
  3. C1 assumes C2 is on same network but C2 assumes C1 is on a different network
  4. C1 and C2 both assume they are on different networks

 

Solution-

 

At Computer C1-

 

C1 computes its network address using its own IP Address and subnet mask as-

203.197.2.53 AND 255.255.128.0

= 203.197.0.0

 

C1 computes the network address of C2 using IP Address of C2 and its own subnet mask as-

203.197.75.201 AND 255.255.128.0

= 203.197.0.0

 

Since both the results are same, so C1 assumes that C2 is on the same network.

 

At Computer C2-

 

C2 computes its network address using its own IP Address and subnet mask as-

203.197.75.201 AND 255.255.192.0

= 203.197.64.0

 

C2 computes the network address of C1 using IP Address of C1 and its own subnet mask as-

203.197.2.53 AND 255.255.192.0

= 203.197.0.0

 

Since both the results are different, so C2 assumes that C1 is on a different network.

Thus, Option (C) is correct.

 

Problem-02:

 

The subnet mask for a particular network is 255.255.31.0. Which of the following pairs of IP Addresses could belong to this network?

  1. 172.57.88.62 and 172.56.87.233
  2. 10.35.28.2 and 10.35.29.4
  3. 191.203.31.87 and 191.234.31.88
  4. 128.8.129.43 and 128.8.161.55

 

Solution-

 

Let the given two IP Addresses belong to Host A and Host B.

 

Checking Option (A)-

 

  • Host A IP Address = 172.57.88.62
  • Host B IP Address = 172.56.87.233

 

At Host A-

 

Host A computes its network address using its own IP Address and subnet mask-

172.57.88.62 AND 255.255.31.0

= 172.57.24.0

 

Host A computes the network address of Host B using IP Address of Host B and its own subnet mask-

172.56.87.233 AND 255.255.31.0

= 172.56.23.0

 

Since both the results are different, so host A assumes that host B is on a different network.

Thus, both can’t belong to the same network.

Hence, this option gets eliminated.

 

Checking Option (B)-

 

  • Host A IP Address = 10.35.28.2
  • Host B IP Address = 10.35.29.4

 

At Host A-

 

Host A computes its network address using its own IP Address and subnet mask-

10.35.28.2 AND 255.255.31.0

= 10.35.28.0

 

Host A computes the network address of Host B using IP Address of Host B and its own subnet mask-

10.35.29.4 AND 255.255.31.0

= 10.35.29.0

 

Since both the results are different, so host A assumes that host B is on a different network.

Thus, both can’t belong to the same network.

Hence, this option gets eliminated.

 

Checking Option (C)-

 

  • Host A IP Address = 191.203.31.87
  • Host B IP Address = 191.234.31.88

 

At Host A-

 

Host A computes its network address using its own IP Address and subnet mask-

191.203.31.87 AND 255.255.31.0

= 191.203.31.0

 

Host A computes the network address of Host B using IP Address of Host B and its own subnet mask-

191.234.31.88 AND 255.255.31.0

= 191.234.31.0

 

Since both the results are same, so host A assumes that host B is on the same network.

 

At Host B-

 

Host B computes its network address using its own IP Address and subnet mask-

191.234.31.88 AND 255.255.31.0

= 191.234.31.0

 

Host B computes the network address of Host A using IP Address of Host A and its own subnet mask-

191.203.31.87 AND 255.255.31.0

= 191.203.31.0

 

Since both the results are different, so host B assumes that host A is on a different network.

Thus, both can’t belong to the same network.

Hence, this option gets eliminated.

 

Checking Option (D)-

 

  • Host A IP Address = 128.8.129.43
  • Host B IP Address = 128.8.161.55

 

At Host A-

 

Host A computes its network address using its own IP Address and subnet mask-

128.8.129.43 AND 255.255.31.0

= 128.8.1.0

 

Host A computes the network address of Host B using IP Address of Host B and its own subnet mask-

128.8.161.55 AND 255.255.31.0

= 128.8.1.0

 

Since both the results are same, so host A assumes that host B is on the same network.

 

At Host B-

 

Host B computes its network address using its own IP Address and subnet mask-

128.8.161.55 AND 255.255.31.0

= 128.8.1.0

 

Host B computes the network address of Host A using IP Address of Host A and its own subnet mask-

128.8.129.43 AND 255.255.31.0

= 128.8.1.0

 

Since both the results are same, so host B assumes that host A is on the same network.

Thus, both the hosts assume that they belong to the same network.

Hence, Option (D) is correct.

 

To gain better understanding about Subnet Mask Use,

Watch this Video Lecture

 

Next Article- Internet Protocol Version 4 | IPv4 Header

 

Get more notes and other study material of Computer Networks.

Watch video lectures by visiting our YouTube channel LearnVidFun.

Summary
Subnet Mask | Subnet Mask Use
Article Name
Subnet Mask | Subnet Mask Use
Description
Subnet Mask Use- Host use its subnet mask to determine whether the other host it wants to communicate with is present within the same network or not. Subnet Mask is a 32 bit number that identifies the subnet to which an IP Address belongs.
Author
Publisher Name
Gate Vidyalay
Publisher Logo
Liked this article? Share it with your friends and classmates now-