Useful Tips

Tip 1: How to find out the subnet mask


The question of how to find out the subnet mask may arise for novice system administrators and ordinary people who decide to deal with computer networks. In the context of administration, masks can be used to divide networks into smaller ones and help to deal with connection problems.

The ability to calculate the TCP / IP mask value can be used when connecting a new host to the network and reorganizing the corporate grid. The study of this problem should begin with an understanding of what it is and for what purposes it is used.

Bit mask

The subnet mask can be called a bit mask, which is a 32-bit value that indicates one part of IP related to the addressing of the network interface, and the second part related to addressing of the subnets. Usually its value is displayed in decimal form, in the format ХХХ.ХХХ.ХХХ.ХХХ.

This definition is close to professional slang and may seem incomprehensible. A concrete example will help you figure out what it is.

Suppose we have some kind of network in which a computer is present. The connection properties show that its network interface is assigned an IP address and subnet mask.

Further, both values ​​are given in binary form and the following sequences are calculated:

Now we need to sequentially multiply each bit of the IP address in binary form by the bit of the mask in binary form and as a result we get the value

which when converted to decimal will look like

Multiplying the IP address by the inverted value of the mask, we get the sequence

Returning in decimal form, we get the number 199, corresponding to the address of the host interface.

Comparing the first and second results, we can say that the numbers of the IP address, which correspond to the units of the mask, indicate the subnet address. The IP address numbers corresponding to the zeros of the mask form the computer address on this subnet.

As a result, the subnet mask helped to find out by IP that our computer is on the subnet and has the address 199 in it. Returning to the definition above, it showed which part of the IP points to the subnet and which to the host address.

How to find a subnet mask by IP network class

The totality of all IPv4 addresses is divided into classes by address ranges. There are five in total, of which A, B, C are used, D addresses are laid out under multicasts, and E addresses are reserved for the future.

To determine the address class, you must again translate it into binary and see the beginning of the sequence of bits:

Returning to the example that was above, how to find out the subnet mask in it:

The binary IP address starts at 110, which means it belongs to class C. Another way to find out the subnet mask is to remember the ranges that belong to the classes.

How to recognize a mask by a prefix

For brevity, the mask can be written in the form of a prefix, which means the number of bits of a portion of the network. This naming system was adopted with the advent of classless Inter-Doma-in Routing, or CIDR, cider. It eliminates classes, and a different number of IP bits can be used to identify the network. It is easiest to find the subnet mask in decimal and binary form by the prefix from the table.

How to calculate mask by CIDR prefix

Casting a mask from a prefix to a decimal is easy. It is known that a subnet mask has 32 bits, with ones at the beginning and zeros at the end. Therefore, you need:

The last action is to get the mask in decimal form.

How to cast a subnet mask from decimal to short prefix

Writing a netmask in the form of a prefix saves time and space in the text. In addition, it is a standardized international display and is now used more often than decimal. This requires:

In this way, the CIDR prefix can be calculated.

How to determine the subnet mask using the network address and network mask

Such a task often pops up at interviews and test tasks. And also the skill is useful when reorganizing the enterprise network or dividing a large grid into smaller subnets.

For clarity, it is worth returning to an example that is parsed from the first paragraph.

Using the address and the network mask, the address of the network itself, which has the form, has already been calculated. There are 256 addresses to use here. Of these, 2 addresses are automatically reserved:

. 0 - network address and cannot be used.

Remains only 254 addresses for distribution to hosts. It is worth noting that in multi-peer networks, another address is reserved for routing, it may be. 1 (or any other).

Sorting everything in order, we bring this example into a general view that applies to any network.

The number of valid nodes is always limited. If you translate the network mask in binary form, then, as you already know, units indicate the subnet address, zeros indicate the computer address.

A bit can only return two values, two bits four, three bits eight and so on. It turns out that n-bits return 2 ^ n values. Based on all of the above, the conclusion is drawn: the number of hosts (N) in the network is calculated by the formula N = (2 ^ r) -2, in which r is the number of zeros in binary form of the mask.

Returning to our example, we calculate:

The same 254 addresses are obtained for distribution to hosts on the network.

Suppose that an enterprise needs to create a division and collect 20 working computers into a subnet. You can calculate the subnet mask as follows.

We take 20 IP and add to them 2 addresses that will be reserved. A total of 22 is required, the closest degree 2 is 32. In binary form, 10 0000. Since the network in which the division is performed belongs to class C, the subnet mask will look like:

A maximum of 30 addresses can be distributed to host interfaces in the received subnet.

How to calculate the subnet mask. Bit shift

We understand further. The subnet mask helps break large networks into smaller ones. The first step is to determine how many subnets you need to split the network and how many hosts they should have.

Suppose you want to break a network into 6 subnets, with a maximum of 20 nodes planned for the largest. Based on this, a calculation is made.

Define the class of the network to be split. For example, a class C network is proposed, the mask used by default is or / 24.

Find out how many bits are required for six subnets. For this, the number of networks is rounded to the nearest power of two, this is 8. It turns out that 3 bits are required, since 8 = 2 ^ 3.

Present the default mask in binary for clarity:

To create 6 subnets, you need to pick up 3 bits from the octet of the host address. An additional 3 is added to the 24 bits of the network address. As a result, 24 + 3 = 27.

It remains to convert the mask to decimal. The last octet of 11100000 is 224. It turns out that the mask has the form

Or, referring to CIDR, count the number of bits in units - 27, and see the value of the prefix.

Using three bits and using a mask, break the subnets. In the last octet we put down the units. For clarity, this can be done in binary form:

It is possible to calculate the addresses of subnets without a binary representation, here it is done to clearly show why these addresses are obtained, and not others.

This way you can create 8 subnets, but only 6 are required in the task, so let's dwell on them.

The times when such calculations were carried out manually are far behind. Information on how to recognize the subnet mask is taught at universities and at various courses. As a rule, students and professionals who want to get certified diligently try to study it.

Today, to facilitate the work of system administrators and network engineers, there are many different calculators. These systems can do any calculation in a few seconds. However, to resort to the help of programs with a small amount of data is uninteresting. Sometimes it’s easier and faster to break the network in your mind than to look for the right resource.

Understanding how the calculation of the subnet mask is done is necessary for a specialist, even if he will never use it in practice.

What is an IP Address?

An IP address is a unique combination of numbers to recognize a computer on a network. The presence of such an address may be necessary for connecting to the Internet, as well as for connecting two or more computers to each other.

The provider or service provider provides the subscriber with an individual IP address, called a static one. If there is no individual address, the IP address is called dynamic and constantly changes. In this case, there is no need to register the address in the connection properties.

How to record IP address

The IP address is recorded in the adapter settings. Together with it, a subnet mask is required.

The steps for writing an IP address are as follows.
1) Right-click on the network sign in the lower right corner of the screen.
2) Select and open the "Network and Sharing Center."
3) Click on the item “Change adapter settings” located on the left.
4) From the list that appears, select the network connection to which you want to assign an IP address.
5) Click on the connection with the right mouse button and select "Properties".
6) Select “Internet Protocol Version 4 (TCP / IPv4)” from the list of components and open the “Properties” window.
7) Check "Use the following IP address". In the IP Address field, enter the address as a sequence of numbers separated by periods. In the “Subnet mask” field, enter the standard mask, unless otherwise provided by the provider.

The desired network connection can be found by the name of the adapter. If an IP address is required to connect via ADSL or to establish communication with other home computers, you must select a connection with a Realtek adapter. If the IP address is assigned to the satellite connection, then the adapter can be Virtual MPE Decoder Adapter or TAP 9. If the connection is wireless, the adapter can be either Bluetooth or Wi-fi. The name of the adapter is spelled out in the connection properties in the "Connect via" line.

If you need to connect other computers to the computer via a local network, then you can think of an IP address yourself. For example, the address of the central computer of the local network may look like this: Then the other computers on the local network must be assigned the addresses,, etc. The subnet masks must be the same, and the IP address of the host computer is registered as a gateway. It should be borne in mind that this address is used only in the local network. To access the Internet in a central computer, a hotel connection must be configured with its IP address.

Why do I need a subnet mask

I am often asked why the user needs a subnet mask? I explain the subnet mask is needed in cases where:

  1. An ordinary user needs to connect to the Internet, you need to enter the value of the subnet mask,
  2. The system administrator needs to connect a group of computers by “breaking” the received network address into several small subnets,
  3. There is a need to separate the network address, host address.

Find by calling the command line

In order to find out the subnet mask on your computer through the command line, you must press the Windows + R key combination. After that, you will need to enter two commands:

  • In the search bar - “cmd” (to invoke the command line), click “ok”,
  • Enter: “ipconfig / all”, of course without quotes, and in the description of the connection you will see a subnet mask, it usually starts with 255.

Most often, the default mask is indicated there:, but you may have other values.

The second way through an internet connection

Hover over your network connection and right-click. Select Status

After that, click on the "Details ..." button:

Find the subnet mask next to the IP address.

Recognize subnet mask by CIDR prefix

Sometimes you can see the designation of the IP address with a fractional bar and number, that is, a prefix. It may look, for example, like this: 192: 168: 0: 78/24, where the number (prefix) / 24 is the subnet mask. What does this subnet mask look like in binary?

In binary code, it is written as follows, twenty-four digits - 1 in a row, and eight zeros at the end:

11111111 11111111 11111111 00000000

That is, the 32 bits that make up the subnet mask are divided as follows: four groups (octets) of eight characters (bits) in each group. If a short prefix indicates a number, for example - / 23, then you need to write twenty three - 1, then nine zeros:

11111111 11111111 11111110 00000000

That when translating the subnet mask to decimal, it will give the number: In order not to get confused when translating a binary code to a decimal number, you can see this table:

To summarize

In this article, we examined the question of how to recognize the subnet mask. As can be seen from the description above, this is not difficult to do.

I hope that I was able to cope with the task - to clearly explain what the subnet mask means, how to find out the subnet mask of the computer.

I bring to your attention interesting articles about computer literacy:

I wish you good luck and success in mastering computer literacy.

P.S. I am putting screenshots of my earnings in affiliate programs. And I remind you that everyone, even a beginner, can make money like that! The main thing is to do it right, which means to learn from those who are already earning, that is, from Internet business professionals.

Do you want to know what mistakes newcomers make?

99% of newcomers make these mistakes and fail in business and making money on the Internet! Take care not to repeat these errors - “3 + 1 BEGINNER ERRORS KILLING THE RESULT”.

Do you need money urgently?

Download for free: "TOP - 5 ways to make money on the Internet." The 5 best ways to make money on the Internet, which are guaranteed to bring you a result of 1,000 rubles per day or more.

Here is the turnkey solution for your business!

And for those who are used to taking ready-made solutions, there is a “Project of ready-made solutions for starting earning money on the Internet.” Learn how to start your own business on the Internet, even for the greenest newcomer, without technical knowledge, and even without expertise.