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 184.108.40.206 of length 22 is written as 220.127.116.11/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, 18.104.22.168, 22.214.171.124, 126.96.36.199, and 188.8.131.52. 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 184.108.40.206/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 220.127.116.11/21 stands for to do one-bit IP mask. By IP masking, it represents a network with a minimal IP address 18.104.22.168 to the maximum IP address 22.214.171.124. You may be able to figure out that it indeed represents eight class C networks from 126.96.36.199/24 to 188.8.131.52/24. CIDR summarize our contiguous group of class C addresses using variable-length mask. Let's look at an example 184.108.40.206/20. So last 20 stands for 20 bits IP mask. By IP masking, we can find it that it represent 16 C networks from 220.127.116.11/24 to 18.104.22.168/24. In the second example, a router has the following CIDR entries in its routing table. Address with mask 22.214.171.124/22 corresponds to interface zero. Address with mask 126.96.36.199/22 corresponds to interface two. Default goes to router two. The question is, if a packet coming with IP address of 188.8.131.52, what does this router do? First, the address 184.108.40.206 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 220.127.116.11. 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, 18.104.22.168/24 to 26.0/24 to 27.0/24, all belong to company A, but the network 22.214.171.124/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 126.96.36.199/22. Now, if a packet with destination IP address 188.8.131.52 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, 184.108.40.206/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.