Our today's lesson is on Classless Interdomain Routing, CIDR, another very powerful technique for efficiently utilizing IP addresses. Dividing the IP address space into A, B, C classes is inflexible. On one hand, most organization utilize class A and B space inefficiently. On the other hand, most organizations typically need more addresses that can be provided by a class C address space. Meanwhile, the IP routing table size grows quickly due to the growth in number of networks in the internet. Larger routing tables put a stress on router processing power and memory. In short term, techniques such as CIDR, new allocation policy, network address translation, they can utilize IP address more efficiently. But in long term, IPv6 with much bigger address space is a solution. CIDR uses an arbitrary prefix length to indicate the network number in place of the class flow scheme. A prefix 205.100.0.0 of length 22 is written as 205.100.0.0/22. The /22 notation indicates that a network mask is 22 bits long. With CIDR, packets are routed according to the prefix without address classes. An entry in CIDR routing table contains 32-bit IP address and a 32-bit mask. CIDR enables supernetting technique to allow a single routing entry to cover a block of classful addresses. For example, a company is allocated a four contiguous/24 networks, 128.56.24.0, 128.56.25.0, 125.56.26.0, and 128.56.27.0. At some router, it is often true that all of these four networks use the same outgoing line. CIDR aggregation can be done to reduce the number of entries at the router. CIDR scheme converts the four/22 network addresses into binary streams, performs per-bit and logical operation, and resulted 128.56.24.0/22. That is resulted a single prefix for all four/24 networks. Before CIDR, four networks, and therefore four entries needed in the router for this company. But after CIDR, only one entry needed in the router. CIDR was proposed to deal with routing table explosion problem. By CIDR, networks are represented by prefix and mask. It has summarized our contiguous group of class C addresses using variable-length mask, if all of them use the same outgoing line. Routing is performed according to the prefix of address instead of class. For example, IP address and mask in 122.32.136.0/21 stands for to do one-bit IP mask. By IP masking, it represents a network with a minimal IP address 192.32.136.1 to the maximum IP address 192.32.143.254. You may be able to figure out that it indeed represents eight class C networks from 192.32.136.0/24 to 192.32.143.0/24. CIDR summarize our contiguous group of class C addresses using variable-length mask. Let's look at an example 150.158.16.0/20. So last 20 stands for 20 bits IP mask. By IP masking, we can find it that it represent 16 C networks from 150.158.16.0/24 to 150.158.31.0/24. In the second example, a router has the following CIDR entries in its routing table. Address with mask 128.56.24.0/22 corresponds to interface zero. Address with mask 128.56.60.0/22 corresponds to interface two. Default goes to router two. The question is, if a packet coming with IP address of 128.56.63.10, what does this router do? First, the address 128.56.63.10 is converted into a binary string. Then, 22 bits IP masking is performed, that is to perform per-bit logical and operation between the binary string with the 22 bits IP mask. The resulting binary string corresponds to 128.56.60.0. There is a match in the routing table, and the packet is forwarded to the interface one. New address allocation policies were proposed to capitalize on CIDR ability to aggregate routers and reduce routing table size. Classes A and B are assigned only for clearly demonstrated need. Consecutive blocks of class C is assigned up to 64 blocks so that all IP address in the range have a common prefix. By CIDR aggregation, only one entry is required for this blocks. Address assignments should reflect the physical topology of the network to facilitate the aggregation of logical packet flows into physical flows. The use of variable-length prefixes require that the routing table be searched to find the longest prefix match when multiple entries match up given IP address. For example, 3/24 IP addresses, 128.56.24.0/24 to 26.0/24 to 27.0/24, all belong to company A, but the network 128.56.24.0/24 belongs to a different company with a different port number. By CIDR aggregation on the three networks of the company A, we can get 128.56.24.0/22. Now, if a packet with destination IP address 128.56.24.1 comes, which port should we route this packet to? The problem is, it will match both entries as shown here. The longest prefix match requires our packet must be routed using the most specific route. That is, 128.56.24.0/24. And the packet is forward by port zero. Please note that several fast longest prefix matching algorithms are available for implementation. This concludes today's lesson.