As you know, every computer, in whatever networkhe was not, he has a certain digital address, called an IP address. Naturally, this rule is relevant only for networks based on the TCP / IP protocol, however, today almost any network is based on it. Anyway, in addition to this address, the network workstation has several other parameters that affect its interaction with other devices. First of all, one of them is the network mask, which we will discuss in this article.

tcp ip

Subnet mask, gateway and address ...

If you try to get information about the currentconnection, then, in addition to the IP address allocated to your computer, you will also see such fields as the subnet mask, the default gateway, and one or more DNS servers, or rather their addresses. For an uninitiated person, all this data is just a heap of numbers, but if you plan to configure computer networks based on the TCP / IP protocol, then you need to know a little more about these indicators.

A few words about IP addresses

Before diving into the wilds and explaining what issubnet mask, you should remember what an IP address is: what the numbers in it are and what values ​​they can take. In advance, we will specify one point: all the information in this article will concern the IPv4 protocol, since it is still the most "current" one.

table of subnet masks
So, the IP address consists of four digits, each of whichwhich can take a value from zero to 255. Do not be a professor of mathematics to calculate: there may be just over four billion combinations. Any device on a TCP / IP network has a similar address, regardless of what functions it performs-be it a network printer, router, ADSL-router or smartphone, the device will connect to the network only when it has a unique sequence of all the same four digits.

About local addresses

ip address and subnet mask
If you have several computers at home, thenyou probably noticed that all their addresses have much in common - most often their difference is only in the last digit, for example, if one of your computers has the address 192.168.1.10, then the second one can have 192.168.1.9. This situation is quite natural for home networks, because these addresses are internal. They are used to transfer data inside your home network, for example, between computers. And what happens when you need to get information from the Internet?

Gateway

 ip subnet mask
Before you begin to answer the question thatsuch a subnet mask, you need to figure out one more component of the network - the gateway. As you know, in order for your home computer to access the World Wide Web, it needs a gateway - its role is usually played by either a router or a modem, or (if it's not a house, but a job) server. When you request an Internet page, your computer will know if the server you are looking for is in your home network. If it is there (for example, if you keep the site on one of your computers), then nothing, in fact, special happens - the computers establish a connection through the local network and start the transfer of data. However, if you are trying to open a site located on a remote server, the gateway enters the case.

What is the subnet mask for?

So, we got close to the question of how,what is a subnet mask. In fact, this is a brief reference about which computers are on the same network as yours, and which ones require a gateway to connect. A mask is a kind of pattern that the computer superimposes on the IP address with which it wants to connect. If the pattern "falls flat", then everything is fine, if not - the request is sent to the device specified in the network settings as the default gateway.

What does the subnet mask look like?

If you are an averageuser of a home network consisting of several computers that has a gateway to access the Internet, then your subnet mask, most likely, looks like this: 255.255.255.0. These numbers are the so-called subnet mask 24, which indicates that if the first three digits in the IP address of the computer match your address, it is directly accessible.

what is a subnet mask
By the way, an example with 255.255.255.0 is relevant only if you are dealing with simple and familiar operating systems, for example Windows. Systems based on Linux, including the proverbial and ubiquitous Android, use a slightly different approach, in which the subnet mask is given a one- or two-digit number. In the above example, a similar number is 24.

Can I find out the subnet mask?

Despite the fact that this issue is under itselfit makes little sense, users do not stop asking it to search engines. It is almost impossible to determine the IP subnet mask by IP, because it is impossible to tell exactly what scale a local or distributed network has, based on the IP address alone. In some cases, information about the gateway can help, for example, if your computer has the address 192.168.1.2 and the gateway is 192.168.0.1, then the subnet mask must be at least 255.255.0.0, otherwise the gateway will be unreachable.

determine the subnet mask by ip
In general, the IP address and subnet mask is practicallyare not connected in any way, or rather, one can not be found out on the basis of another. In a network, the computer needs to operate with both parameters in order to create successful connections to a particular device.

About the price of errors

And what can happen if you make a mistake? Proceeding from the fact that we now already know what a subnet mask is, we can confidently say that if it is set incorrectly, there is a high probability that your computer will be cut off from the outside world. For example, if you enter 0.0.0.0 as a mask, then the operating system will treat any IP address as local and will not even attempt to use the gateway, which will result in the loss of the ability to communicate with computers outside your local network.

If you make another mistake, indicating too"Close" subnet mask, your computer may start experiencing problems already with connecting to "neighbors" on the local network - even if you access local IP, the subnet mask will indicate that access to it is possible only through the gateway, and this can lead either to an increased load on the network, or to the absolute inaccessibility of computers in the "locale".

Subnet masking options

Different operating systems useAppropriate approaches to the formulation of the network mask. While in Windows standard writing is considered to specify four eight-bit numbers, other operating systems, in particular those based on Unix, use a record based on specifying the IP address of the workstation, as well as the number of bits that must remain static.

 subnet mask 24
Let's consider a concrete example. Having an IP address 192.168.111.222 and stating that the static character of its bits is 32, we get the following entry: 192.168.111.222/32. In practice, this means that the computer will use the available gateway to connect to any computers other than itself. This is because 32 is the total number of bits that contains the IP address in the fourth version of the protocol. If we consider this mask in a form more familiar to most people (as is done in Windows), it would look like 255.255.255.255.

And what about the more familiar version of the masksubnet, which is used in most intra-apartment LANs? The conversation, of course, is about 255.255.255.0. If you carefully read this article, then about this mask the conversation was already going, and the number of its fixed bits is 24 (i.e. the first three numbers of 8 bits).

Thus, it is possible to carry out a simple logicalchain - for each fixed number there are 8 bits, which means that the same 255.0.0.0 will be written as / 8, since only the first number is fixed in it.

As for the intermediate options,for example, 255.255.255.128, then their bit size is also easily computable, in this case it is 25-25 bits of the first three fixed numbers, and also one more bit dividing the segment from 0 to 255 exactly in half.

If you need more optionsand examples, you can always turn your attention to specialized sources. On their pages devoted to the topic of our article, there is a table of subnet masks, which includes almost all possible variants of composing these sequences.