IP is a communication protocol that is used from the smallest network of two devices to the global information network. An IP address is a unique identifier for a specific host (device) allocated in a specific network.
IP Address Recording
The address looks like a 32-bit number in the range from 0 to 4294967295. This suggests that the entire Internet can contain more than 4 billion completely unique addresses of objects. If you write down the addresses in binary or decimal form, this causes inconvenience in storing or processing them. Therefore, to simplify the spelling of such addresses, it was decided to divide the complete address into four octets (8-bit numbers), separated by a dot. For example: an address that looks like 0290612 in the hexadecimal system, in the IP address record it will look like 192.41.6.18. In this case, the smallest address is four zeros, and the maximum is four groups of 255 each. The highest region (the one located on the left side of the groups of digits from any of the dividing points) is occupied by the address region, the lowest region (on the right side of the same dividing point ) shows the interface number on this network. The position of the boundary between the host and network parts depends on the number of bits that were allocated to the network number, it can be different, the separation is only along the octet boundary (the points between them) and allows you to determine the classes of IP addresses.
Class Address Model
For several decades, addresses are divided into 5 classes. This currently obsolete separation is called full-class addressing. IP classes are called Latin letters from A to E. Classes from A to E make it possible to set identifiers for 128 networks with 16 million network interfaces in each, 16384 networks with 64 thousand devices and 2 million networks with 256 interfaces. IP network classes D are provided for multicasting, in which message packets are sent to several hosts simultaneously. Addresses that have start bits 1111 are reserved for future use.
Below is a table of IP addresses. Classes are determined by the high address bits.
Class A
Class A IP addresses are characterized by a zero high bit address and an eight-bit size of network membership. They are written as:
Based on this, the largest number of Class A networks can be 2 7 , but each of them will have an address space of 2 24 devices. Since the first bit of the address is 0, then all Class A IP addresses will be in the high octet range from 0 to 127, which, in addition, will be the network number. In this case, the zero address and 127 are reserved for business addresses, so their use is impossible. For this reason, the exact number of Class A networks is 126.
3 bytes (or 24 bits) are allocated for the addresses of nodes in a Class A network. A simple calculation shows that you can place 16,777,216 binary combinations (interface addresses). Since addresses consisting entirely of zeros and ones are specialized, the number of Class A networks is reduced to 16,777,214 addresses.
Classes B and C
The main distinguishing feature of the class b IP address is the value of the two high-order bits, equal to 10. The size of the network part will be 16 bits. The format of the address of this network looks like this:
For this reason, the largest number of Class B networks can be 2 14 (16384) with an address space of 2 16 each of them. Class B IP addresses start in the range from 128 to 191. This is a distinguishing feature by which you can determine whether a network belongs to this class. Two bytes allocated for the addresses of these networks, minus zero and consisting of units of addresses, can make up the number of nodes equal to 65,534.
Any Class C IP address starts in the range of 192 to 223, with the network number occupying the three highest octets. Schematically, the address has the following structure:
The three most significant bits have the first 110, the network part 24 bits. The largest number of networks in this class is 2 21 (this is 2097152 networks). Under the node addresses in the IP address of Class C networks, 1 byte is allocated, this is only 254 hosts.
Additional network classes
Classes D and E include networks with the highest octet higher than 224. These addresses are reserved for specialized purposes, such as, for example, multicasting - the transmission of datagrams to certain groups of nodes in the network.
A class D range is used to distribute packets and ranges from 224.0.0.0 to 239.255.255.255. The final class, E, is reserved for future use. It includes addresses from 240.0.0.0 to 255.255.255.255. Therefore, if you do not want addressing problems, it is advisable not to take IP addresses from these ranges.
Reserved IP Addresses
There are addresses that cannot be given to any devices, whatever the IP addressing. Service IP addresses have a specific purpose. For example, if the network address consists of zeros, this implies that the node belongs to the current network or to a specific segment. If all units are, then this is the address for broadcasting packets.
Class A has two dedicated special networks with numbers 0 and 127. An address of zero is used as the default route, and 127 shows the addressing to itself (feedback interface). For example, IP addressing 127.0.0.1 means that the node only communicates with itself without going out of datagrams to the level of the data transmission medium. For the transport layer, such a connection is no different from communication with a remote host, so this feedback address is often used to test network software.
Defining network and host identifiers
Knowing the IP address of the device in the case where the question arises of how to determine the class of the IP address, then just look at the first octet of the address. If it is from 1 to 126, then this is a class A network, from 128 to 191 is a class B network, from 192 to 223 is a class C network.
To identify the network, you need to remember that in class A this is the starting number in the IP address, in B the starting two numbers, in C the starting three numbers. The rest are identifiers of network interfaces (nodes). For example, the IP address 139.17.54.23 is a Class B address, since the first number - 139 - is greater than 128 and less than 191. Therefore, the network identifier will be 139.17.0.0, the host identifier will be 54.23.
Subnets
Using routers and bridges, it is possible to expand the network by adding segments to it, or divide it into smaller subnets by changing the network identifier. In this case, a subnet mask is taken, which shows which segment of the IP address will be used as the new identifier for this subnet. If the identifiers match, we can conclude that the nodes belong to the same subnet, otherwise they will be on different subnets and a router will be required to connect them.
IP classes are designed so that the number of networks and nodes for a particular organization is predetermined. By default, an organization can only deploy one network with a number of devices connected to the network. There is a certain network identifier and a certain number of nodes, which is limited in accordance with the class of the network. With a large number of nodes, the network will have low bandwidth, since even with any broadcast distribution, performance will drop.
Subnet masks
In order to separate the identifier, you need to use a subnet mask - a kind of template that helps to distinguish network identifiers from host identifiers in IP addresses. IP classes do not impose restrictions on the subnet mask. The mask looks the same as the address - four groups of numbers from 0 to 255. In this case, first come the big numbers, followed by the smaller ones. For example, 255.255.248.0 is the correct subnet mask, 255.248.255.0 is incorrect. The mask 255.255.255.0 defines the initial three octets of the IP address as the subnet identifier.
When designing an enterprise network segmentation, it is necessary that IP addressing is properly organized. IP classes, divided into segments using masks, allow not only to increase the number of computers on the network, but also to organize its high performance. Each address class has a default network mask .
For additional subnets, often not the default masks are used, but individual ones. For example, the IP address 170.15.1.120 can use the subnet mask 255.255.255.0 with the network identifier 170.15.1.0, while it is not necessary to use the subnet mask 255.255.0.0 with the identifier 170.15.0.0, which is used by default. This allows you to split the existing class B organization network with ID 170.15.0.0 into subnets using various masks.
Calculation of subnet parameters
After setting up the subnet on each interface, the network protocol software will poll IP addresses, using the subnet mask to determine the subnet address. There are two simple formulas for calculating the maximum number of subnets and hosts on a network:
- 2 (number of bits equal to one in the mask) - 2 = the largest number of subnets;
- 2 (number of zeros in the subnet mask) - 2 = the largest number of devices in the subnet.
For example, take an address equal to 182.16.52.10 with a mask of 255.255.224.0. The binary mask looks like this: 11111111.11111111.11100000.00000000. Judging by the first octet, this network belongs to class B, so we consider the third and fourth octets. We substitute three units and thirteen zeros into the formulas and get 23-2 = 6 subnets and 213 - 2 = 8190 hosts.
When applying the standard class B network mask in the form of 255.255.255.0, the network can have 65534 connected devices. If the subnet address is a full byte of the host, then the number of connected devices in each subnet is reduced to 254. If you need to exceed this number of devices, problems can arise that can be solved by shortening the subnet address mask field or by adding another secondary address in the router interface. But in this case, there will be a decrease in the number of possible networks.
When creating subnets in a class C network, remember that the choice will be very small with only one octet free. When filtering out zero and broadcast addresses, it remains possible to create four optimal sets of subnets: one subnet for 253 hosts, two subnets for 125 hosts, four subnets for 61 hosts, eight subnets for 29 hosts. Other split options will cause problems with routing and broadcasting, or just cause inconvenience when calculating addressing between hosts.
Forming subnets in Class B networks is already easier, since there is more freedom of choice. By default, the subnet mask is 255.255.0.0; when using it, we get 65534 hosts. When creating subnet masks, left unlabeled bits of 3 and 4 octets are allocated to their addresses. By calculations, it is possible to derive the optimal networks with numbers 32, 64, 96, 128, 160 and 192.
Class A networks have a very large number of addresses for which it is possible to create subnets. Up to 32 bits can be used to use subnet masks. Using the above formula, we can determine that the maximum number of subnets can be up to 254. At the same time, 16 bits remain on the host addresses, that is, 65534 nodes can be connected.
Of course, these are only approximate calculations. When creating sectors and working with subnets, it is necessary to take into account more factors that depend on the provider and the level of the enterprise.