Classless and Subnet Address Extensions (CIDR) Chapter 10 Introduction • Five extensions of the IP address scheme, designed to conserve network prefixes – – – – – Transparent routers Proxy ARP Subnet Addressing Anonymous Point-To-Point Networks Classless Addressing Relevant Facts • In the original IP addressing scheme: – Each network is assigned a unique network address – Each host on that network has the network address as a prefix of the host’s address • Advantage of this scheme: – Routers keep one routing entry per network – Only the network portion of the address is examined when making routing decisions Relevant Facts • Remember original IP addresses – Class A: 8 bit network id, 24 bit host id – Class B: 16 bit network id, 16 bit host id – Class C: 24 bit network id, 8 bit host id • Sites may modify this scheme as long as: – All hosts and routers agree to the modified scheme – Other sites on the Internet can treat addresses as a network prefix and a host suffix Minimizing Network Numbers • Growth has made the original addressing scheme unfeasible for the future – Overhead of managing network addresses – Routing tables are large and exchanging routing information requires significant effort – Address space will be exhausted (see p. 148) • Three ways of sharing one network among multiple physical networks follows Transparent Routers • A router is used to make it look as though several hosts are connected to a WAN • It is transparent because other routers and hosts on the WAN do not know that it exists • The router is connected to hosts in a local area network on one side (as a multiplexer), and to a single host port of the WAN on the other H1 Wide Area Network H2 T H3 H4 T is a transparent router connecting multiple hosts to a WAN. Hosts are assigned addresses as if they connected directly to the WAN. Transparent Routers • The local area network does not have its own IP prefix • The router demultiplexes datagrams that arrive from the WAN and sends them to the host using a table of addresses • The router also accepts datagrams from the hosts and sends them across the WAN to the destinations Transparent Routers • Advantages – requires fewer network addresses since the LAN does not need a separate IP prefix – supports load balancing • Disadvantages – works with networks with a large number of host addresses • good for class A, not good for class C – may not provide allservices (ICMP and SNMP) Proxy ARP • Applies to networks that use ARP to bind internet addresses to physical addresses • Allows one network address to be shared by two physical networks • A router which runs proxy ARP answers ARP requests on each network for hosts on the other network • Also called: ARP hack and promiscuous ARP Main Network H1 H2 H3 Router running proxy ARP R H4 Hidden Network H5 Proxy ARP • When H1 needs to talk to H4, it uses ARP • R captures the ARP request from H1 and responds with R’s physical address • H1 sends datagrams destined for H4 to R • R looks in its routing table to route the datagram on to H4 on the hidden network Proxy ARP • Advantage – It can be added to a single router without changing the routing tables in other hosts or routers on this network • Disadvantages – Only works on networks that use ARP – Spoofing: one machine claims to be another Subnet Addressing • Most widely used technique of the 3 • Standardized, required part of IP addressing • A single site has a single class B address assigned to it, but has 2 or more networks • Only local routers know that there are multiple networks at this site Network 128.10.1.0 128.10.1.1 128.10.1.2 H1 Rest of the Internet H2 R all traffic to 128.10.0.0 H4 H3 128.10.2.1 Network 128.10.2.0 128.10.2.2 Subnet Addressing • The address 128.10.0.0 is used for both networks at the site • Routers in the internet send to either network as though it was a single network • Only R knows that there are two networks and looks at the third octet to route – The two networks are called subnets Subnet Addressing • Instead of dividing the 32-bit IP address into (netid, hostid), we use (net portion, local portion) • The interpretation of the local portion of the address is left to the site – The net or internet portion identifies a site – The local portion identifies a physical network and a host Subnet Addressing • Conceptual 32-bit address in original addressing with conceptual subnet addressing – Hierarchical addressing and hierarchical routing Internet part Internet part Local part Physical Network Host Flexibility in Subnet Address Assignment • Sites are allowed flexibility in choice of address assignment To the rest of the R1 Internet Network 1 R2 Network 3 Network 2 R4 Network 4 R3 R5 Network 5 Flexibility in Subnet Address Assignment • See Figure 10.6 – For fixed length subnetting • When a site has a large number of subnets, the number of hosts must be small • When a site has a large number of hosts, the number of subnets will be small Variable Length Subnets • An organization may choose a partition size for each physical network – Since the organization may have large and small networks, this gives flexibility to the site • Disadvantage: – Possible address ambiguity Subnets with Masks • For subnetting of either kind, a 32-bit subnet mask specifies the division – Bits in the mask are set to 1 if machines on the network treat the corresponding bit in the address as part of the subnet prefix, 0 if not – Example: the mask 11111111 11111111 11111111 00000000 says the first 3 octets identify the network, and the fourth identifies the host Subnets with Masks • Subnet masks do not necessarily have to select contiguous bits of the address, i.e.: 11111111 11111111 00011000 01000000 … not recommended! Subnet Mask Representation • Masks may be represented in dotted decimal (binary is difficult) as in 255.255.255.0 • They may be represented as a 3-tuple {network #, subnet #, host #} where -1 means “all ones” {-1, -1, 0} is 255.255.255.0 {128.23, -1, 0} is 128.23.255.0 Routing with Subnets • Hosts connected to networks that are not subnetted must communicate with hosts on networks that are subnetted • Rule: To achieve optimal routing, a machine M must use subnet routing for an IP network address N, unless there is a single path P such that P is a shortest path between M and every physical network that is a subnet of N. Routing with Subnets • Guideline: All subnets of a given network IP address must be contiguous, the subnet masks should be uniform across all networks, and all machines should participate in subnet routing. Questions • How does this modify the routing algorithm? • How are subnet masks assigned? • How do we broadcast to subnets? Anonymous Point to Point Networks • When a leased line connects two routers, the line and the two routers are not given addresses – No hardware address is needed – The interface software ignores the next hop address when sending datagrams – The connection is known as an unnumbered network, or anonymous network 128.10.0.0 R1 1 128.211.0.0 leased line R2 2 128.10.2.250 To reach hosts on network 128.10.0.0 default 128.211.0.100 Route To Using Interface # Deliver Direct 128.211.0.100 Routing Table in R1 1 2 Classless Addressing • Allows addresses assigned to a single organization to span multiple classes • Why adopted? – The classful scheme did not divide network addresses into classes equally (<17K class B networks, >2M class C networks) – Class C addresses were assigned slowly – Class B addresses would be exhausted (Running out of address space ROADS) Classless Addressing (Supernetting) • Consider a medium-sized organization that joins the Internet – A class B address is preferred over a class C – But the organization may be given a block of 256 contiguous class C addresses – This would also be a useful way to have Internet Service Providers (ISPs) provide IP addresses to an organization • The ISP allocates addresses from the set to subscribers Supernetting Effects on Routing • A new problem is created: – Now routing table is increased incredibly – Instead of one class B address, we now have 256 class C addresses • How can the problem be fixed? – Collapsing a block of contiguous addresses into a single entry: (network address, count) • network address is the smallest @ in the block • count is the number of network @s in the block Supernetting Effects on Routing • Example: – The pair (127.92.61.25, 4) specifies the four network addresses • • • • 127.92.61.25 127.92.61.26 127.92.61.27 127.92.61.28 • Routing tables can be smaller CIDR • What has just been described is Classless Inter-Domain Routing (CIDR) – The name does not indicate that it also involves addressing – It is not restricted to Class C addresses – It does not really use an integer, but requires that the number of blocks is a power of two, and this power is identified using a bit mask CIDR • Example: – An organization is assigned a block of 2048 contiguous addresses, beginning at 128.211.168.0 – lowest: 128.211.168.0 10000000 11010011 10100000 00000000 – highest: 128.211.175.255 10000000 11010011 10101111 11111111 CIDR • CIDR requires 2 things: – The lowest address in the block – A 32-bit mask which shows where the division between prefix and suffix occurs – 11111111 11111111 11111000 00000000 after the 21st bit in this case CIDR Notation • A shorthand way of representing the address and the mask length is also called slash notation • The block of addresses is indicated by the first address followed by a decimal indicating the bit position 21 128.211.168.0/21 – See figure 10.11 for CIDR prefixes CIDR Example • Work problem in Section 10.21 Summary • Techniques have been invented to conserve IP addresses: – Extend the address space of a single network to include hosts on an attached local network – A router answers ARP requests for hosts – Share one IP network address among several networks – Let a point-to-point connection be unnumbered – Allow division between prefix and suffix to occur anywhere