Javatpoint Logo
Javatpoint Logo

SUBNET MASK

Every computer device has two pieces of IP address: the host or client address and the network or server address. Either the IP addresses are configured manually, which is the static IP address, or by a DHCP server. The IP addresses are split into the network address and the host by the subnet mask. It depends on which part of the IP address belongs to the device and which part belongs to the network.

Gateway or default gateway creates a connection between the local device to the other network. According to that, when a local device wants to send information to the device with an IP address on other networks, then it will first send the packets to the gateway, and after that, it forwards the data to the destination, which is located outside the local network.

What is a subnet mask?

A subnet mask is a 32-bit number created by setting the host bits to all 0s and setting network bits to all 1s. In this way, the subnet mask is separated the IP address into the host address and network address. The broadcast address is always assigned to the "255" address, and a network address is always assigned to the "0" address. Since the subnet mask is reserved for a special purpose, it cannot be assigned to the host.

An underlying structure is comprised of the subnet mask, IP address, and gateway or router. When a system needs additional subnetting, then the host element of the IP address to divided by subnetting, and it further divides into the subnet. The subnetting process is the main goal of the subnet mask.

The subnet mask and IP address:

A single device of an IP network is identified by a 32-bit IP address. The binary bits of that 32-bit IP address are divided into a network section and a host by the subnet mask. They are also broken into four 8-bit octets.

Since the binary is challenging, we convert each update which is expressed in dot decimal.

For IP address, it is converted to the characteristics dotted decimal format.

Subnet masks and IP address classes:

Since all sides of networks can be accommodated on the internet, then based on how the octet in an IP address is broken down, an addressing scheme for a range of networks exists. We can calculate it upon the three high-order or leftmost weights of any described IP address. This IP address should have different classes of the network, a to e, the addresses in it.

From the above five different classes of the network, the d class network is reserved for multicasting; on the other hand, the class network is not used on the internet. It is because the internet engineering task force (IETF) they are out for research.

The network portion in the first octet is reflected by the class a subnet mask, and it leaves opted, three and four for the network manager for the purpose of dividing the hosts and subnets as required. 65,536 hosts are included in the class a network.

The class b subnet mask makes sure the first two actors further network without the remaining part of the address, and the 16-bit after it is four and three for the host and subnet part. A number from 256 to 65,534 hosts for the class b network.

On the other hand, in the class c subnet mask, there are three updates with a combination of hosts and the southerners in the last octet 4 8 bits. Lower than 254 hosts in class c, there are a smaller number of networks.

Rather than there are natural masks or default subnet masks of class a, b &c.

Class a: 255.0.0.0

Class b: 255.255.0.0

Class c: 255.255.255.0

Any given local network weekend determines the number and type of IP address based on its default subnet mask.

The working mechanism of subnetting:

It is a technique in which a single physical network is logically partitioned into multiple smaller subnetworks or subnets.

By adding subnets without a new number, an organization enables subnetting for the purpose of concealing the network complexity and reducing the network traffic. Subnetting is essential when a single network number is used across many segments of a local area network.

Advantages of subnetting:

  • Reduction of broadcast volume with the network traffic
  • Enabling work from home
  • For surpassing LAN constraints to allow organizations such as maximum number of hosts

Addressing of network:

Classless interdomain routing (CIDR) is the standard modern network prefix that is used for both IPV4 and IPV6. Network masks are the addresses of IPV4, which is represented in CIDR notation. Also, they are a specified number of bits in the prefix to the address after a (/) separator. For denote routing or network fixes, this is the format of soul standard based.

Since the advent of CIDR, there have been two parameters for assigning an IP address to a network interface: the address and a subnet mask. The routing complexity is increased by subnetting because to represent each locally connected subnet, there must be a separate entry in each connected router table.

Subnet mask calculator:

It is possible to calculate the subnet mask by hand. It is not an efficient way. Most use calculators for calculating the subnet mask. There are various types of terminator mask calculators. From those, some calculators have a better scope and wide range of functions; on the other hand, some have specific utilities.

Information like IP address, IP range, subnet mask, and network address are provided by these tools.

Some common varieties of IP subnet mask calculators are as follows:

  • Hierarchical subnets are mapped by an IPV6 IP Subnet calculator
  • An IPV4/IPV6 calculator/converter is an IP mask calculator. Condensed format and IPV6 alternative are supported by it. This network subnet calculator may also allow us for the conversion of IP numbers from IPV4 to IPV6.
  • Hex conversion tool and subnet mask adjustment is an IPV4 CIDR calculator.
  • By calculating the IP address wild card mask, an IPV4 Wild card calculator calculates a portion of an IP address that is available for examination.
  • For calculation of the first and last subnet addresses, we use a hex subnet calculator, including the hexadecimal notations of multicast addresses.
  • The small available corresponding subnet and subnet mask determined by a simple IP subnet mask calculator.
  • Start and end addresses are provided by a subnet range or address range calculator.

Meaning of IP mask:

We might use the IP or mask as a shorthand. The phrase subnet mask is preferred, for defining both the IP address and this mask at once. In this situation the number of bits in the mask follows the IP address.

Calculation of a subnetMask from an IP address:

The subnet mask is used for distinguishing between the host Address and network address in IP address. It is a 32 bits long address. In this case, the subnetMask is primarily used to identify which part of an IP address is Host address and which part is the network address. By breaking into several subnets, the subnetting helps for organization of the network. The subnet mask explicitly defines the network and hostsBits as 1 and 0, respectively. In decimal notation, the value from 1 to 255 of the subnetMask represents the network address, and the zero value represents the host address.

On the other hand, in binary notation on bit {1} of subnet mask represents the network address while off bits of Subnet mask represents the host address.

Basically, there are three types of IP addresses:

Class a IP address begins with 1 to 127.

Class b IP address begins with 128 to 191.

Class c IP address begins with 192 to 223.

Binary classifications of these IP addresses:

Class a: network part is 8-bit -

11111111.00000000.00000000.00000000

Class b: network part is 16-bit -

11111111.11111111.00000000.00000000

Class c: network part is 24-bit -

11111111.11111111.11111111.00000000

For example:-

Let us take an IP address of 128.38.130.89 which belongs to the network with six subnets. Then how can we calculate the subnet mask?

Procedure:

Step 1:

Now we will determine the network class of the mentioned IP address is 128.38.130.89.

Step 2:

The address comes under class b because the IP address starts with 128.

Step 3:

Then to define the subnets, we will calculate the number of bits.

Step 4:

Calculation formula: number of bits = log2(number of subnets + 2).

Step 5:

Six subnets are given here. So now, we will apply the value in the above formula to get the number of bits.

Number of bits = Log2(number of subnets + 2) = log2(6+ 2) = 3 bits.

Step 6:

To compose the subnet mask in the binary form, we really use the beats calculator in the above step using the default binary Classification.

Step 7:

The IP address is given in this example (128.38.130.89) comes under class b. The binary classification of class b is 11111111.11111111.00000000.00000000. So, then we will substitute the subnet bits in the binary classification, and we will get 11111111.11111111.11100000.00000000.

Step 8:

Then we will convert the binary value to its equivalent decimal value with the help of the following rule:

For 1111111 octet, we will write 255

For 00000000 octet, we will write 0

If the octet contains both "1" and "0", use the formula:

Integer number = (128 x n) + (64 x n) + (32 x n) + (16 x n) + (8 x n) + (4 x n)

+ (2 x n) + (1 x n), where "n" is either 1 or 0 in the corresponding position in the octet sequence.

Step 9:

After that, we will make covert this binary value to get the subnetMask.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA