Training Cisco 200-125 CCNA v3.0. Cisco Certified Network Specialist (CCNA). Day 3. Subnets
  • Transfer
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 -, that is, there are 16,777,216 private IP addresses of this class. Class B for private addresses has a range of -, and their total number is 1,048,576. In Class C, these addresses are in the range of -, 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, 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 and a subnet mask of

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

From the previous video tutorial, we know that the separation into network number and host number for this class of addresses occurs after the third octet, and three octets from the units in the subnet mask mean nothing else / 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 and the subnet mask

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, 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, and for the second network identifier it will be 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

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 and the subnet mask

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, the second network -, the third, and the fourth 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 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 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 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 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, when borrowing 4.5 and 6 bits, this forms 16.32 and 64 subnets, respectively, with the number of valid IP addresses 14.6 and 2.

I do not urge you to remember the entire table, it’s 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:

1). 3 subnets are required;
2). It is necessary to use class C IP addresses of the form;
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 IDs of each Network ID subnet, we start at, adding the number 64 each time in the last octet:

To get Broadcast Broadcast ID addresses, we will take one from the next network ID : 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 the number 255. As you can see, it is quite 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, 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 - 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, 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 such questions and 4 options will be offered, and if you are good at it, 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:

1). 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 will 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: / 25
Broadcast ID: / 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 / 26, and the broadcast address will be / 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 / 26, and the broadcast address is / 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. As I have already said, in the next video tutorial we will look at the subnets with IP addresses of class A and class B and the concept that is called the “super network”. We will also review a number of CCNA exam questions and practice their solutions. I repeat once again - you can review this video until the context described in it about the structure of subnets becomes completely clear to you, and you can solve these problems in your mind without using a pen, paper or calculator. Because it is clear that you can not take a calculator for the exam, so do not even think about it. Do all the calculations in your mind so that the answers to these questions "bounce off the teeth."

Learn the rules of binary multiplications and memorize binary tables so that it becomes your second nature, then you can easily quickly find answers to any questions about the structure of subnets.
As I usually say, if you have any questions, please contact me directly or leave your comments under this video. Thank you for attention!

Thank you for staying with us. Do you like our articles? Want to see more interesting materials? Support us by placing an order or recommending to friends, 30% discount for Habr users on a unique analogue of the entry-level servers that we invented for you: The whole truth about VPS (KVM) E5-2650 v4 (6 Cores) 10GB DDR4 240GB SSD 1Gbps from $ 20 or how to share the server? (Options are available with RAID1 and RAID10, up to 24 cores and up to 40GB DDR4).

VPS (KVM) E5-2650 v4 (6 Cores) 10GB DDR4 240GB SSD 1Gbps until spring for free if you pay for a period of six months, you can order here .

Dell R730xd 2 times cheaper? Only we have 2 x Intel Dodeca-Core Xeon E5-2650v4 128GB DDR4 6x480GB SSD 1Gbps 100 TV from $ 249in the Netherlands and the USA! Read about How to build an infrastructure building. class c using servers Dell R730xd E5-2650 v4 worth 9000 euros for a penny?

Also popular now: