This article is a mirror article of machine translation, please click here to jump to the original article.

View: 4147|Reply: 5

[Source] CIDR: Read the CIDR address description in one article

[Copy link]
Posted on 10/7/2023 8:56:29 PM | | | |
definition

CIDR, the full name in English is Classless InterDomain Routing. Chinese means classless inter-domain routing. is a method of assigning IP addresses and IP routing. A collection of Internet Protocol (IP) standards used to create unique identifiers for networks and individual devices. IP addresses allow unique packets of information to be transmitted to a specific computer.



CIDR is mainly used to use IP addresses to efficiently solve routing table explosions. It is defined in RFC (Request for Comments) 1518 and RFC 4632. It is an address block assignment. There are five different classes in the IPV4 addressing system. The IP address class is used for internet IP address assignment.
They are Class A addresses, Class B addresses, Class C addresses, Class D addresses, and Class E addresses.
  • Class A addresses: In category A, consider the first place. It is always set to zero. It can change IP addresses from 1.X.X.X to 126.X.X.X.
  • Class B addresses: In category B, consider the first two. It can get an IP address from 128.0.X.X to 191.255.X.X.
  • Class C addresses: In category C, consider the top three. It can get the IP address from 192.0.0.X to 223.255.255.X.
  • Category D addresses: Consider the top four positions of Class D. It can get an IP address from 224.0.0.0 to 239.255.255.255. This class is used for multicasting.
  • Class E addresses: Class E IP addresses are reserved for research and development. It can change IP addresses from 240.0.0.0 to 255.255.255.254.


Therefore, we can choose the IP address according to our needs. For host addresses, we use IP addresses of class A/B/class C.

Currently, network address ranges use classless inter-domain routing. By using CIDR, the old method of using Class A, Class B, and Class C IP addresses is replaced. In the older method, if we take class B as an example, since it is used the most. If any agency or any organization needs hosts, they are provided with hosts, but in most cases, all assigned hosts are not used and even cause routing tables to explode.

In CIDR, people who need IP addresses must purchase an IP address allocator from a service provider; It can be any size requested by the buyer. Whenever it is enabled based on address prefixes, it allows different routers of different levels to route on prefixes of different lengths. CIDR is used for IPV4. IPV4 is 32-bit,The most commonly used networks are /8, /16, /24, and /32

How does CIDR work?

CIDR is an alternative to traditional subnetting. It is also known as classless addressing. It consists of CIDR blocks; In this way, it dynamically assigns IP addresses according to the user's requirements according to certain rules. The Internet Assigned Numbers Authority (IANA) handles the assignment of CIDR blocks.

Network segments

This block contains the IP address. The block consists of 3 basic rules.

The 3 basic rules mentioned below:

Rule 1: In a CIDR block, the IP addresses assigned to the host should be contiguous.
Rule 2: Blocks should be 2 powers of size and should be equal to the total number of IP addresses.
Rule 3: The size of the block must be divisible by the first IP address of the block.

CIDR notation

CIDR IP addresses are represented in the same form as IP addresses; It ends with a backslash followed by a number. n represents the number of bits in the network. It is known as an IP network prefix.
The general expression of the IP address of the CIDR segment is A.B.C.D/N

illustrate

If we are given a CIDR representation, we can find the range of IP addresses.
We can see this with an example.

Example #1

The CIDR representation is 21.19.35.40/24. Find the IP address of the CIDR segment?
24 indicates the number of bits used to identify the network.
These 5 digits are used to identify the host.
The network block address is 21.19.35.40/24.
The first IP address is 21.19.35.0
The last IP address is 21.19.35.255
The total cost is 256.
The netmask is 255.255.255.0.

Example #2

The representation is 255.255.255.255/31. Find the IP address of the CIDR segment?
31 indicates the number of bits used to identify the network.
1 digit is used to identify the host.
The network block address is 255.255.255.255/31.
The first IP address is 255.255.255.254
The last IP address is 255.255.255.255
The total cost is 2.
The netmask is 255.255.255.254.
We can find the CIDR block from the IP address block.

Example #3

The IP addresses range from 21.19.35.64 and 21.19.35.127. Find the network segment?
The IP addresses range from 21.19.35.64 and 21.19.35.127.
Before going any further, it should be checked if the CIDR block rules mentioned above are satisfied, then it is a CIDR block.
So the size of the block is 26. (i.e. 127 – 64 + 1 = 64)
Number of digits = 32 – 6 = 26.
The network segment is 21.19.35.64/26.

Example #4

The IP addresses range from 255.255.255.32 and 255.255.255.63.
The IP addresses range from 255.255.255.32 and 255.255.255.63.
Before going any further, it should be checked if the CIDR block rules mentioned above are satisfied, then it is a CIDR block.
So the size of the block is 25. (i.e. 63 – 32 + 1 = 64)
Number of digits = 32 – 5 = 27.
The network segment is 255.255.255.32/27.

Original:The hyperlink login is visible.





Previous:CentOS Linux alternatives Rocky Linux, AlmaLinux
Next:ASP.NET Core (twenty-five) dependencies inject Lazy lazy lazy initialization
 Landlord| Posted on 10/7/2023 8:57:32 PM |
Many users do not understand the meaning of the last set of numbers (mask bits) after the server assigns IP, let's explain it briefly.

If the IP mask number is /32, 192.168.1.100/32 means that only 192.168.1.100 IP address is available.

The specific number of available IPs depends on the network structure of the data center, such as gateways and broadcast IPs, which occupy resources in the network segment.

/32(1个IP)

/31(2个IP)

/30(4个IP)

/29(8个IP)

/28(16个IP)

/27(32个IP)

/26(64个IP)

/25(128个IP)

/24(256个IP)

/23(512个IP)

/22(1024个IP)

/21(2048个IP)

/20(4096个IP)

/19(8192个IP)

/18(16384个IP)

/17(32768个IP)

/16(65536个IP)

/15(131072个IP)

/14(262144个IP)

/13(524288个IP)

/12(1048576个IP)

/11(2097152个IP)

/10(4194304个IP)

/9(8388608个IP)

/8(16777216个IP)
 Landlord| Posted on 10/7/2023 9:08:07 PM |
CIDR is mainly used to use IP addresses to efficiently solve routing table explosions. It is defined in RFC (Request for Comments) 1518 and RFC 4632. It is an address block assignment. There are five different classes in the IPV4 addressing system. The IP address class is used for internet IP address assignment.
 Landlord| Posted on 10/14/2023 11:11:23 AM |
Reserve the IP address CIDR block of the IPv4 private network
https://www.itsvse.com/thread-10679-1-1.html
 Landlord| Posted on 9/9/2024 9:09:09 AM |
Convert the CIDR notation of the subnet mask (e.g., /24) to the dot-decimal notation (e.g., 255.255.255.0). Below I will explain this conversion process.

For /24:

  • First, understand that the number in CIDR notation (24 here) represents the length of the network prefix. It indicates how many consecutive bits in the subnet mask are 1.
  • An IP address consists of 32 bits. Therefore, /24 means there are 24 consecutive "1" bits, and the remaining 8 bits are all "0".


Next, we divide these 24 "1" bits and 8 "0" bits into 4 8-bit bytes and convert them to decimal numbers:

  • The first 8-bit byte: all 1 (8 bits) in decimal is 255
  • The second 8-bit byte: all 1 (8 bits) and the decimal representation is 255
  • The third 8-bit byte: all 1 (8 bits) and 255 in decimal
  • The fourth 8-bit byte: all 0 (8 bits in total), and the decimal represented as 0


Combining these gives the subnet mask: 255.255.255.0

So, the subnet mask for /24 is 255.255.255.0.

 Landlord| Posted on 11/8/2024 8:41:07 AM |
Typically, the IP addressThe last digit cannot be 0 or 255。 This is because these specific IP addresses have a special purpose.

  • The last digit of an IP address with 0 is often used as a network address, indicating the starting address of the entire network.
  • The last digit of an IP address is 255 and is often used as a broadcast address to send packets to all devices in the same network.

Therefore, in general, these special addresses should not be assigned to hosts or routers. They are special addresses that are reserved for network protocols and administrative purposes.

hypothesis
If a CIDR segment is 172.16.0.0 and its mask is 255.255.254.0, then its host available address range is 172.16.0.1 to 172.16.1.254, that is, 172.16.1.0 and 172.16.0.255 are not allocated.
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com