Announcements SUBNETS, CIDR, AND CLASSLESS ADDRESSING Internet Protocols CSC / ECE 573 Fall, 005 No office hours tomorrow (Wednesday) out of town No class on Thursday Fall break! Midterm exam next Tuesday! Study guide is online, as well as old exams HW3 Part solutions will be online today N C State University copyright 005 Douglas S Reeves Today s Lecture I Problems with Classful Addresses II Subnetting III Supernetting CLASSFUL ADDRESS PROBLEMS IV CIDR V IP Routing example copyright 005 Douglas S Reeves 3 Class A B C Classful Addresses (Review) 0 Network ID 0 3 0 7 4 Network ID ID 4 Network ID ID 6 8 ID Classful Addressing Issues Three Bears problem class A (6M hosts) too large for most organizations, and there aren t very many of them (8) class C (54 hosts) too small for most class B (65,534 hosts) is just right, but there aren t enough of them (6,384) Class A B C Potential Number of Networks 7 (8) 4 (6K) (M) Potential Number of s Per Network 4 (6M) 6 (64K) 8 (56) Flat host ID part of the address means very large routing tables within an organization eg, one network with 50,000 hosts each router has to know 50,000 routes?! copyright 005 Douglas S Reeves 5 copyright 005 Douglas S Reeves 6
A Hypothetical Solution: Redefine Class C Eg, use 9 bits for network ID, 0 bits for host ID result: 5K such networks, each with 0 host addresses Problem: not backwards compatible with original addressing scheme ie, old class B and C address space allocations would have to be reclaimed and reassigned copyright 005 Douglas S Reeves 7 An Actual Solution: Assign Multiple Networks Assign one organization multiple class C networks Eg, an organization having 000 hosts would get 4 class C networks (4 * 54 host addresses = 06 > 000) Problem: no longer have one network address for one organization increases routing table sizes for routing between organizations is that serious? Doesn t fix massive size of class A networks copyright 005 Douglas S Reeves 8 Requirements for Address Modifications Any solution should be backwards compatible with the original addressing scheme Each organization should be free to interpret the host ID part of its addresses any way it wishes only the network ID part of addresses is used by other organizations SUBNETTING If there is a new interpretation of the host ID all hosts and routers in the organization s network must use the new addressing scheme the internal routing protocol must support this new scheme copyright 005 Douglas S Reeves 9 Subnet Addressing (RFCs 950, ) Particularly useful for class B sized networks Example local (internal) part 0 6 4 3 0 Network ID Subnet ID ID ID Internet (external) part Address of the physical network Result: three-level hierarchical addressing good for routing inside an organization (reduces the size of internal routing tables) network structure not revealed to outsiders, since structure of local part only locally known copyright 005 Douglas S Reeves Subnet Addressing (cont d) Result: large organizations may have many separate LANs, sharing a single network address network administrators must decide how many bits to allocate to the subnet ID and host ID s must support this capability Does not change classful addressing only affects interpretation of local (internal) part of address copyright 005 Douglas S Reeves
Example: Without Subnetting Example: With Subnetting 445 449 4437 447 44703 445 449 4437 subnet 440 447 44703 Router R Network 4400 Router R subnet 440 subnet 4470 44 443 446 4470 to network 4400 44 443 446 4470 copyright 005 Douglas S Reeves 3 copyright 005 Douglas S Reeves 4 How Long is the Subnet ID? ing (Bitwise-AND Operation) ing: the process of extracting a portion of the IP address subnet masking: extracting the subnet ID masks are 3 bits long for IPv4 addresses If a bit in a subnet mask = this bit position is part of the physical network ID (network ID + subnet ID) 0 this bit position is part of the host ID How split physical network ID into network and subnet parts? without subnetting with subnetting copyright 005 Douglas S Reeves 5 copyright 005 Douglas S Reeves 6 Example Step : determine network ID IP Address = 44 Use first bits to determine it s a Class B address Step : determine physical network address IP Address = 44 with subnet mask 5555550 Step 3: determine subnet ID Physical Network = 44, Class B address = 44 Network ID = 44 Physical Network = 44 Subnet ID = Questions How can you tell if a destination IP address is On the same subnet as you??? On the same network as you??? copyright 005 Douglas S Reeves 7 copyright 005 Douglas S Reeves 8 3
Special Addresses (Subnetting) Possible Subnet Sizes for a Class B Network Net ID (normal) Subnet ID (normal) ID All s Description Broadcast to a specific subnet # of bits for subnet ID 0 (ie, subnetting not used) 3 # of subnets possible 3 # of hosts / subnet 6-5 - 4-3 - What happened to 5 bits for subnet ID??? 3 4 3 4 3 = 4 = copyright 005 Douglas S Reeves 9 What happened to 6 bits for subnet ID??? copyright 005 Douglas S Reeves 0 Subnet Routing Recommendations Use simple subnet masks (sequence of all s followed by string of all 0 s) eg, 00000000 is not OK Use the same mask for all subnets of the network 3 All subnets should be physically contiguous (connected) drawbacks? Forwarding Decisions with Subnetting Reminder: a forwarding table consists of <key, next IP address> entries key in forwarding table entries needs to consist of a mask a network identifier Examples for network 5400 mask = 555500, identifier = 5400 for subnet 540 mask = 5555550, identifier = 540 copyright 005 Douglas S Reeves copyright 005 Douglas S Reeves Forwarding Decisions (cont d) Forwarding Table Example Steps in determining a forwarding table match (in order of the table entries) AND the packet s destination IP address with the mask compare the result to the identifier to see if there is a match 3 use the first match found 55555555 555500 0000 Destination Identifier 5455 5400 0000 Next hop IP address Which entry does 5455 match? Which entry does 5459 match? Which entry does 5436 match? Which entry does 530 match? Why choose this ordering of the routing table entries? copyright 005 Douglas S Reeves 3 copyright 005 Douglas S Reeves 4 4
Remember This Algorithm? Extract destination address Hd, compute network part N if (N matches any directly connected networks) deliver to Hd directly else if (there is a host-specific route for Hd) forward datagram to specified next hop else if (there is a route for network N) forward datagram to specified next hop else if (there is a default route) forward datagram to default router else /* Hd is not directly connected and we */ /* don t know how to get to it */ discard the datagram and declare routing error copyright 005 Douglas S Reeves 5 The New Forwarding Algorithm extract destination address Hd for forwarding table entries i=n { if (Hd AND mask[i]) == destination[i] { forward datagram to specified next_hop[i] exit } } /* we don t know how to get to Hd */ discard the datagram and declare routing error copyright 005 Douglas S Reeves 6 Variable-Length Subnetting Site with a Class C address 95340, needs five subnets with 60, 60, 60, 30, and 30 hosts Problems cannot use subnet mask 5555559, since it allows only 4 subnets, each with ( 8 / 4) - = 6 hosts cannot use subnet mask 5555554, since it allows 8 subnets, each with only ( 8 / 8) - = 30 hosts SUPERNETTING Solution: use two masks of different lengths router requirements RFC requires support for this however, not all routing protocols provide the subnet mask along with the destination network ID copyright 005 Douglas S Reeves 7 Supernet Addressing Supernetting Example Possible solution to exhaustion of Class B addresses use multiple Class C addresses instead Assign organizations blocks of n contiguous Class C addresses ex: if 000 addresses (hosts) are needed, allocate a block of 048 addresses ( = 8 contiguous Class C networks) (Note: subnets not shown for simplicity; subnets and supernets can be used together) Problem: no longer have one network address for each organization inter-organization routing tables will be larger copyright 005 Douglas S Reeves 9 5
CLASSLESS INTERDOMAIN ROUTING (CIDR) Classless InterDomain Routing (CIDR) (RFC59) Idea: allocate IP addresses in a block of size n, for n=,3, In a block means IP addresses must be allocated contiguously (ie, share the same high-order bits) A block is summarized by a single routing table key of the form <network_address, CIDR_mask> network_address: the smallest (first) address in the block CIDR_mask: the size of the address block No longer need classful addresses; the network size is now explicit but, backwards compatible with classful addresses copyright 005 Douglas S Reeves 3 Classless InterDomain Routing (CIDR) (RFC59) (cont d) CIDR_mask: number of 0 s indicates value of n 000 00000000: n = 00000000 00000000 00000000: n = 4 (ie, class A address) More conveniently for people: /3-n to indicate number of s in the mask 000 00000000: / 00000000 00000000 00000000: /8 CIDR ing + Subnet ing IP address: 0000 0000 0000 000000 CIDR : 00 00000000 Network ID: 0000 0000 000000 00000000 Subnet : 000000 Network + Subnet ID: 0000 0000 0000 0000000 copyright 005 Douglas S Reeves 33 copyright 005 Douglas S Reeves 34 Address Allocation and s Ex: allocate a block of 3 (= 8M) addresses, starting at address 94000 Regional Aggregation of Class C Addresses All sites in a region (eg, Europe) have a common prefix Addre ss Lowest Highest Dotted Decimal 94000 9475555 55800 ( /9 ) Binary 00000 00000000 00000000 00000000 00000 0 0000000 00000000 00000000 How can you tell what the mask should be Lowest 94000 98000 00000 0000 Highest 95555555 99555555 0555555 03555555 Region Europe North America Central and South America Asia and the Pacific knowing the number of addresses? knowing the lowest and highest addresses? copyright 005 Douglas S Reeves 35 copyright 005 Douglas S Reeves 36 6
Regional Allocation of Class C Addresses (cont d) CIDR summarizes these 3M addresses into one entry ie, only a single entry needed in most US routers for all European destinations Once the packet gets to Europe, more detailed routing tables are needed to reach the specific network / host Example: Allocating Classless Addresses Site X Y Three sites X, Y, and Z in Europe ask for 048, 04, and 4096 addresses, in that order, starting from 94400 Result: # of Addresses 048 = 04 = 0 Lowest 94400 94480 Highest 944755 94455 5555480 (/) 555550 (/) Z 4096 = 94460 944355 5555400 (/0) Why is there a gap between site Y s allocation and site Z s allocation??? copyright 005 Douglas S Reeves 37 copyright 005 Douglas S Reeves 38 Allocating Classless Addresses (cont d) Result: routers all over Europe have the following 3 entries added to their routing tables Network Address Network Address Network Address 00000 000000 00000000 00000000 (94400) 000 00000000 (5555480, or /) 00000 000000 0000000 00000000 (94480) 00 00000000 (555550, or /) 00000 000000 0000000 00000000 (94460) 0000 00000000 (5555400, or /0) copyright 005 Douglas S Reeves 39 Example: CIDR Forwarding A packet arrives at a router with destination IP address = 94474; where should it be forwarded? 00000 000000 000000 0000000 ANDed with Site mask = 00000 000000 0000000 00000000 match site address? ANDed with Site mask = 00000 000000 0000000 00000000 match site address? ANDed with Site 3 mask = 00000 000000 0000000 00000000 match site 3 address? copyright 005 Douglas S Reeves 40 Longest Prefix Matching A forwarding table entry with a longer mask (ie, more s) is called more specific than another entry with a shorter mask There is a dilemma in classless network masking: address matching ambiguity X = 00000 00000000 00000000 00000000 (/4) Y = 0000 00000000 00000000 00000000 (/6) destination IP address 0000 00000000 00000000 000000 will match both of these entries! For forwarding purposes, the longest prefix (most specific match) wins! Ordering doesn t matter copyright 005 Douglas S Reeves 4 The CIDR Forwarding Algorithm Extract destination address Hd Use mask to find longest matching prefix if (match found) forward datagram to specified next hop else /* we don t know how to get to Hd */ discard the datagram and declare routing error Unified routing table lookup! Questions How deal with default addresses? How deal with host-specific addresses? copyright 005 Douglas S Reeves 4 7
CIDR Blocks Reserved for Private Networks Useful for intranets, testing, etc Should never see one of these addresses in IP packets in the public Internet Prefix 0 /8 6954 /6 76 / 968 /6 Lowest Address 0000 695400 7600 96800 Highest Address 0555555 69545555 735555 9685555 FORWARDING EXAMPLE copyright 005 Douglas S Reeves 43 Example Network Configuration Routing Table for Router R copyright 005 Douglas S Reeves 46 Summary What happens when R receives a packet with destination: 9674? 934576? 003434? Classful addressing is simple, but too restrictive Supernetting is a cheap (but not very clean) fix Subnetting creates a third level of address hierarchy useful for routing inside an organization requires the use of a mask 3 CIDR decreases routing table sizes, and increases flexibility in allocating addresses copyright 005 Douglas S Reeves 47 4 Both subnetting and CIDR require the use of masks copyright 005 Douglas S Reeves 48 8
Next Lecture Routing, Part I copyright 005 Douglas S Reeves 49 9