Classless Interdomain Routing (CIDR)

IP Address Problems

  • IP Address Exhaustion
    • Class A, B, and C address structure inefficient
    • Class B too large for most organizations, but future proof
    • Class C too small
  • IP routing table size
    • Growth in # of networks in Internet reflected in # of table entries
    • Stress on router processing power and memory allocation
  • Short-term solution:
    • Classless Interdomain Routing (CIDR), RFC 1518
    • New allocation policy (RFC 2050)
    • Private IP Addresses set aside for intranets(企业内部网) (NAT)
  • Long-term: IPv6 with much bigger address space

Classless Interdomain Routing Scheme

  • CIDR uses an arbitrary(任意的) prefix length to indicate the network number
    • 205.100.0.0/22
    • /22 means mask: 11111111 11111111 11111100 00000000 - 255.255.252.0,means the mask is 22 bits long
  • Packets are routed according to the prefix w/o address classes
    • An entry in CIDR routing table contains 32-bit IP address and 32-bit mask
  • Enables supernetting to allow a single routing entry to cover a block of classful addresses

CIDR Aggregation(聚合)

  • A company is allocated the following four contiguous(相邻的) /24 networks. At some router, it is often true that all of the four networks use the same outgoing line. CIDR aggregation can be done to reduce the number of entry at the router.
    • 128.56.24.0/24; 10000000 00111000 00011000 00000000
    • 128.56.25.0/24; 10000000 00111000 00011001 00000000
    • 128.56.26.0/24; 10000000 00111000 00011010 00000000
    • 128.56.27.0/24. 10000000 00111000 00011011 00000000
      By Per-bit AND
    • 128.56.24.0/22 10000000 00111000 00011000 00000000
      (Instead of 4 entries in routing table, one entry is sufficient by CIDR)

CIDR Scheme and Range

  • CIDR deals with Routing Table Explosion Problem
    • Networks represented by prefix and mask
    • Summarize a contiguous group of class C addresses using variable-length mask, if all of them use the same outgoing line
  • Solution: Route according to prefix of address, not class
    • Routing table entry has <IP address, network mask>
    • Example: 192.32.136.0/21
    • 11000000 00100000 10001000 00000001 min address
    • 11111111 11111111 11111--- -------- mask
    • 11000000 00100000 10001--- -------- IP prefix
    • 11000000 00100000 10001111 11111110 max address
    • Eight C networks: 192.32.136.0/24 to 192.32.143.0/24

CIDR Supernetting Example (1)

  • Summarize a contiguous group of class C addresses using variable-length mask
  • Example: 150.158.16.0/20
    • IP Address (150.158.16.0) & mask length (20)
    • IP address = 10010110 10011110 00010000 00000000
    • Mask = 11111111 11111111 11110000 00000000
    • Contains 16 Class C blocks:
    • From 10010110 10011110 00010000 00000000
      i.e. 150.158.16.0/24
    • Up to 10010110 10011110 00011111 00000000
      i.e. 150.158.31.0/24

CIDR Supernetting Example (2)

  • A router has the following CIDR entries in its routing table:

    • Address/mask - - - - -Next hop
    • 128.56.24.0/22 - - - - - Interface 0
    • 128.56.60.0/22 - - - - -Interface 1
    • default - - - - -Router 2
    A packet comes with IP address of 128.56.63.10. What does the router do?
  • 128.56.63.10 and mask 22 bits
  • First, the address will be transform into binary, then use MASK by AND operation to get the prefix, finally it will match the table, if match a interface, go to it.
    • IP address = 10000000 00111000 01111111 00001010
    • Mask = 11111111 11111111 11111100 00000000
      By Per-bit AND
    • Prefix = 10000000 00111000 01111100 00001010
      i.e. 128.56.60
    • Router table lookup and match, should go to interface 1

New Address Allocation Policy

  • Class A & B assigned only for clearly demonstrated need
  • Consecutive(连续的) blocks of class C assigned (up to 64 blocks)
    • All IP addresses in the range have a common prefix, and every address with that prefix is within the range
    • Arbitrary prefix length for network ID improves efficiency
  • Address assignment should reflect the physical topology of the network
    • Facilitates the aggregation of logical packet flows into physical flows

1092889-20171012195947027-85041479.png

Longest Prefix Match

  • By CIDR, multiple entries may match a given IP destination address ,but different prefix
  • Example: perform CIDR on the following three /24 IP addresses (but 128.56.24.0/24 to a different port)
    • 128.56.25.0/24;
    • 128.56.26.0/24;
    • 128.56.27.0/24;
    • By CIDR aggregation(Per-bits AND): 128.56.24.0/22
    • What if a packet with destination IP address 128.56.24.1 comes? It belongs to another port

Example of Longest Prefix Match

1092889-20171012200045746-220870528.png

转载于:https://www.cnblogs.com/vancasola/p/7667704.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值