📜 ⬆️ ⬇️

Training Cisco 200-125 CCNA v3.0. Cisco Certified Network Specialist (CCNA). Day 3. Subnets

Today we will talk about subnets. As I said in the last video lesson, subnets are a very simple concept, and in order to understand them, you don’t need a pen and paper. I am sure that if you look closely at this video tutorial and try to learn everything that I am talking about, then the knowledge will be firmly fixed in your head.

When I started to prepare this presentation, I realized that subnets are an extensive topic that cannot be fit into one video, so I decided to share it - the day lesson we dedicate to class C IP addresses, and for class A and B IP addresses There is another video that I decided to call the evening lesson. In addition, in the last lesson of the third day we will look at the concept of super networks.

What is a subnet? As we discussed in the previous video, subnets appear as a result of breaking up a single large network.



If you look at the above figure, you will see one large room, divided by an internal wall into 2 separate rooms. Similarly, one large network can be divided into several networks and used as separate networks. To understand the essence of subnets, we need to talk a bit about IP addresses. There are two types of IP addresses: private IP addresses and public IP addresses. What is a private IP address?

In class A, these addresses are located in the range 10.0.0.0 - 10.255.255.255, that is, there are 16,777,216 private IP addresses of this class. Class B for private addresses has a range of 172.16.0.0 - 172.31.255.255, and their total number is 1,048,576. In Class C, these addresses are in the range of 192.168.0.0 - 192.168.255.255, there are still 65,536 private addresses.



What is the difference between public and private IP addresses? Private IP addresses are addresses that cannot be accessed on the Internet. So if you, rather, your web server receives a packet that says that the source IP address is 192 168 1.1, this packet will be immediately dropped because it is obtained from a private address that can only exist on the local network.



In the current situation shown in the figure, the Internet assigns public IP addresses to your routers, ensuring overall accessibility, and your computers, which have private IP addresses on the local network, are connected to a router that provides access to the Internet. Today, the Internet works in this way, but when the developers created the IP addresses of version 4, they hoped that all computers on the network would have a separate, unique public IP address, a unique IP version of the address.



They believed that 4.2 billion addresses in the 32-bit version of IPv4 would be quite enough for the whole world, because they did not expect the Internet to grow and develop at such a speed over the past decades. However, they soon realized that the free IP addresses of version 4 are running out, and they created the IP addresses of version 6, along with related concepts, such as NAT, which we will talk about later. The concept of NAT stands for “Network Address Translation”. Thus, private IP-addresses appeared in IPv6, which solved the problem of lack of IP-addresses in the general Internet.

With the development of technology, all computers, tablets, mobile devices began to try to connect to the Internet, so today 4.2 billion addresses constitute a very small address space for the rapidly growing Internet. With the introduction of the concept of NAT and the emergence of private and public addresses, the number of addresses assigned to each computer has sharply decreased, and now not a single computer has an IP address that would provide a direct connection to the Internet. Therefore, as soon as IPv4 addresses began to end, it became necessary to change the entire design of the Internet. Companies with several computers had to contact an Internet provider to assign private IP addresses to them for each device in the company. In this case, the Internet provider allocated to them, for example, the range 192.168. 1.0 - 192.168. 1.255, and as we said in the last video, it was 254 valid IP addresses. But if the company had only 10 computers, it turned out that 244 addresses were wasted. There was a situation when Internet IP addresses began to end very quickly, and the developers realized that they needed to create subnets that would divide the common network into separate segments.

Before we move on to reviewing subnets, let's look at how the classes of IP addresses work. Suppose we have a class C address 192.168.100.225 and a subnet mask of 255.255.255.0.



If we convert it to binary form, we get this:



From the previous video tutorial, we know that the division into a network number and a host number for this class of addresses occurs after the third octet, and three octets of the units in the subnet mask mean nothing more than / 24. Using the formula already known to us, we will see that our network has 254 host addresses.



When we equate the host bits to zero, we get a zero address, which is the identifier of this network. Further, the host number bits begin to grow from one until all the bits of the last octet turn into units, which corresponds to 255 in decimal equivalent. Thus, we have a network, the first address of which will be 0, the last one - 255, and between them there will be 254 valid host addresses.



Let's go directly to the consideration of the subnet. Take the same class C address 192.168.100.225 and the subnet mask 255.255.255.0.



When we go to the subnets, we have the concept of classless addresses.



The slash in this case is CIDR (Classless Inter-Domain Routing), a method of classless addressing in computer networks based on IP protocol. As soon as you start creating subnets, you take the whole concept of classes of IP addresses and throw it into the window, since from then on we will deal with classless IP addresses.

So, we take the address 192.168.100.225, this is the IP address of class C, this is / 24, but at the same time we cannot say that it has class C, because we are doing subnets and now we will deal with CIDR. Let's try to break our network into two parts, as shown in the figure. Imagine an apple that we cut in half.



We occupy one bit from the host number in the last octet, where we initially had only zeros. Then the line separating the network number and host number will move one character to the right, and now all the units to the left of the zeros are the network part of the address — I will highlight it in yellow.



So, we have two separate networks - subnet 1 and subnet 2, for each of which we have to assign a Network ID and a Broadcast ID. How do we do this? We see the subnet mask and its last bit, which is 1 and belongs to the place of 128 values, if you remember the binary to binary conversion table - in this table we have 8 columns, in which the values ​​128, 64, 32, 16 are located from left to right , 8, 4, 2, 1. This means that the size of the block of addresses for each of our subnets is 128, including 0, so the number of hosts in each subnet will be 126, that is 128-2.



That is, we have 126 addresses plus a network identifier and a broadcast address for each subnet. Now we do this: for the first network, the identifier will look like 192.168.100.0, and for the second network identifier it will be 192.168.100.128. Then the broadcast address of the first subnet will be 128-1 = 127, and since we cannot exceed the value of 255, this number will mean the broadcast address of the second subnet.

That's all you need to know about where the subnets come from - they are obtained by borrowing a bit from the host number used to create the network, that is, you divide one network into two. Speaking of borrowing, let's remember that we had a subnet mask of 255.255.255.0.



Due to the fact that we borrowed one bit and added it to the address of the subnet mask, our addresses can be represented as / 25, since now the subnet mask does not contain 24, but 25 bits. In order to better understand the concept of the subnet, consider another example. Take the IP address 192.168.100.225 and the subnet mask 255.255.255.192.



We transform the subnet mask into a binary handicap, so that it will look like this, that is, we take one more bit from the place of 64 values.



The previous division of the network number and the host number was located along the blue line, and the new division is located along the yellow line. Since the last bit is in the area of ​​64, each of the 4 subnets will turn out to have a block size of 64. That is, if the whole network of 256 is divided by 4, it turns out 64. With this block size, each subnet will have 62 valid IP addresses . This number is calculated by the formula (26-2), where 6 is the number 0 in binary terms of the last octet of the subnet mask.



In this case, the identifier of the first subnet will have the address 192.168.100.0, the second network - 192.168.100.64, the third 192.168.100.128, and the fourth 192.168.100.192. Broadcast addresses are obtained by subtracting 1 from the identifier of the subsequent network: 64-1 = 63, 128-1 = 127, 192-1 = 191 and the latter is equal to 255. These addresses can be represented with / 26, since 192 is nothing but 2 borrowed bit



I have compiled a small table of borrowings for class C IP addresses.



If we lend 1 bit, the mask value is 128, and the address of the subnet mask will be 255.255.255.128. In this case, we have 2 subnets. Where does this amount come from? It is very simple - you just need to raise 2 to a power equal to the number of borrowed bits, so 21 = 2. As can be seen from the bottom table, when borrowing 1 bit, the block size will be 128, and the number of hosts, that is, the number of valid addresses, is always early in size block minus 2, which in our case will be equal to 126.

CIDR will be equal to / 25, because if we add 1 borrowed bit to the CIDR expression for class C addresses, that is, to / 24, we get / 25.

If you borrow 2 bits, then the mask value will be 192, and the address of the subnet mask will be 255.255.255.192. From the bottom table you can see where this number 192 came from - we borrowed 1 bit of space 128 and 1 bit of space 64, and the sum of 128 and 64 is 192.

Borrowing 2 bits creates 4 subnets, because 22 = 4. The block size is 64, the number of hosts is 64-2 = 62, CIDR = / 26.

Similarly, when borrowing 3 bits: the mask is equal to 224, since borrowing 3 unit bits according to the lower table gives a total of 128 + 62 + 32 = 224, and the subnet mask address will be 255.255.255.224. In this case, we have 23 = 8 subnets with a block size of 32, the number of hosts will be 32-2 = 30, and CIDR = / 27.

Similarly, it occurs when borrowing 4.5 and 6 bits, thus forming 16.32 and 64 subnets, respectively, with the number of valid IP addresses 14.6 and 2.

I do not urge you to memorize the entire table, it is enough to remember the mask values ​​in the second line: 128, 192, 224, 240, 248 and 252, which correspond to borrowing 1,2,3,4,5 and 6 bits. Remember these numbers is quite simple. You can memorize the size of the blocks from the bottom “magic” table by simply summing the values ​​from the top row over the number of borrowed bits.

The CIDR value is also quite easy to remember if you add 1 to / 24 each time. All this concerns class C addresses; we will talk about class A and B IP addresses in the last video tutorial of the 3rd day.

For a better understanding of the principle of creating subnets, consider an example. We have the following conditions:

one). 3 subnets are required;
2). It is necessary to use class C IP addresses of the form 192.168.1.0;
3). Determine the network ID and broadcast address for each subnet.

First, we need to figure out whether the network can be divided into 3 subnets. This is impossible, since the network can be divided only into 2 or 4 subnets, the number of subnets is always an even number. Therefore, in order to get 3 subnets, we have to split the overall network into 4 segments. To do this, we have to borrow 2 bits, and since the last single bit is located in the table under the number 64, the block size of each of the 4 subnets will be 64. Taking away from 64 two, we will get 62 valid host addresses.

To get the network identifiers for each subnet, the Network ID will start at 192.168.1.0, each time adding the number 64 to the last octet:

192.168.1.0
192.168.1.64
192.168.1.128
192.168.1.192



To get Broadcast ID addresses, we will subtract one from the identifier of the following network: for the first subnet it will be 64-1 = 63, for the second one 128-1 = 127, for the third one 192-1 = 1 and for the fourth it will be 255. see, it's pretty simple. The “define Network ID and Broadcast ID” question is part of your work as a CCNA, so doing this mental calculation should be easy for you.

Usually these questions are asked at the exam, and if you now spend enough time on how to quickly perform such calculations in your mind, you will save time on exam answers so that as soon as you see such a question, you can immediately calculate the value of the network identifier and broadcast address. and give an answer.

Now let's try to answer this question: find the Network ID and Broadcast ID for the IP address 192.168.225.212/27, that is, you will be given a subnet mask for which you will need to determine the network identifier and the broadcast address. Since we have / 27, we know that according to the "magic" table, this number is obtained by borrowing 3 single bits: / 24 +1 +1 +1 = / 27, which means that each of the available subnets has a block size of 32 , that is, each of the subnets has 30 hosts.



Therefore, we will start at the address 192.168.255.0 - this will be the identifier of the first subnet, and we will begin to add 32, thus obtaining the identifiers of all the other subnets. To determine the broadcast addresses, we will need to subtract 1 from the identifier of each next network.



If we now look at the last octet of our address 192.168.225.212, then we will see that 212 is between 192 and 223, that is, this IP address is on the seventh subnet. In this case, the answer to the question will be:



At the exam, you will be asked similar questions and you will be offered 4 possible answers, and if you are good at this, you can immediately choose the correct answer and, without wasting time, move on to the next question.

Now let's look at a concept called VLSM, short for Variable Length of Subnet Mask, or "variable length of the subnet mask." In all the previous examples, we divided the network into parts of the same size, that is, the sizes of all subnets were the same. However, in many cases it is not very convenient or does not meet the needs. Let's consider an example with such conditions:

one). 3 networks are required for marketing, sales and management;
2). There are 60 computers in the network of the marketing department, 100 computers in the network of the sales department;
3). The network management department uses 34 computers.



As in the previous example, it is impossible to divide the network into 3 subnets, so we divide it into 4 subnets. But in this case, each of the subnets will have only 62 hosts, and in the sales department we have 100 computers. Since we only need 3 networks, the last fourth segment is redundant. Therefore, we will try to break the network in this way:



Now we have 126 hosts for the sales department and 62 hosts for the marketing and management departments. How did we do it?

First, we need to meet the maximum requirements, in this case, the creation of a network of 100 computers. Let us turn to the "magic" table and see how many bits we have to borrow for such a network. If you borrow 1 bit, then we get 126 valid addresses. Can we borrow 2 bits? If we do this, we will get only 62 active hosts, that is, we will not fit into the conditions of the problem. If we borrow 1 bit, we get a subnet with the following characteristics:

Network ID: 192.168.1.0 / 25
Broadcast ID: 192.168.1.127 / 25

Since we borrowed 1 bit, the next network will start with identifier 128, so the broadcast address of the first subnet will be 128 - 1 = 127. Thus, we will get 126 valid IP addresses, which will fully satisfy the needs of the sales department.

The next highest requirement is the availability of 60 computers in the marketing department. In this case, you can borrow 2 bits, because according to the table you will get a block with the size of 64 addresses, of which 62 addresses will be valid. Since the last address of the previous subnet is 127, the identifier of the subsequent network will be 128.



Then the ID of the second subnet, the subnet of the marketing department will be 192.168.1.128 / 26, and the broadcast address will be 192.168.1.191 / 26, while 191 = 128 + 62 + 1. In the previous subnet we had / 25, in this appears / 26. So, we got 62 active addresses, which is enough for 60 computers of the marketing department.

Now we turn to the management department, which has 34 computers. We cannot borrow 3 bits, because in this case, according to the table, we will receive a total of 32 addresses. We have to use a block size of 64, so we leave 2 borrowed bits. We know that the next IP address, which serves as the identifier for the third subnet, will have the number 192 at the end. Since we borrowed 2 bits and the block size is 64, the broadcast address will be 192 + 64-1 = 255.



The identifier for this network is 192.168.1.192 / 26, and the broadcast address is 192.168.1.255 / 26.

As you can see, all this is quite simple. Of course, you need to practice solving such problems, but then you can easily solve problems on this topic. Как я уже говорил, в следующем видеоуроке мы рассмотрим подсети с IP-адресами класса А и класса В и концепцию, которая носит название «суперсети». Мы также рассмотрим ряд экзаменационных вопросов CCNA и попрактикуемся в их решении. Повторю ещё раз – вы можете пересматривать это видео до тех пор, пока изложенный в нём контекст о строении подсетей не станет вам полностью понятен, и вы сможете решать эти задачи в уме, не пользуясь при этом ручкой, бумагой или калькулятором. Потому что понятно, что вы не сможете взять калькулятор на экзамен, так что даже не думайте об этом. Производите все вычисления в уме, так чтобы ответы на эти вопросы «отскакивали от зубов».

Выучите правила бинарных умножений и запомните двоичные таблицы, чтобы это стало вашей второй натурой, тогда вы легко быстро найти ответы на любые вопросы о строении подсетей.
Как я обычно говорю, если у вас остались вопросы – обращайтесь непосредственно ко мне или оставляйте свои комментарии под этим видео. Thank you for attention!


Спасибо, что остаётесь с нами. Вам нравятся наши статьи? Хотите видеть больше интересных материалов? Поддержите нас оформив заказ или порекомендовав знакомым, 30% скидка для пользователей Хабра на уникальный аналог entry-level серверов, который был придуман нами для Вас: Вся правда о VPS (KVM) E5-2650 v4 (6 Cores) 10GB DDR4 240GB SSD 1Gbps от $20 или как правильно делить сервер? (доступны варианты с RAID1 и RAID10, до 24 ядер и до 40GB DDR4).

VPS (KVM) E5-2650 v4 (6 Cores) 10GB DDR4 240GB SSD 1Gbps до весны бесплатно при оплате на срок от полугода, заказать можно тут .

Dell R730xd в 2 раза дешевле? Только у нас 2 х Intel Dodeca-Core Xeon E5-2650v4 128GB DDR4 6x480GB SSD 1Gbps 100 ТВ от $249 в Нидерландах и США! Читайте о том Как построить инфраструктуру корп. класса c применением серверов Dell R730xd Е5-2650 v4 стоимостью 9000 евро за копейки?

Source: https://habr.com/ru/post/439360/