220 likes | 467 Views
Subnetting and Supernetting. How to Make Routing Scale. Flat versus Hierarchical Addresses Inefficient use of Hierarchical Address Space class C with 2 hosts (2/255 = 0.78% efficient) class B with 256 hosts (256/65535 = 0.39% efficient)
E N D
Subnetting and Supernetting CS 332
How to Make Routing Scale • Flat versus Hierarchical Addresses • Inefficient use of Hierarchical Address Space • class C with 2 hosts (2/255 = 0.78% efficient) • class B with 256 hosts (256/65535 = 0.39% efficient) • Demand for Class B the problem. So why not just assign 2 class C’s for a 50% efficiency rate? • Still Too Many Networks • routing tables do not scale • route propagation protocols do not scale CS 332
Internet Structure • Autonomous system (AS) • Administered Independently of other ASs • Want to be able to control various ways in which network is configured, used, etc. • Select their own intradomain routing protocol • Perhaps select own link metrics, etc. • Advantageous because it provides finer hierarchy • Good for scalability CS 332
Network number Host number Class B address 111111111111111111111111 00000000 Subnet mask (255.255.255.0) Network number Subnet ID Host ID Subnetted address Subnetting • Add another level to address/routing hierarchy: subnet • Subnet masks define variable partition of host part • Subnets visible only within site CS 332
Subnet Mask • Written in dotted quad notation (like IP addresses) • Exactly one mask per subnet (all hosts on given subnet have same subnet mask) • Subnet number of host (or of subnet) = bitwise AND of subnet mask and IP address 11111111 11111111 11111111 10000000 10000000 01100000 00100010 00001111 10000000 01100000 00100010 00000000 CS 332
Subnetting (cont) • To send IP packet: • Host performs bitwise AND of its subnet mask with destination IP address • If result is same subnet number as sending host, then destination is on same subnet, so forward directly (Note: Arp unaffected) • Else send packet to a router to be forwarded to another subnet • New routing table entries: <SubnetNumber, SubnetMask, NextHop> replaces <NetworkNumber, NextHop> CS 332
Subnet mask: 255.255.255.128 Subnet number: 128.96.34.0 128.96.34.15 128.96.34.1 H1 R1 Subnet mask: 255.255.255.128 128.96.34.130 Subnet number: 128.96.34.128 128.96.34.139 128.96.34.129 H2 R2 H3 128.96.33.1 128.96.33.14 Subnet mask: 255.255.255.0 Subnet number: 128.96.33.0 Subnet Example Forwarding table at router R1 Subnet Number Subnet Mask Next Hop 128.96.34.0 255.255.255.128 interface 0 128.96.34.128 255.255.255.128 interface 1 128.96.33.0 255.255.255.0 R2 CS 332
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 D else deliver datagram to NextHop • Use a default router if nothing matches • Not necessary for all 1s in subnet mask to be contiguous • Can put multiple subnets on one physical network(?!) • Subnets not visible from the rest of the Internet CS 332
The Key • It’s important to remember that both subnetting and supernetting are attempts to help make routing scale • Even for an AS like U of R, subnetting can help shrink routing tables, though this isn’t really a serious issue here • Supernetting is really intended to make Internet routing scale – it benefits primarily the internet service providers and backbone routers, where the real scale problems exist. CS 332
3185* 319* 52* 31* 51* 5* backbone 317* 3172* 534* 7* 3174* 73* 76* 748* 317483* 317482* Supernetting (CIDR) • What we’re shooting for: CS 332
Supernetting (CIDR) • Called CIDR: Classless Inter-Domain Routing • Assign block of contiguous network numbers to nearby networks (in same AS or using same ISP) • Aggregates routes: single entry for many networks • E.g. Class B addresses 192.4.16-192.4.31 have same top 20 bits, so a single 20 bit network address gets packets to correct AS. • Restrict block sizes to powers of 2 • Represent network numbers with(length, value)pair • All routers must understand CIDR addressing CS 332
A Caveat • There is a serious issue regarding the efficiency of CIDR. Can you determine what it is? • Do you know what a Trie is? • I’m putting together a handout that will explain this, (And I may have you read the original paper…) CS 332