CSS 432 Subnetting and CIDR Textbook Ch 3

CSS 432 Subnetting and CIDR Textbook Ch 3. 2. 5 Global Internet Textbook Ch 4. 1 Prof. Athirai Irissappane http: //courses. washington. edu/css 432/athirai/ athirai@uw. edu CSS 432: Subnetting, CIDR, and Global Internet 1

Internet Structure NSFNET backbone Stanford ISU BARRNET regional Mid. Net … Westnet regional Berkeley PARC UNM NCAR UNL KU UA n Autonomous System (AS): ¨ ¨ n 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 2

Scaling Issues in Routing n Class A address ¨ 7 bits for network and 24 bits for host ¨ Each network 2^24 -2 hosts? What happens if we need to subdivide the network and manage groups of computers individually ? ¨ 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^24 = 2/ 16777214 < 1% efficiency CSS 432: Subnetting, CIDR, and Global Internet 3

Scaling Issues in Routing n 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 n 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 4

Subnetting n Efficiently use IP addresses, especially for autonomous systems n 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? ¨ n Computers that belong to a subnet are addressed with a common, identical, most-significant bit-group in their IP address. n Depends on how you split the network and host part CSS 432: Subnetting, CIDR, and Global Internet 5

Sub. Netted Networks n Define subnetwork by using some bits of host address to identify the subnetwork n Borrowing 1 or more bits from the host bit portion

Example: 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. 0000 2^7 Define new subnet 255. 128, 11111111. 10000000 Borrow 1 bit from host address (borrow from the right most bit) Subnet 11111111. 10000000 Network Part 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 n n Class C address: 172. 16. 25. 2 Subnet Mask: 255. 128 What is the network address of the subnets? (each subnet has 128 -2 hosts) 1 st subnet: 0 to 127 -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 ¨ n 2 nd subnet: 128 to 255 -2 hosts ¨ 172. 16. 25. 128 to 172. 16. 255 -2 hosts ¨ 172. 16. 25. 128 is the subnetwork ID, 172. 16. 255 is broadcast IP, hosts can be 172. 16. 25. 129 to 172. 16. 254 ¨

Subnet Mask Determines the way an IP address is split into network and hosts portions Class A - 0 nnnnnnn. hhhhhhhh Subnet Mask = 255. 0. 0. 0 IP Address /8 Class B - 10 nnnnnn. hhhhhhhh Subnet Mask = 255. 0. 0 IP Address /16 Class C - 100 nnnnnnnn. hhhh Subnet Mask = 255. 0 IP Address /24

Class C Subnetting # of Subnets # of Hosts/Subnet Net. Mask 4 th Octet CIDR Notation 2 126 255. 128 10000000 /25 4 62 255. 192 11000000 /26 8 30 255. 224 11100000 /27 16 14 255. 240 11110000 /28 32 6 255. 248 11111000 /29 64 2 255. 252 11111100 /30

Subnetting – How to Address #bits Subnetwork Mask #subnets in Class B #subnets in Class C # of hosts 16 255. 0. 0 1 - 65534 17 255. 128. 0 - - 32766 18 255. 192. 0 2 - 16382 19 255. 224. 0 6 - 8190 20 255. 240. 0 14 - 4094 21 255. 248. 0 30 - 2046 22 255. 252. 0 62 - 1022 23 255. 254. 0 126 - 510 24 255. 0 254 1 254 25 255. 128 510 0 126 26 255. 192 1022 2 62 27 255. 224 2046 6 30 28 255. 240 4094 14 14 29 255. 248 8190 30 6 30 255. 252 16382 62 2 31 255. 254 32766 126 - 32 255 65534 254 - Note: subnet all 0’s and all 1’s are not recommended CSS 432: Subnetting, CIDR, and Global Internet 11

Subnet Mask n How to identify if a host is within a given subnet, given the subnet Id, subnet mask and IP address of host IP address & subnet mask = subnet number Example: IP=128. 96. 34. 15; subnet mask=255. 128; Subnet ID = 128. 96. 34. 0 10000000. 01100000. 0010. 00001111 & 11111111. 10000000 -----------------10000000. 01100000. 0010. 0000 = 128. 96. 34. 0

Routing with simple IP [Note: Network. Num values would typically be more like 128. 96. 34] CSS 432: Subnetting & CIDR 13

Routing with subnetting IP address & subnet mask = subnet number Example: 128. 96. 34. 15 & 255. 128 10000000. 01100000. 0010. 00001111 & 11111111. 10000000 -----------------10000000. 01100000. 0010. 0000 = 128. 96. 34. 0 Forwarding Table for R 1 CSS 432: Subnetting & CIDR 14

Forwarding Algorithm D = destination IP address for each entry (Subnet. Num, Subnet. Mask, Next. Hop) D 1 = Subnet. Mask & D if D 1 = Subnet. Num if Next. Hop is an interface deliver datagram directly to destination else deliver datagram to Next. Hop (a router) n n Use a default router if nothing matches Not necessary for all 1 s in subnet mask to be contiguous ¨ n Can put multiple subnets on one physical network ¨ n But should be avoided 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 15

Supernetting n 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 (256/65534 ~ 0. 004) ¨ n Supernetting ¨ Solution: assign block of contiguous network numbers to an institution. n ¨ Ex. Assign two class C network numbers instead of one class B network. Side effect: The information that routers store and exchange increases dramatically n Ex. If an AS has 16 class C network numbers, every Internet router needs 16 entries for this AS. CIDR: Classless Inter-Domain Routing 16

Classless Addressing n n 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 64 K 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% ¨ n What is the problem with this solution?

Classless Addressing n Problem with this solution ¨ Excessive storage requirement at the routers. n 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 n 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 n 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. n 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 n n 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 n n 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 (11000000100 0001) ¨ n 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 n Classless Inter-Domain Routing ¨ A technique that addresses two scaling concerns in the Internet n n 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 n Arises because of the IP address structure with class A, B, and C addresses n 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 n Given this routing table with CIDR notation To which of those two should we forward a packet destined to 192. 4. 48. 3? Prefix ¨ 192. 4. 0. 0/18 ¨ 192. 4. 48. 0/20 ¨ n Next Hop R 2 R 3 192. 4. 0. 0/18 18 network bits, mask = 11111111. 11000000 ¨ 192. 4. 48. 3 & 255. 192. 0 = 192. 4. 0. 0 (Matches!) ¨ n 192. 4. 48. 0/20 20 network bits, mask = 111111110000 ¨ 192. 4. 48. 3 & 255. 240. 0 = 192. 4. 48. 0 (Matches!) ¨ n Which one should I choose Principle of Longest Match 192. 4. 48. 0 (Matches!) with 20 network bits ¨ Next hop is R 3 ¨ CSS 432: Subnetting, CIDR, and Global Internet 2 power 1 0 2 1 4 2 8 3 16 4 32 5 64 6 128 7 23

Trie (Prefix Tree) Data structure for longest prefix match n Tree with child and parent nodes n If this Trie represents a dictionary, find the longest word with prefix “The” Ans: There n We will be considering a binary trie n ¨ Every parent has only 2 children 24

n Binary Trie n n 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) 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 25

Binary Trie 1 h 1010* 0 h n 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) 26

Constructing a Binary Trie for lookup 7 6 5 4 3 2 1 0 128 64 32 16 8 4 2 1 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0 128. 4. 0. 0/2 interface 0 65. 4. 0. 0/1 Router 2 192. 4. 48. 0/20 Interface 1 192. 4. 0. 0/18 Router 3 128. 0. 0. 0/2 10000000100 00000000/2 10* 65. 0. 0. 0/1 0100000100 00000000/1 0* 192. 4. 48. 0/20 11000000100 00110000/20 11000000100 0011* 192. 4. 0. 0/18 11000000100 CSS 432: Subnetting, CIDR, and Global 0000 Internet 0000/18 11000000100 00* 27

Classless Lookup Binary Trie for IP Routing 1 0 0 0 10 m 128. 4. 0. 0/1 ; 10* 65. 0. 0. 0/1 ; 0* ore 192. 4. 48. 0/20 ze ros 1 10* 128. 4. 0. 0/2 interface 0 0* 65. 4. 0. 0/1 Router 2 11000000100 0011* 192. 4. 48. 0/20 Interface 1 11000000100 00* 192. 4. 0. 0/18 CSS 432: Subnetting, CIDR, and Global Internet Router 3 0 1 1 Compress 1 -child branches 3 m ze ore ros 1 n 192. 4. 0. 0/18 28

Classless Lookup Patricia Tree for IP Routing 1 1 0 192. 4. 48. 0/20 0 1 0 Skip 1 one 0 1 n Skip 10 zeros 128. 4. 0. 0/1 ; 10* Skip 3 zeros 192. 4. 0. 0/18 65. 0. 0. 0/1 ; 0* 128. 4. 0. 0/2 interface 0 0* 65. 4. 0. 0/1 Router 2 11000000100 0011* 192. 4. 48. 0/20 Interface 1 11000000100 00* 192. 4. 0. 0/18 CSS 432: Subnetting, CIDR, and Global Internet Router 3 29

Classless Lookup Destination is 192. 4. 48. 2/32 11000000100 001100000010 1 1 0 Skip 10 zeros 128. 4. 0. 0/1 ; 10* 65. 0. 0. 0/1 ; 0* 0 Skip 3 zeros 192. 4. 0. 0/18 Destination ip Longest Matching prefix 192. 4. 48. 2/32 192. 4. 0. 0/18 192. 4. 48. 0/20 10* 128. 4. 0. 0/2 interface 0 0* 65. 4. 0. 0/1 Router 2 11000000100 0011* 192. 4. 48. 0/20 Interface 1 11000000100 00* 192. 4. 48. 0/20 Skip 1 one 0 1 n 192. 4. 0. 0/18 CSS 432: Subnetting, CIDR, and Global Internet Router 3 30

Route Propagation n Know a smarter router NSFNET backbone Stanford ISU ¨ Hosts know local (default) routers BARRNET ¨ Local routers know site routers Mid. Net regional Westnet … regional ¨ Site routers know core router regional Berkeley ¨ Core routers know everything PARC UNL KU UNM NCAR ¨ Site routers are called border routers. UA Autonomous System (AS) ¨ Corresponds to an administrative domain ¨ Examples: University, company, backbone network Two-level route propagation hierarchy AS 2 AS 1 ¨ Interior gateway protocol (each AS selects its own) R 2 ¨ Exterior gateway protocol (Internet-wide standard) Interior R 1 Exterior CSS 432: Subnetting, CIDR, and Global Internet 31

Popular Interior Gateway Protocols n RIP: Route Information Protocol ¨ Distributed with Unix ¨ Distance-vector algorithm ¨ Based on hop-count n OSPF: Open Shortest Path First ¨ Recent Internet standard ¨ Uses link-state algorithm ¨ Supports load balancing ¨ Supports authentication CSS 432: Subnetting, CIDR, and Global Internet 32

Well-known Exterior Gateway Protocol n Border Gateway Protocol – 4 th Version (BGP-4) ¨ Assumption: Internet as an arbitrarily interconnected set of ASs ¨ Goal: Reachability than optimality Large corporation “Consumer ” ISP Peering point n Backbone service provider “ Consumer” ISP Large corporation Small corporation Peering point n “Consumer” ISP Stub AS: A single connection to another AS ¨ Only carries local traffic. ¨ Multihomed AS: Connections to multi ASs ¨ Refuses to carry transit traffic ¨ n Transit AS: Connections to multi-ASs ¨ Carries both transit and local traffic ¨ n n Local Traffic: traffic within AS Transit Traffic: traffic across AS

BGP-4 (Routing across AS) n n Routing path is a vector of AS to reach a particular network Each AS has: ¨ ¨ n 1 or more border routers (through which packet enter and leave AS) one BGP speaker that advertises (can be border router): n local networks n other reachable networks (transit AS only) n gives complete path information Characteristics ¨ ¨ ¨ ¨ Inter-BGP speaker communication based on P 2 P 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 34

BGP Example Speaker for AS 2 advertises reachability to P and Q n ¨ network 128. 96, 192. 4. 153, 192. 4. 32, and 192. 4. 3, can be reached directly from AS 2 Regional provider A (AS 2) Backbone network (AS 1) Regional provider B (AS 3) n n n Customer P (AS 4) 128. 96 192. 4. 153 Customer Q (AS 5) 192. 4. 32 192. 4. 3 Customer R (AS 6) 192. 12. 69 Customer S (AS 7) 192. 4. 54 192. 4. 23 Speaker for backbone advertises ¨ networks 128. 96, 192. 4. 153, 192. 4. 32, and 192. 4. 3 can be reached along the path (AS 1, AS 2). Speaker 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. 35

Routing Areas n n AS divided into areas Area 0 Known as the backbone area and connected to the back bone ¨ Routers (R 1, R 2, R 3) called ABR (Area Border Router) ¨ n OSPF link states Area 0 R 7 R 9 R 3 R 1 R 8 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. ¨ Area 3 Area 1 R 4 Virtual Link R 2 Area 2 R 6 CSS 432: Subnetting, CIDR, and Global Internet NO R 5 36

IP Version 6 n n Features ¨ 128 -bit addresses (classless/CIDR) [IPv 4 – 32 bit address] ¨ multicast ¨ real-time service ¨ authentication and security ¨ autoconfiguration ¨ end-to-end fragmentation ¨ protocol extensions Header ¨ 40 -byte “base” header [IPv 4 – 20 bytes w/o options] ¨ extension headers (fixed order, mostly fixed length, use when necessary) n fragmentation n source routing n authentication and security n other options CSS 432: Subnetting, CIDR, and Global Internet 37

n Reviews ¨ Subnetting: How to address and forwarding algorithm ¨ Supernetting: CIDR, principle of longest match, and classless lookup ¨ Exterior gateway protocol: BGP and routing areas n Exercises in Chapter 3 ¨ Ex. 55 (Subnetting) ¨ Ex. 68 (CIDR) ¨ Ex. 72 (CIDR) ¨ Ex. 74 (CIDR) CSS 432: Subnetting, CIDR, and Global Internet 38
- Slides: 38