380 likes | 576 Views
IP Addressing. “If we all did the things we are capable of doing, we would literally astound ourselves” - Thomas Alva Edison, 1847-1931. Objectives. Recognize and describe the various IP address classes from A to E, and explain how they’re composed and used
E N D
IP Addressing “If we all did the things we are capable of doing, we would literally astound ourselves” - Thomas Alva Edison, 1847-1931 Chapter 2
Chapter 2 Objectives • Recognize and describe the various IP address classes from A to E, and explain how they’re composed and used • Describe the IPv4 address limitations, and how techniques like Classless Inter-Domain Routing (CIDR) and use of private IP addresses with Network Address Translation (NAT) ease those limitations • Define the terms subnet and supernet, and apply subnetting and supernetting concepts in solving specific network design problems
Chapter 2 IP Addressing Basics • Different addressing schemes: • Symbolic (eg: www.bcit.ca) • Logical numeric (eg: 172.16.1.10) • Physical numeric (eg: 6 byte MAC addresses) • Symbolic addresses are easier to remember than a numeric address such as 199.95.72.8 • Physical numeric addresses are MAC layer addresses associated with the Data Link layer (of the OSI Reference model) • Logical numeric addresses are IP addresses associated with the Network layer
Chapter 2 IP Addressing • IPv4 uses 32-bit addresses, commonly represented in dotted decimal notation. Eg: 11000000 00001100 00001010 00000101 (in binary) 192 12 10 5 (each octet in decimal) Written as: 192.12.10.5 (in dotted decimal notation) • Classful Addresses • Address range is divided into 5 classes (A to E) • Each address has two parts: • Network address (Net id) and Host address (Host id) • A two-level hierarchy
Chapter 2 0 Net id Host id (24 bits) Classful Addresses Class A 1 Class B 1 0 Net id Host id (16 bits) Class C 1 1 0 Net id Host id (8 bits) Class D 1 1 1 0 Multicast group id Class E 1 1 1 1 0 Reserved for future use
Chapter 2 Address ranges for different classes Class Range A 1.0.0.0 to 126.255.255.255 B 128.0.0.0 to 191.255.255.255 C 192.0.0.0 to 223.255.255.255 D 224.0.0.0 to 239.255.255.255 E 240.0.0.0 to 255.255.255.255
Chapter 2 Classful Addresses • Class A - only ~125 networks possible • Each network can support 16,777,214 hosts (2^24 - 2) • 0.0.0.0 is not assigned to a specific network • The address range 10.x.x.x (x: 0-255) is reserved for private network use (as per RFC 1918) • 127.x.x.x (x: 0-255) is reserved for loopback testing
Chapter 2 Classful Addresses • Class B - for moderate to large networks • Each network can support 65,534 hosts (2^16 - 2) • The address range 172.16.0.0 to 172.31.255.255 is reserved for private use • Class C - for small networks • Each network can support 254 hosts (2^8 - 2) • The address range 192.168.0.0 -192.168.255.255 is reserved for private use
Chapter 2 Types of Addresses • Unicast: data sent to a single host (or, an interface on a machine) • Broadcast: sent to all hosts on a network • Directed broadcast - host id with all 1’s • Eg: A packet sent to 190.10.255.255 is received by all hosts on the network 190.10.0.0 • Routers may forward these broadcast packets • Limited broadcast - 255.255.255.255 • Never forwarded by a router • Multicast: sent to a set of hosts that belong to a “multicast” group • Host id with all 0’s is not assigned as a host address, but identifies the network.
Chapter 2 Subnetting • A network can be divided into sub-networks internally, by dividing the host portion of an IP address into a subnet id and a host id within the subnetwork (a three-level hierarchy) • This activity of stealing bits from the host portion to further subdivide the network portion of an address is called subnetting a network address, or subnetting
Chapter 2 Subnet Mask • A 32-bit subnet mask identifies the network and subnet bits in an IP address • If a bit value is 1 in the subnet mask, the corresponding bit in the IP address is considered part of the network address
Chapter 2 Subnet Masks • The simplest form of subnet masking uses a technique called constant-length subnet masking (CLSM), in which each subnet includes the same number of hosts and represents a simple division of the address space made available by subnetting into multiple equal segments • Another form of subnet masking uses a technique called variable-length subnet masking (VLSM) and permits a single network address to be subdivided into multiple subnets, in which subnets need not all be the same size
Chapter 2 Subnetting Example 1: • An large organization is assigned with the network address 190.10.0.0/16. It needs to support about 150 subnets for different locations. In each subnet, it needs to support about 200 hosts. • As the first step, decide the number of bits needed from host bits to represent the subnet ID.
Chapter 2 Subnetting Example 1: • Subnetting the network 190.10.0.0 by using 8 bits of the 16 host id bits • Subnet mask: 255.255.255.0 • Possible subnets: 2^8 => 256 • Possible hosts per subnet: 2^8 - 2 => 254 • Addresses of subnetworks: • 190.10.0.0 (Subnet #0) • 190.10.1.0 (Subnet #1) • …. • 190.10.255.0 (Subnet #255)
Chapter 2 Subnetting Example 1 ... • For Subnet #0: • A typical host address is 190.10.0.x where x = 1 to 254 (eg: 190.10.0.5), with a subnet mask of 255.255.255.0 • Also written as: 190.10.0.5/24 (without having to write the subnet mask) - Binary Count notation • “24” identifies the number of contiguous 1 bits in the subnet mask and is called the “length of the Extended-Network-Prefix” • Directed broadcast addresses of subnet #0: • 190.10.0.255
Chapter 2 Subnetting Example 2: • An organization is assigned with network address 193.1.1.0/24. It needs to define 6 subnets for internal departments. The largest subnet need to support 25 hosts. • Step 1: Determine the no. of bits needed from the host id bits (8 in this case) to define 6 subnets • 3 bits => 8 subnets (2 extra for future expansion) • Step 2: Determine whether the remaining host id bits (5 in this case) is sufficient for max. hosts needed per subnet
Chapter 2 Subnetting Example 2 ... • Step 2 continued … • 5 bits => 2^5 - 2 => 30 hosts per subnet • Subnet mask for each subnet: • 11111111 11111111 11111111 11100000 • 255.255.255.224 • Extended network prefix for each subnet: /27 • Network addresses: • Base network: 193.1.1.0/24 • Subnet #0: 193.1.1.0/27 • Subnet #7: 193.1.1.224/27
Chapter 2 Subnetting Example 2 ... • Valid host addresses for Subnet #2: • Subnet#2: 11000001.00000001.00000001.01000000 = 193.1.1.64/27 • Host #1: 11000001.00000001.00000001.01000001 = 193.1.1.65/27 • Host #2: 11000001.00000001.00000001.01000010 = 193.1.1.66/27 • Host #3: 11000001.00000001.00000001.01000011 = 193.1.1.67/27 • …. • Host#16: 11000001.00000001.00000001.010 10000 = 193.1.1.80/27 • …. • Host#30: 11000001.00000001.00000001.01011110 = 193.1.1.94/27 • Broadcast address for each subnet: • Host id with all 1’s • For Subnet #2 above: • 11000001.00000001.00000001.01011111 = 193.1.1.95/27
Chapter 2 More Examples ... • A host IP address is 193.27.100.110/26. Determine: • the subnet address • directed broadcast address for the subnet • maximum number of possible hosts on the subnet • maximum number of possible subnets (assuming constant length subnet masking)
Chapter 2 To find the subnet address ... • When a host IP address is given, to find the subnet address: • convert the dotted decimal address to binary notation (not necessary to convert decimal digits containing solely network bits to binary) • identify the host bits in the IP address, using the subnet mask or the extended network prefix • set all these host bits to zero • convert the resulting binary number back to dotted decimal notation
Chapter 2 To find the subnet address ... • In 193.27.100.110/26, there are 26 network bits (26 most significant bits) and 6 (32-26) host bits • This means, the decimal digit 110 contains 2 network bits (2 most significant bits) and 6 host bits (6 least significant bits) • decimal 110 => binary 01 101110 • Host bits are: 101110 • Setting host bits to 0 => 01 000000 => 64 (decimal) • Therefore, subnet address = 193.27.100.64/26
Chapter 2 To find the broadcast address ... • When a host IP address is given, to find the broadcast address: • convert the dotted decimal address to binary notation (not necessary to convert decimal digits containing solely network bits to binary) • identify the host bits in the IP address, using the subnet mask or the extended network prefix • set all these host bits to 1 • convert the resulting binary number back to dotted decimal notation
Chapter 2 To find the broadcast address ... • As discussed previously, host bits are: 101110 • Setting host bits to 1 => 01 111111 => 127 (decimal) • Therefore, broadcast address = 193.27.100.127/26
Chapter 2 To find the maximum number of possible hosts in a subnet ... • Number of host bits = 6 (32-26) • Max. possible addresses per subnet = 2^6 = 64 • As host bits with all 0’s and all 1’s are not valid host addresses, max. number of hosts possible = 64-2 => 62
Chapter 2 To find the maximum number of subnets ... • Number of subnet bits = 26 - 24 => 2 (where: 26 = total number of network bits 24 = default network bits in the given Class C address) • Max. possible subnets = 2^2 = 4
Chapter 2 Variable Length Subnet Masks (VLSM) • A limitation of having only a single subnet mask across a given network-prefix is that once the mask is selected, it locks the organization into a fixed number of fixed-sized subnets. • In Subnetting Example 1 (subnetting 190.10.0.0 using 8 bits of the host id), there are 256 possible subnets with 254 hosts each. • If a small subnet needs only a max. of 10 hosts, this wastes IP addresses • A solution is to allow a subnetted network to use more than one subnet mask (RFC 1009)
Chapter 2 VLSM Example: • An organization is assigned the network number 140.25.0.0/16. It plans to divide the address space into 16 equal sized blocks (subnets 0-15), and then to sub-divide subnet #14 into 16 equal-sized blocks. • Using 4 bits for subnet id, 16 subnets of the 140.25.0.0/16 address block are: Base net: 10001100.00011001.00000000.00000000 = 140.25.0.0/16 Subnet #0: 10001100.00011001.00000000.00000000 = 140.25.0.0/20 Subnet #1: 10001100.00011001.00010000.00000000 = 140.25.16.0/20 …. Subnet #14: 10001100.00011001.11100000.00000000 = 140.25.224.0/20 Subnet #15: 10001100.00011001.11110000.00000000 = 140.25.240.0/20
Chapter 2 VLSM Example ... • Using 4 more bits for sub-subnet id, 16 sub-subnets of Subnet #14 are: Subnet #14: 10001100.00011001.11100000.00000000 = 140.25.224.0/20 Subnet #14-0: 10001100.00011001.11100000.00000000 = 140.25.224.0/24 Subnet #14-1: 10001100.00011001.11100001.00000000 = 140.25.225.0/24 …. Subnet #14-14: 10001100.00011001.11101110.00000000 = 140.25.238.0/24 Subnet #14-15: 10001100.00011001.11101111.00000000 = 140.25.239.0/24 • Host addresses for Subnet #14-1: Host #1: 10001100.00011001.11100001.00000001 = 140.25.225.1/24 Host #2: 10001100.00011001.11100001.00000010 = 140.25.225.2/24 …. Host #254: 10001100.00011001.11100001.11111110 = 140.25.225.254/24 • Broadcast address for Subnet #14-1=140.25.225.255
Chapter 2 The Vanishing IP Address Space • Interim solutions for IPv4 address depletion problem: • IETF introduced a new way to carve up the IP address space—Classless Inter-Domain Routing (CIDR) • RFC 1918 reserves three ranges of IP addresses for private use—a single Class A (10.0.0.0-10.255.255.255), 16 Class Bs (172.16.0.0-172.31.255.255), AND 256 Class Cs (192.168.0.0-192.168.255.255). When used together with Network Address Translation (a.k.a NAT), private IP addresses can help lift the “cap” on public IP addresses
Chapter 2 Classless Inter-Domain Routing (CIDR) • Abandons the rigid address classes to eliminate the inefficiency in classful addressing • CIDR ignores the traditional A, B, and C class designations for IP addresses, and can therefore set the network-host ID boundary wherever it wants to. • To use a CIDR address on any network, all routers in the routing domain must “understand” CIDR notation
Chapter 2 Classless Inter-Domain Routing (CIDR) • Allows more efficient aggregation of routing info • Route Aggregation: Use of a single entry in a routing table to represent address space of several networks • Reduces the size of routing tables in routers • Allows Supernetting • Using contiguous blocks of Class C addresses to simulate a single, large address space • Documented in RFCs 1517 to 1520 • Eg: 192.125.61.8/20 identifies a network with a 20-bit network prefix
Chapter 2 Supernets • Supernetting takes the opposite approach to subnetting: by combining contiguous network addresses, it steals bits from the network portion and uses them to create a single, larger contiguous address space for host addresses • Example: An organization has the following contiguous Class C addresses 212.56.132.0/24 11010100 00111000 1000010000000000 212.56.133.0/24 11010100 00111000 1000010100000000 212.56.134.0/24 11010100 00111000 1000011000000000 212.56.135.0/24 11010100 00111000 1000011100000000
Chapter 2 Supernets • The common prefix for all the 4 addresses is: 11010100 00111000 100001 • They can be aggregated as: 212.56.132.0 / 22 • In the Supernet, the network ID has 22 bits and the host ID has 10 bits • The network address of supernet: 212.56.132.0/22 • The broadcast address of supernet: 212.56.135.255/22 • Valid Host addresses: 212.56.132.1/22 - 212.56.135.254/22
Chapter 2 Summary • IP addresses allow identifying individual network interfaces (and therefore computers or other devices as well) on TCP/IP networks • With Classful addressing, 5 address classes (A to E) are defined • Classes A through C are assigned to individual hosts and consists of network ID and host ID portions
Chapter 2 Summary • To help ease address scarcity, the IETF created a form of classless addressing called Classless Inter-Domain Routing (CIDR) that permits the network-host boundary basically anywhere • Subnetting divides an assigned address space into smaller groups (subnetworks) by using bits from the host portion to form a subnetwork ID
Chapter 2 Summary • Within the Class A, B, and C IP address ranges, the IETF has reserved private IP address ranges • With CIDR, Supernetting is possible. Supernetting allows borrowing bits from the network portion (opposite of subnetting) to be used as host addresses, to form a “Supernet” by combining contiguous Class C addresses
Chapter 2 References • RFC 1878, Variable Length Subnet Table For IPv4, Dec.1995 • http://www.mcmcse.com/articles/subnetting.shtml (on Subnetting Confusion)