390 likes | 397 Views
Explore the concepts of subnetting and Classless Inter-Domain Routing (CIDR) in the context of the Global Internet. Learn about the challenges of scaling in routing and the benefits of subnetting for efficient use of IP addresses.
E N D
CSS432 Subnetting and CIDRTextbook Ch3.2.5Global InternetTextbook Ch4.1 Prof. Athirai Irissappane http://courses.washington.edu/css432/athirai/ athirai@uw.edu CSS 432: Subnetting, CIDR, and Global Internet
NSFNET backbone Stanford ISU BARRNET MidNet … regional regional Westnet regional Berkeley P ARC UNL KU UNM NCAR UA Internet Structure • Autonomous System (AS): • Administered independently of other AS • Have a different routing protocol and metrics • Do we really need to give an independent class A/B/C network number to every single AS? CSS 432: Subnetting, CIDR, and Global Internet
7 24 A: 0 Network Host 14 16 B: 1 0 Network Host 21 8 C: 1 1 0 Network Host Global Addresses • IP address • Class • Identified using first few bits as shown in fig • Class A (previously reserved for small number of WAN) • 7 bits for network, 24 bits for host • 2^7 – 2 different networks (1st bit is 0, 127… is reserved for loopback IP address) • Each network 2^24 -2 hosts (all zeros in host bits represent network ID, all 1s broadcast Id) (2^24 – 2 = 16,777,214) • Class B (previously reserved for medium sized campus networks) • 14 bits for network, 16 bits for host • 2^14 networks • Each network 2^16 -2 hosts (65536-2 = 65534) • Class C (previously reserved for large number of LANs) • 21 bits for network, 8 bits for host (2^8 -2) = (256-2=254) • But convention not followed anymore – Classless addresses are used now
Scaling Issues in Routing • Class C address • 21 bits for network and 8 bits for host • Each network 2^8 -2 hosts? What happens if we need to sub-divide the network and manage groups of computers individually ? • 172.16.25.0 • Should each group be given a different class A address? • Exhaust IP addresses faster, inefficient use of IP addresses • Group 1 – 2 hosts • 2/2^8-2 = 2/ 256-2 ~ .7% efficiency CSS 432: Subnetting, CIDR, and Global Internet
Scaling Issues in Routing • Inefficient use of IP Address Space • Class C with 2 hosts (2/254 = 0.78% efficient) • Class B with 256 hosts (256/65534 = 0.39% efficient) • IP address space gets consumed too quickly • Too Many Networks • Routing tables do not scale (more networks, more entries) • Route propagation protocols do not scale • Router gets slower to scan a big forwarding table Hierarchy CSS 432: Subnetting, CIDR, and Global Internet
Subnetting • Efficiently use IP addresses, especially for autonomous systems • The practice of dividing a network into two or more networks is called subnetting. • A subnet is a way of taking a single IP network address (A/B/C) and locally splitting it up • Given 1 IP address how can different subnets be identified? • Computers that belong to a subnet are addressed with a common, identical, most-significant bit-group in their IP address. • Depends on how you split the network and host part CSS 432: Subnetting, CIDR, and Global Internet
SubNetted Networks Define subnetwork by using some bits of host address to identify the subnetwork Borrowing 1 or more bits from the host bit portion
Example: 2^7 Subnet Network Part Dividing a network into 2 subnets requires to borrow 1 bit Class C address: 172.16.25.2 Network Portion/Subnet Mask (Class C address 24 bits network) 11111111.11111111.11111111.00000000 Define new subnet 255.255.255.128, 11111111.11111111.11111111.10000000 Borrow 1 bit from host address (borrow from the right most bit) 11111111.11111111.11111111.10000000 No. of. Subnetworks = 2^ number of bits for sub network = 2^1 = 2 subnetworks No.of hosts per subnetwork = 2^number of host bits -2 = 2^7 -2= 128-2 = 126 All host bits are 1’s are reserved for broadcast ID All host bits 0’s are reserved for network ID
Subnet Mask • Class C address: 172.16.25.0 • Subnet Mask: 255.255.255.128 • What is the network address of the subnets? (each subnet has 128-2 hosts) • 1st subnet: • 0 to127 -2 hosts • 172.16.25.0 to 172.16.25.127 - 2 hosts • 172.16.25.0 is the subnetwork ID, 172.16.25.127 is broadcast IP, hosts can be 172.16.25.1 to 172.16.25.126 • 172.16.25.2 belongs to this subnet • 2nd subnet: • 128 to 255 -2 hosts • 172.16.25.128 to 172.16.25.255 -2 hosts • 172.16.25.128 is the subnetwork ID, 172.16.25.255 is broadcast IP, hosts can be 172.16.25.129 to 172.16.25.254
Subnet Mask Determines the way an IP address is split into network and hosts portions Class A - 0nnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhh Subnet Mask = 255.0.0.0 Class B - 10nnnnnn.nnnnnnnn.hhhhhhhh.hhhhhhhh Subnet Mask = 255.255.0.0 Class C - 100nnnnn.nnnnnnnn.nnnnnnnn.hhhhhhhh Subnet Mask = 255.255.255.0
Subnet Mask IP address & subnet mask = subnet number Example: destination IP=128.96.34.15; subnet mask=255.255.255.128; Subnet ID = 128.96.34.0 10000000.01100000.00100010.00001111 & 11111111.11111111.11111111.10000000 ----------------------------------- 10000000.01100000.00100010.00000000 = 128.96.34.0 How to identify if a host is within a given subnet, given the subnet Id, subnet mask and IP address of host
Routing with simple IP [Note: NetworkNum valueswould typically bemore like 128.96.34] CSS 432: Subnetting & CIDR
Routing with subnetting IP address & subnet mask = subnet number Example: 128.96.34.15 & 255.255.255.128 10000000.01100000.00100010.00001111 & 11111111.11111111.11111111.10000000 ----------------------------------- 10000000.01100000.00100010.00000000 = 128.96.34.0 Forwarding Table for R1 CSS 432: Subnetting & CIDR
Forwarding Algorithm D = destination IP address for each entry (SubnetNum, SubnetMask, NextHop) D1 = SubnetMask & D if D1 = SubnetNum if NextHop is an interface deliver datagram directly to destination else deliver datagram to NextHop (a router) • Use a default router if nothing matches • Not necessary for all 1s in subnet mask to be contiguous • But should be avoided • Can put multiple subnets on one physical network • Ex. Two or more departments want to have their own subnet and to allocate IP addresses in it while sharing just one physical network • Subnets not visible from the rest of the Internet CSS 432: Subnetting, CIDR, and Global Internet
Supernetting • Subnetting • Purpose: given a class C address -> helps to divide into sub network numbers → helps assign addresses efficiently • Problem: an AS with more than 254 hosts still needs class B (65535 hosts), e.g., 256 hosts class B address still inefficient • Supernetting • Solution: assign block of contiguous network numbers to an institution. • Ex. Assign two class C network numbers instead of one class B network. • Side effect: The information that routers store and exchange increases dramatically • Ex. If an AS has 16 class C network numbers, every Internet router needs 16 entries for this AS. CIDR: Classless Inter-Domain Routing
SuperNetting • Class C address: • Block1 (172.16.16.0 ) • 10101100 00010000 00010000 00000000 • Block2 (172.16.24.0 ) • 10101100 00010000 00011000 00000000 • Use this Mask instead of 255.255.255.0 • 11111111 11111111 11110000 00000000 • If we take 1 bit for subnetwork • Number of host bits = 9 ~ 2^9 hosts; each subnetwork can have more number of hosts
Classless Addressing • Exhaustion of IP address space centers on exhaustion of the class B network numbers • Solution • Say “NO” to any Autonomous System (AS) that requests a class B address unless they can show a need for something close to 64K addresses • Instead give them an appropriate number of class C addresses • For any AS with at least 256 hosts, we can guarantee an address space utilization of at least 50% • What is the problem with this solution?
Classless Addressing • Problem with this solution • Excessive storage requirement at the routers. • If a single AS has, say 16 class C network numbers assigned to it, • Every Internet backbone router needs 16 entries in its routing tables for that AS • This is true, even if the path to every one of these networks is the same • If we had assigned a class B address to the AS • The same routing information can be stored in one entry • Efficiency = 16 × 255 / 65, 536 = 6.2%
CIDR • CIDR tries to balance the desire to minimize the number of routes that a router needs to know against the need to hand out addresses efficiently. • CIDR uses aggregate routes • Uses a single entry in the forwarding table to tell the router how to reach a lot of different networks • Breaks the rigid boundaries between address classes
CIDR NOTATION • Instead of having multiple entries for each contiguous block of class C address in the routing table, just specify 1 entry • The contiguous blocks have the same prefix • Example 192.4.16.00/20 • First 20 bits is network part and next 12 bits is for the host • Contiguous subnets need not have different entries in the routing table but just one entry due to CIDR
CIDR • Consider an AS with 16 class C network numbers. • Instead of handing out 16 addresses at random, hand out a block of contiguous class C addresses • Suppose we assign the class C network numbers from 192.4.16 through 192.4.31 • Observe that top 20 bits of all the addresses in this range are the same (11000000 00000100 0001) • We have created a 20-bit network number (which is in between class B (14 bits) network number and class C number (21 bits) ) • Requires to hand out blocks of class C addresses that share a common prefix
Classless Addressing • Classless Inter-Domain Routing • A technique that addresses two scaling concerns in the Internet • The growth of backbone routing table as more and more network numbers need to be stored in them • Potential exhaustion of the 32-bit address space • Address assignment efficiency • Arises because of the IP address structure with class A, B, and C addresses • Forces us to hand out network address space in fixed-size chunks of three very different sizes • A network with two hosts needs a class C address • Address assignment efficiency = 2/255 = 0.78 • A network with 256 hosts needs a class B address • Address assignment efficiency = 256/65535 = 0.39
Classless Addressing Examples • Given this routing table with CIDR notation To which of those two should we forward a packet destined to 192.4.48.3? • Prefix Next Hop • 192.4.0.0/18 R2 • 192.4.48.0/20 R3 • 192.4.0.0/18 • 18 network bits, mask = 11111111.11111111.11000000.00000000 • 192.4.48.3 & 255.255.192.0 = 192.4.0.0 (Matches!) • 192.4.48.0/20 • 20 network bits, mask = 11111111.11111111.11110000.00000000 • 192.4.48.3 & 255.255.240.0 = 192.4.48.0 (Matches!) • Which one should I choose • Principle of Longest Match 192.4.48.0 (Matches!) with 20 network bits • Next hop is R3 CSS 432: Subnetting, CIDR, and Global Internet
Trie (Prefix Tree) • Data structure for longest prefix match • Tree with child and parent nodes • If this Trie represents a dictionary, find the longest word with prefix “The” Ans: There • We will be considering a binary trie • Every parent has only 2 children
Search: Traverse the tree according to destination address Most recent shaded node is the current longest prefix Search ends when a leaf node is reached Tree contains path to network address Bits before * represents the network portion Each leaf contains a possible address Prefixes in the table are marked (dark) Binary Trie
Update: Search for the new entry Search ends when a leaf node is reached If there is no branch to take, insert new node(s) 1 0 h Binary Trie h 1010*
Constructing a Binary Trie for lookup CSS 432: Subnetting, CIDR, and Global Internet
Classless Lookup Compress 1-child branches • Binary Trie for IP Routing 1 0 1 0 10 more zeros 192.4.48.0/20 0 128.4.0.0/1 ; 10* 65.4.0.0/1 ; 0* 1 1 0 3 more zeros 1 192.4.0.0/18 CSS 432: Subnetting, CIDR, and Global Internet
Classless Lookup • Patricia Tree for IP Routing 192.4.48.0/20 1 0 Skip 1 one 1 1 0 1 0 Skip 10 zeros Skip 3 zeros 0 128.4.0.0/1 ; 10* 192.4.0.0/18 65.4.0.0/1 ; 0* CSS 432: Subnetting, CIDR, and Global Internet
Classless Lookup • Destination is 192.4.48.2/32 11000000 00000100 00110000 00000010 192.4.48.0/20 1 0 Skip 1 one 1 1 0 1 0 Skip 10 zeros Skip 3 zeros 192.4.0.0/18 0 128.4.0.0/1 ; 10* 65.0.0.0/1 ; 0* CSS 432: Subnetting, CIDR, and Global Internet
NSFNET backbone Stanford ISU BARRNET MidNet … regional regional Westnet regional Berkeley P ARC UNL KU UNM NCAR UA Route Propagation • Know a smarter router • Hosts know local (default) routers • Local routers know site routers • Site routers know core router • Core routers know everything • Site routers are called border routers. • Autonomous System (AS) • Corresponds to an administrative domain • Examples: University, company, backbone network • Two-level route propagation hierarchy • Interior gateway protocol (each AS selects its own) • Exterior gateway protocol (Internet-wide standard) AS2 AS1 R2 R1 Interior Exterior CSS 432: Subnetting, CIDR, and Global Internet
Popular Interior Gateway Protocols • RIP: Route Information Protocol • Distributed with Unix • Distance-vector algorithm • Based on hop-count • OSPF: Open Shortest Path First • Recent Internet standard • Uses link-state algorithm • Supports load balancing • Supports authentication CSS 432: Subnetting, CIDR, and Global Internet
Large corporation “ ” Consumer ISP Peering point Backbone service provider Peering point Consumer ” ISP “ “ Consumer ISP ” Large corporation Small corporation Well-known Exterior Gateway Protocol • Border Gateway Protocol – 4th Version (BGP-4) • Assumption: Internet as an arbitrarily interconnected set of ASs • Goal: Reachability than optimality • Stub AS: • A single connection to another AS • Only carries local traffic. • Multihomed AS: • Connections to multi ASs • Refuses to carry transit traffic • Transit AS: • Connections to multi-ASs • Carries both transit and local traffic • Local Traffic: traffic within AS • Transit Traffic: traffic across AS
BGP-4 (Routing across AS) • Routing path is a vector of AS to reach a particular network • Each AS has: • 1 or more border routers (through which packet enter and leave AS) • one BGP speaker that advertises (can be border router): • local networks • other reachable networks (transit AS only) • gives complete path information • Characteristics • Inter-BGP speaker communication based on P2P and TCP • Consistent maintenance on routing information among multiple BGP speakers • Reachability-based information • Policy Support to distinguish between intra- and inter-AS reachability information • Incremental updates that sends only reachability change • Route aggregation to send multiple routes in one message • Authentication to allow a receiver to authenticate messages
128.96 Customer P 192.4.153 (AS 4) Regional provider A (AS 2) Customer Q 192.4.32 (AS 5) 192.4.3 Backbone network (AS 1) Customer R 192.12.69 (AS 6) Regional provider B (AS 3) Customer S 192.4.54 (AS 7) 192.4.23 BGP Example • Speaker for AS2 advertises reachability to P and Q • network 128.96, 192.4.153, 192.4.32, and 192.4.3, can be reached directly from AS2 • Speaker for backbone advertises • networks 128.96, 192.4.153, 192.4.32, and 192.4.3 can be reached along the path (AS1, AS2). • Speaker can cancel previously advertised paths • BGP prevents loops: Each received advertisement is a full path to reach a destination, AS in the path must be unique. Receiver discards it if it finds itself in the path.
Area 3 Area 1 Area 0 R7 R9 R3 R1 R8 R4 R2 Area 2 Virtual Link NO R5 R6 Routing Areas • AS divided into areas • Area 0 • Known as the backbone area and connected to the back bone • Routers (R1, R2, R3) called ABR (Area Border Router) • OSPF link states • do not leave the area in which they originated if they are not ABRs. • ABRs summarize routing information that they have learned from one area and make it available in their advertisements to other areas. CSS 432: Subnetting, CIDR, and Global Internet
IP Version 6 • Features • 128-bit addresses (classless/CIDR) [IPv4 – 32 bit address] • multicast • real-time service • authentication and security • autoconfiguration • end-to-end fragmentation • protocol extensions • Header • 40-byte “base” header [IPv4 – 20 bytes w/o options] • extension headers (fixed order, mostly fixed length, use when necessary) • fragmentation • source routing • authentication and security • other options CSS 432: Subnetting, CIDR, and Global Internet
Reviews • Subnetting: How to address and forwarding algorithm • Supernetting: CIDR, principle of longest match, and classless lookup • Exterior gateway protocol: BGP and routing areas • Exercises in Chapter 3 • Ex. 55 (Subnetting) • Ex. 68 (CIDR) • Ex. 72 (CIDR) • Ex. 74 (CIDR) CSS 432: Subnetting, CIDR, and Global Internet