Network basics Lecture 2: Understanding subnet and CIDR

Source: Internet
Author: User

Welcome to the second lecture on this network. This time, we will learn about subnets and CIDR (classless Inter-Domain Routing. We hope to learn this knowledge more easily than some books provide.
Let's first figure out one thing: there is no "category" in the subnet. In the past, networks were divided into Class A, Class B, and class C. These networks can only be divided into equal parts. Therefore, we have introduced a variable length Subnet Mask (VLSM) to solve this problem. The Class C network in the old category is A 24-bit network address, the Class B network is A 16-bit network address, and the class A network is an 8-bit network address (if you do not know this meaning, see "Understanding IP addresses ). This is all about the network. These network types no longer exist.
An IP address consists of a host and a network. When used with the subnet mask, you can determine which part of the address is the network part, where the network is large and where the network starts. The operating system needs to know the information to determine the IP addresses used by the local subnet and the addresses that belong to the Internet, and a vro is required to access those addresses. Adjacent routers also need to know the size of the subnet so that these routers can only send appropriate communications to this direction. The division of the host part and the network part in a network address is completely determined by the subnet mask.
The network address that CIDR pronounced as "cider" adopts the Network/subnet mask style. The combination of this IP address/subnet mask can tell you a lot of information:
Network/Host
0000000000000000/0000000000000000
The above 32-bit string represents a 16-bit network because the 16-bit address is masked.
In this example (and the real world), some subnet masks are repeatedly mentioned. These subnet masks are not special. A subnet address is a simple 32-Bit String, where any number of digits is masked by the MASK ). However, the use of a common Subnet Mask (such as a 24-bit network address) began to study the concept and division of the subnet for memory and understanding is very beneficial.
Let's take a look at a standard subnet Partition Table, which also contains some interesting Other information:

Subnet Mask count 24Number of bit subnets Number of addresses in a subnet Bit misappropriation of the host
/24 1 256 0
/25 2 128 1
/26 4 64 2
/27 8 32 3
/28 16 16 4
/29 32 8 5
/30 64 4 6
/31 128 2 7

Because it is a binary number, a 31-bit network has two available IP addresses. Imagine this subnet: 2.2.2.0/31. If we express the network address in binary format, the address looks like this:
00000010.00000010.00000010.00000000 (2.2.2.0)
11111111.11111111.1111111111.111110 (31)
The number of digits that the subnet mask uses to mask the network. This means that the hidden digits will be used in the network address section. The number of digits available for the host address is 1. This number can be either 0 or 1. This results in two available IP addresses, as shown in the preceding table. In addition, as shown in the preceding table, the number of available addresses in the subnet mask (from the host part) is halved each time one is added.
Now let's analyze the broadcast address, network address, and mask of "192.168.0.200/26. The mask for this IP address is very simple: 255.255.192 (the 26-bit subnet mask means that the host uses 6 bits, and the 6 power of 2 equals 64,255 minus 64 minus 1 equals 192 ). You can find the subnet address table on the network. This table also lists all the information for you. However, we are more interested in teaching people to understand what is happening here. This subnet mask tells you that the only thing we need to care about in this network address is the last byte: the broadcast address and the network address start with 192.168.0.
The meaning of the last byte is like dividing a 24-bit network. However, if this prompt does not help you, you do not even need to consider this issue. Each 26-bit network has 64 hosts. The network address range is from. 0 to. 63, from. 64 to. 127, from. 128 to. 191, and from. 192 to. 255. Our address 192.168.0.200/26 is in the. 192 to. 255 CIDR block. Therefore, the network address is 192.168.0.192/26. This broadcast address is simpler: 192 is expressed as 11000000 in binary format. Take the last six digits (these bytes are "disabled" by the mask) and "open" These bytes. What do you get? 192.168.0.255. Check whether you have understood all this. Now, calculate the network address and broadcast address of 192.168.0.44/26. (Network Address: 192.168.0.0/26; broadcast address: 192.168.0.63 ).
These addresses are hard to be viewed at first. It is helpful to create a table. If you calculate that each subnet has six hosts (eight hosts are unavailable for networks and broadcast addresses), you can create the following table. The following are 2.2.2.0/29, 2.2.2.8/29, 2.2.2.16/29, and the last subnet is 2.2.2.249/29.

Subnet ID Network Address First IP Address Last IP Address Broadcast address
1 2.2.2.0 2.2.2.1 2.2.2.6 2.2.2.7
2 2.2.2.8 2.2.2.9 2.2.2.14 2.2.2.15
3 2.2.2.16 2.2.2.17 2.2.2.22 2.2.2.23
32 2.2.2.249 2.2.2.250 2.2.2.254 2.2.2.255

In fact, you may find such a network occasionally. This network is divided into three 26-bit network addresses, and the last 26-bit network address is divided into two 27-bit network addresses. If you are able to create the above table, it will be easier to understand this problem.
This is all you need to know. It is complicated to use a larger subnet within the range of a 16-bit network address and a 24-bit network address. However, the principles are the same. It is a 32-bit address and a subnet mask. However, you must be aware that the use of subnets is subject to certain restrictions. We cannot allocate a 26-bit network address starting with 10.1.0.32. If we send the IP address and subnet mask of 10.1.0.32/26 to most operating systems, the operating system will only consider that the starting address we send is 10.1.0.0/26. This is because the 26-bit address space requires 64 addresses, and the subnet division starts from the natural dividing line of this number of digits. Because, if in the preceding table, do you set a subnet to start from 2.2.2.3/29? The actual result is 2.2.2.0/29.
A concise example is required for these complex problems. Remember how the number of IP addresses in a subnet is halved when you extract another IP address from the network host to create a larger subnet mask. This principle also plays a role in the opposite circumstances. If we have a 25-bit network address with 128 hosts and misappropriates one of them from the Network (mask), we now have a 24-bit network address with 256 hosts. Search for "subnet table" (subnet table) on the Internet using the search engine Google. You can immediately see the relationship between the subnet mask and the network size. If a 16-bit network address has 65535 addresses, the network address of a 17-bit network address will be halved, and the network address of a 15-bit network address will be doubled. This is very exciting. Practice, practice, and practice. This is a good way for you to understand this principle. Don't forget that all problems can be attributed to the number of digits in the network.
If you want to learn more about subnets, the next step is to read some routing protocols.
Summary
• The cidr ip address consists of a host and a network. However, the subnet mask specifies the number of digits used by the network. These bits in the address will not change.
• A subnet is created by simply moving up and down the network and dividing the host part in a 32-bit number.
• If you start learning from a known subnet mask, it is easy to understand complex addresses. A 17-bit network address is half of a 16-bit network address. There are 65 thousand addresses in a 16-bit network.


One of the basic network knowledge lectures: understanding the meaning of IPv4 addresses

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.