CSC521 Communication Protocols 網 路 通 訊 協 定 Ch.9 Classless And Subnet Address Extensions (CIDR) 吳 俊 興 國 立 高 雄 大 學 資 訊 工 程 學 系
Outline 1. Introduction 2. Review Of Relevant Facts 3. Minimizing Network Numbers 4. Proxy ARP 5. Subnet Addressing 6. Flexibility In Subnet Address Assignment 7. Variable-Length Subnets 8. Implementation Of Subnets With Masks 9. Subnet Mask Representation 10. Forwarding In The Presence Of Subnets 11. The Subnet Forwarding Algorithm 12. A Unified Forwarding Algorithm 13. Maintenance Of Subnet Masks 14. Broadcasting To Subnets 15.Anonymous Point-To-Point Networks 16.Classless Addressing And Supernetting 17.CIDR Address Blocks And Bit Masks 18.Address Blocks And CIDR Notation 19.A Classless Addressing Example 20.Data Structures And Algorithms For Classless Lookup 21.Longest-Match And Mixtures Of Route Types 22.CIDR Blocks Reserved For Private Networks 23. Summary 2
Recall: Classful Addressing In the original IP addressing scheme: network prefix + host suffix each physical network is assigned a unique network address each host on a network has the network address as a prefix of the host's individual address Routers only examine prefix (small routing tables) 3
Network-prefix Minimization Problem Question: How can we minimize the number of assigned network prefixes (especially class B) without abandoning the 32-bit addressing scheme? Two Answers: Proxy ARP Subnet addressing 4
Proxy ARP: Layer-2 Solution Arrange special system to answer ARP requests and forward datagrams between networks Hosts think they are on same network Allow two physical networks to share a single IP prefix Known informally as the ARP hack Assessments Chief advantages Transparent to hosts No change in IP routing tables Chief disadvantages Does not generalize to complex topology Only works on networks that use ARP Most proxy ARP systems require manual configuration 5
Subnet Addressing Subdivides the host suffix into a pair of fields for physical network and host Allows an organization to use a single network prefix for multiple physical networks Interpreted only by routers and hosts at the site; treated like normal address elsewhere Both physical networks share prefix 128.10 Router R uses third octet of address to choose physical net Address Mask: Each physical network is assigned 32-bit address mask (also called subnet mask) 6
Use of Address Masks Each entry in routing table also has address mask All-1s mask used for host-specific routes Network mask used for network-specific routes Subnet mask used for subnet-specific routes All-0s mask used for default route Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.158 20 (Default) 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1 (Loopback) 192.168.0.158 255.255.255.255 127.0.0.1 127.0.0.1 20 (Local) 192.168.0.0 255.255.255.0 192.168.0.158 192.168.0.158 20 (LAN) 192.168.0.255 255.255.255.255 192.168.0.158 192.168.0.158 20 (Broadcast) 7
Problems Continued exponential Internet growth Dire prediction (1993): We will exhaust the address space ''in a few years''. Note: address space is not near exhaustion Subnetting insufficient Limited IP addresses (esp. Class B) Further Motivation For CIDR: aggregating class C Limitation of classful addressing Fewer than seventeen thousand Class B numbers (total 2 14 ) More than two million Class C network numbers (2 21 ) Flexibility of CIDR Network Addressing Problems Merging 256 Class C numbers into a single prefix that is equivalent to Class B Splitting a Class B along power of two boundaries Solution to problem Temporary fix until next generation of IP Backward compatible with classful addressing 8
Classless Inter-Domain Routing (CIDR) CIDR Idea: permit arbitrary-length network prefixes CIDR Techniques: Extended Addressing: subnet + supernet blocks of address numbers Forwarding (longest-prefix matching) Route propagation (condensation) CIDR was predicted to work ''for a few years'' Extremely successful! Will work for at least 25 years! 9
Supernetting Supernetting: assigning a block of contiguous class C numbers Route Proliferation Example: a block of 256 contiguous class C numbers (equal to a class B) supernetting: single CIDR prefix spans 256 Class C network numbers Classful routing table requires 256 separate entries for each class C If classful forwarding used, CIDR addresses result in more routes 10
CIDR Block and Slash Notation Network Addresses written NUMBER / m NUMBER is IP prefix; m is ''address mask'' length Example 214.5.48.0 / 20 Prefix occupies 20 bits Suffix occupies 12 bits 128.211.168.0/21 Mask values must be converted to dotted decimal when configuring a router (and binary internally) 11
Dotted Decimal Equivalents Example of / 30 block: 128.211.176.212/30 useful when customer of ISP has very small network 12
CIDR Forwarding Implementation Of CIDR Route Lookup Each entry in routing table has address plus mask Search is organized from most-specific to least-specific (i.e., entry with longest mask is tested first) Known as longest-prefix lookup or longest-prefix search Implementing Longest-Prefix Matching Cannot easily use hashing Data structure of choice is binary trie Identifies unique prefix needed to match route Example of Unique Prefixes 13
Route Propagation Route Exchange: route per CIDR block Store address mask with each route Send pair of (address, mask) whenever exchanging routing information Route Condensation (Aggregation) Multiple subnets of common prefixes are aggregated into a larger subnet Examples: 140.127.208.0/24 Dept. Office 140.127.208.0-140.127.208.39 Prof's Offices 140.127.208.40-140.127.208.63 Computer Room 140.127.208.64-140.127.208.127 4F (Labs) 140.127.208.128-140.127.208.255 How to divide 140.127.208.0/24 into two subnets of equal size? Ans. 140.127.208.0/25 and 140.127.208.128/25 14
Summary Two extensions to original classful IP addressing scheme Subnet addressing CIDR addressing Both use 32-bit address mask Subnetting used only within a site CIDR used CIDR mask identifies division between network prefix and host suffix Subnet mask identifies boundary between subnet and individual host CIDR Techniques Extended Addressing: subnet + supernet blocks of address numbers Forwarding (longest-prefix matching) Route propagation (condensation) 15