IP Addressing Subnetting Objective At the conclusion of this module, the student will be able to: Describe how packets are routed from one network to another Describe the parts and classes of IPv4 address Subnet a network to meet specifications IP Addressing 2 1
Network Layer responsible for navigating the data through the network network layer's addressing scheme is used by devices to determine the destination of data as it moves through the networks Protocols that support the network layer use a hierarchical addressing scheme allows for unique addresses across network boundaries provides a method for finding a path for data to travel between networks Hierarchical addressing schemes are used by devices to determine the destination of data as it moves through the network The telephone network is an example of the use of hierarchical addressing uses an area code that designates a geographical area for the call's first stop (hop) the next three digits represent the local exchange (second hop) the final digits represent the individual destination telephone (the final hop) IP Addressing 3 Network Layer Information Routers internetworking devices that operate at the network layer interconnect network segments or entire networks pass data packets between networks based on Layer 3 information make logical decisions regarding the best path for the delivery of data on an internetwork direct packets to the appropriate output port and segment take packets from LAN devices (e.g. workstations) and forward them through the network based on Layer 3 information IP Addressing 4 2
IP Addressing 5 Path Determination occurs at layer 3 routers evaluate the available paths to a destination, and establish the preferred handling of a packet routing services use network topology information when evaluating network paths path determination is the process that the router uses to choose the next hop in the path for the packet to travel to its destination process is also called routing the packet path determination for a packet is similar to a person driving a car from one side of a city to the other a router uses a routing map (table) that shows the available paths to a destination routers make their decisions based on the traffic density and the speed of the link IP Addressing 6 3
Network and Host Addressing The network address helps the router identify a path within the network cloud The router uses the network address to identify the destination network of a packet within an internetwork network protocols use some form of host, or node, address For some network layer protocols, a network administrator assigns network host addresses according to some predetermined internetwork addressing plan For other network layer protocols, assigning host addresses is partially or completely dynamic/automatic Addressing occurs at the network layer The host portion of the address tells the router to which specific device it should deliver a packet Routers require network addresses to ensure proper delivery of packets Without some hierarchical addressing structure, packets would not be able to travel across an internetwork IP Addressing 7 Layer 3 and Computer Mobility A MAC address can be compared to your name and the network address to your mailing address if you were to move to another town, your name would remain unchanged, but your mailing address would indicate your new location. Network devices (routers as well as individual computers) have both a MAC (flat) address and a network layer protocol (hierarchical) address When you physically move a computer to a different network, the computer maintains the same MAC address, but you must assign it a new network address IP Addressing 8 4
Flat vs. Hierarchical Addressing The function of the network layer is to find the best path through the network To accomplish this, it uses two addressing methods - flat addressing and hierarchical addressing A flat addressing scheme assigns a device the next available address no thought given to the structure of the addressing scheme A vendor is given a block of addresses; the first half of each address is for the vendor's code, the rest of the MAC address is a number that has been sequentially assigned ZIP codes are a good example of hierarchical addressing In the ZIP code system the address is determined by the location of the building, not by a randomly assigned number IP addresses have a specific structure and are not randomly assigned IP Addressing 9 Network Layer Datagrams The Internet Protocol (IP) is the most popular implementation of a hierarchical network addressing scheme As information flows down the layers of the OSI model, the data is encapsulated at each layer At the network layer, the data is encapsulated within packets (also known as datagrams) IP determines the form of the IP packet header (which includes addressing and other control information) it does not concern itself with the actual data it accepts whatever is passed down from the higher layers IP Addressing 10 5
IP Addressing 11 32-BIT IP Address The IP address contains the information that is necessary to route a packet through the network Each source and destination address field contains a 32-bit address The source address field contains the IP address of the device that sends the packet The destination field contains the IP address of the device that receives the packet IP Addressing 12 6
32-BIT IP Address IP addresses are expressed as dotted-decimal numbers we break up the 32 bits of the address into four octets (an octet is a group of 8 bits) The maximum decimal value of each octet is 255 The largest 8 bit binary number is 11111111 The network number of an IP address identifies the network to which a device is attached The host portion of an IP address identifies the specific device on that network Because IP addresses consist of four octets separated by dots, one, two, or three of these octets may be used to identify the network number Similarly, up to three of these octets may be used to identify the host portion of an IP address IP Addressing 13 IP Addressing 14 7
IP Addresses Class A An example of a Class A IP address is 124.95.44.15 The internal administrators of the network assign the remaining 24 bits Class A networks use only the first octet of its IP address, which will range from 0-126 (127 does start with a 0 bit, but has been reserved for special purposes) The remaining three octets can be used for the host portion of the address Every network that uses a Class A IP address can have assigned up to 2 to-the-power of 24 (2 24 ) (minus 2), or 16,777,214, possible IP addresses to devices that are attached to its network IP Addressing 15 IP Addresses Class B The first 2 bits of a Class B address are always 10 The internal administrators of the network assign the remaining 16 bits Class B IP addresses always have values ranging from 128 to 191 in their first octet. All Class B IP addresses use the first 16 bits to identify the network part of the address The two remaining octets of the IP address can be used for the host portion of the address Every network that uses a Class B IP address can have assigned up to 2 to-the-power of 16 (2 16 ) (minus 2 again!), or 65,534, possible IP addresses to devices that are attached to its network IP Addressing 16 8
IP Addresses Class C The first 3 bits of a Class C address are always 110 The first three octets identify the network number The internal administrators of the network assign the remaining 8 bits Class C IP addresses always have values ranging from 192 to 223 in their first octet. All Class C IP addresses use the first 24 bits to identify the network part of the address Only the last octet of a Class C IP address can be used for the host portion of the address Every network that uses a Class C IP address can have assigned up to 2 8 (minus 2), or 254, possible IP addresses to devices that are attached to its network IP Addressing 17 Decimal Format for IP Addresses IP addresses identify a device on a network and the network to which it is attached To make them easy to remember IP addresses are usually written in dotted decimal notation Therefore, IP addresses are 4 decimal numbers separated by dots An example of this is the address 166.122.23.130 IP Addressing 18 9
Broadcast Addresses An IP address that ends with binary 0s in all host bits is reserved for the network address A router uses a network's IP address when it forwards data on the Internet It will never be used as an address for any device that is attached to it a Class A network example, 113.0.0.0 is the IP address of the network containing the host 113.1.2.3 a Class B network example, the IP address 176.10.0.0 is a network address The IP address in the example (176.10.0.0) is reserved for the network address IP Addressing 19 Broadcast Addresses Hosts on a network can only communicate directly with devices that have the same network ID A broadcast occurs when a source sends out data to all devices on a network It is used to communicate with all of the devices on a network If you want to send data to all of the devices on a network, you must use a broadcast address To ensure that all of the devices on the network pay attention to the broadcast, the sender must use a destination IP address that all of them recognize and will pick up Broadcast IP addresses end with binary 1s in the entire host part of the address (the host field). For the network address 176.16.0.0, the broadcast that would be sent out to all devices on that network would be 176.16.255.255 IP Addressing 20 10
Hosts for Classes of IP Addresses A Class A network, the first octet is assigned, leaving the last three octets (24 bits) to be assigned to hosts A Class A network, is 2 24 (minus 2: the network and broadcast reserved addresses), or 16,777,214 hosts. A Class B network, the first two octets are assigned, leaving the final two octets (16 bits) to be assigned to hosts The maximum number of hosts, in a Class B network, is 2 16 (minus 2), or 65,534 hosts. A Class C network, the first three octets are assigned The maximum number of hosts is 2 8 (minus 2), or 254 hosts. The first address in each network is reserved for the actual network address (or network number), and the final address in each network is reserved for broadcasts IP Addressing 21 IP Addressing 22 11
Subnetting Network administrators typically divide networks, especially large ones, into smaller networks These smaller divisions are called subnetworks and provide addressing flexibility Most of the time subnetworks are simply referred to as subnets Similar to the host number portion of Class A, Class B, and Class C addresses, subnet addresses are assigned locally, usually by the network administrator Like other IP addresses, each subnet address is unique IP Addressing 23 Why Subnet The most common reason is to control network traffic to reduce the size of a broadcast domain In an Ethernet network, all nodes on a segment see all the packets transmitted by all the other nodes on that segment Performance can be adversely affected under heavy traffic loads, due to collisions and the resulting retransmissions A router is used to connect IP networks to minimize the amount of traffic each segment must receive. IP Addressing 24 12
Subnets Subnet addresses include the Class A, Class B, or Class C network portion, plus a subnet field and a host field The subnet field and the host field are created from the original host portion for the entire network The ability to decide how to divide the original host portion into the new subnet and host fields provides addressing flexibility for the network administrator To create a subnet address, a network administrator borrows bits from the original host portion and designates them as the subnet field IP Addressing 25 To create a subnet address a network administrator borrows bits from the host field and designates them as the subnet field the minimum number of bits that can be borrowed is 2 the maximum number of bits that can be borrowed can be any number that leaves at least 2 bits remaining, for the host number In the example above for a Class C IP Address, bits from the host field for the subnet field have been borrowed IP Addressing 26 13
Subnet Mask The subnet mask determines which part of an IP address is the network field and which part is the host field A subnet mask is 32 bits long and has 4 octets, just like an IP address To determine the subnet mask for a particular subnetwork IP address 1. Express the subnetwork IP address in binary form 2. Replace the network and subnet portion of the address with all 1s 3. Replace the host portion of the address with all 0s 4. Convert the binary expression back to dotted-decimal notation The extended network prefix is determined by placing a 1 for each bit of the network address and a 1 for each subnet bit, and a zero for each bit of the host portion IP Addressing 27 Subnetting and the AND Operation The lowest numbered address in an IP network is the network address (the network number plus 0 in the entire host field) This also applies to a subnet: the lowest numbered address is the address of the subnet. In order to route a data packet, the router must first determine the destination network/subnet address by performing a logical AND using the destination host's IP address and the subnet mask The result will be the network/subnet address IP Addressing 28 14
Subnets To create subnets, you must extend the routing portion of the address The Internet knows your network as a whole, identified by the Class A, B, or C address, which defines 8, 16, or 24 routing bits (the network number) The subnet field will become additional routing bits, so that the routers within your organization can recognize different locations, or subnets, within the whole network IP Addressing 29 The subnet field always follows immediately after the network number The borrowed bits must be the first n bits of the default host field, where n is the desired size of the new subnet field IP Addressing 30 15
IP Addressing 31 The subnet mask is the tool used by the router to determine which bits are routing bits and which bits are host bits IP Addressing 32 16
Determining the Subnet Mask Size Subnet masks use the same format as IP addresses They are 32 bits long and are divided into four octets, written in dotted decimal format Subnet masks contain all 1 s in the network bit positions (determined by the address class) as well as the desired subnet bit positions contain all 0s in the remaining bit positions designated as the host portion of an address If you borrow no bits, the subnet mask for a Class B network would be 255.255.0.0 If 8 bits were to be borrowed for the subnet field, the subnet mask would include 8 additional 1 bits, and would become 255.255.255.0 IP Addressing 33 IP Addressing 34 17
Computing Subnet Masks and IP Addresses When you borrow bits from the host field, additional subnets that are being created each time you borrow one more bit you cannot borrow only 1 bit the fewest you may borrow is 2 bits Borrowing 2 bits creates four possible subnets (2 2 ) remember that there are two reserved/unusable subnets Each time you borrow another bit from the host field, the number of subnets created increases by a power of 2 eight possible subnets that are created by borrowing 3 bits is equal to 2 3 (2 x 2 x 2) sixteen possible subnets created by borrowing 4 bits is equal to 2 4 (2 x 2 x 2 x 2) Each time you borrow another bit from the host field, the number of possible subnets doubles IP Addressing 35 IP Addressing 36 18
IP Addressing 37 IP Addressing 38 19
IP Addressing 39 Layer Addressing When you configure routers, you must connect each interface to a different network segment Each of these segments will become a separate subnet You must select an address from each different subnet to assign to the interface of the router that connects to that subnet Each segment of a network - the actual wires and links - must have different network/subnet numbers IP Addressing 40 20
The figure above shows what a network diagram might look like using a subnetted Class B network IP Addressing 41 You cannot use the first and last subnet You also cannot use the first and last address within each subnet - one is the broadcast address of that subnet, and the other is part of the network address When you create subnets, you lose quite a few potential addresses For this reason, network administrators must pay close attention to the percentage of addresses that they lose by creating subnets IP Addressing 42 21
There are certain addresses in each class of IP address that are not assigned These addresses are called private addresses Private addresses might be used by hosts that use network address translation (NAT), or a proxy server, to connect to a public network; or by hosts that do not connect to the Internet at all IP Addressing 43 22