1 Lesson 4 Understanding the TCP/IP Internet Layer Overview Objectives There are various aspects to IP addressing, including calculations for constructing an IP address, classes of IP addresses designated for specific routing purposes, and public versus private IP addresses. There are also two different types of IP addresses: IP version 4 (IPv4) and IP version 6 (IPv6). The 32 bit IPv4 address type is currently the most common, but the 128 bit IPv6 address is also in use, and will probably become the more common address type over time. This lesson describes 32 bit IPv4 addressing, except where IPv6 is explicitly identified. How do end systems initially obtain their IP address information? Although manual assignment of IP address information is possible, it does not scale and is a barrier to deployment and maintenance of networks. Therefore, protocols for the automatic assignment of IP address information have evolved and now provide this essential function without end user intervention. This lesson describes how IP address protocols function. Upon completing this lesson, you will be able to list the sequence of steps used by IP operations to manage IP addresses and to map between IP addresses and MAC addresses. This ability includes being able to meet these objectives: List the characteristics of the Internet Protocol Describe the components of an IPv4 address Describe the structure of an IPv4 address Describe the classes of IP addresses Describe reserved IP addresses Compare public and private IP addresses Define the function of DHCP in IP addressing
2 Define the function of DNS in IP addressing Identify common host tools to determine the IP address of a host 1 64 Interconnecting Cisco Networking Devices Part 1 (ICND1) v Cisco Systems, Inc.
3 Internet Protocol The IP component of TCP/IP determines where packets of data are to be routed based on their destination addresses, and IP has certain characteristics related to how it handles this function. This topic describes some of the key functions of IP. Internet Protocol Characteristics Operates at network layer of OSI Connectionless protocol Packets treated independently Hierarchical addressing Best effort delivery No data recovery features 2007 Cisco Systems, Inc. All rights reserved. ICND1 v IP uses packets to carry information through the network. A packet is a self contained, independent entity that contains data and sufficient information to be routed from the source to the destination without reliance on earlier exchanges. IP has these characteristics: IP operates at Layer 3 of the OSI model (Network Layer), and Layer 3 of the TCP/IP stack (Internet layer). IP is a connectionless protocol in which a one way datagram is sent to the destination without advance notification to the destination device. The destination device receives the data and does not return any status information to the sending device. IP uses hierarchical addressing in which the network ID is like a street and the host ID is like a house or office building on that street. IP provides service on a best effort basis and does not guarantee packet delivery. A packet can be misdirected, duplicated, or lost on the way to its destination. IP does not provide any special features that recover corrupted packets. These services are instead provided by the end systems of the network. In real time voice or video transfers, a few lost packets are tolerable; speed is more important than packet recovery, because recovering packets would delay the real time process Cisco Systems, Inc. Building a Simple Network 1 65
4 Example: Delivering a Letter through a Postal Service An analogy of IP services would be mail delivery by a postal service. In this example, you live in San Francisco and your mother lives in New York. You write three separate letters to your mother. You seal each letter in a separate envelope, address each letter to your mother, and write your return address in the upper left hand corner of each envelope. You deposit the three letters in the outgoing mail slot at your local post office. The postal service will make the best attempt to deliver the three letters to your mother in New York. However, the postal service will not guarantee that the letters will arrive at their destination. The postal service will not guarantee that all three letters will be handled by the same carrier or take the same route. Finally, the postal service will not guarantee that the letters will arrive in the order in which you mailed them Interconnecting Cisco Networking Devices Part 1 (ICND1) v Cisco Systems, Inc.
5 IP Addressing To facilitate the routing of packets over a network, the TCP/IP protocol suite uses a logical address known as an IP address. This topic describes the components of a 32 bit IPv4 address. Why IP Addresses? They uniquely identify each device on an IP network. Every host (computer, networking device, peripheral) must have a unique address. Host ID: Identifies the individual host Is assigned by organizations to individual devices Network.Host 2007 Cisco Systems, Inc. All rights reserved. ICND1 v Just as physical street addresses are necessary to identify the location of specific homes and businesses so that mail can reach those real world locations efficiently, logical IP addresses are used to identify the location of specific devices on an IP network so that data can reach those network locations efficiently. Every host, computer, networking device, or peripheral connected to the Internet has a unique 32 bit IP address that identifies it. Without a structure for allocating all those IP addresses, it would be impossible to route packets efficiently. Learning how IP addresses are structured and how they function in the operation of a network provides an understanding of how IP packets are forwarded over networks using TCP/IP. The IPv4 address is the most common type of address currently used on the Internet. IPv4 addresses are 32 bit numbers that describe the location of a network device. An IP address is a hierarchical address and consists of these two parts: The network address portion (network ID) describes the network of which this IP address is a part. The router maintains information about routes to each network. The host address component (host ID) identifies a specific endpoint. These endpoints are the servers, computers, and other devices connected to the network Cisco Systems, Inc. Building a Simple Network 1 67
6 IP Address Fields This topic describes the IP address fields in the IP protocol data unit (PDU). IP PDU Header 2007 Cisco Systems, Inc. All rights reserved. ICND1 v As you saw in the Host to Host Communication Model lesson, as data travels down the protocol stack it is encapsulated. At the Internet layer it is encapsulated into a PDU (commonly called a packet). The header for this packet has several fields. In this topic we will focus on two of those fields: Source Address: Specifies the sending node s IP address. Destination Address: Specifies the receiving node s IP address Interconnecting Cisco Networking Devices Part 1 (ICND1) v Cisco Systems, Inc.
7 IP Address Format: Dotted Decimal Notation The binary to decimal and decimal tobinary conversion will be detailed later in this course Cisco Systems, Inc. All rights reserved. ICND1 v In any given IP address, some portion of the 32 bit number represents the network and the remaining bits represent the host. While many computers may share the same network address, combining the network address with a host address uniquely identifies any device connected to the network. As shown in the figure, the IP binary number is For usability, these 32 bit numbers are broken up into 4 groups of numbers called octets (1 octet = 8 bits). Each octet is then represented as a decimal number between 0 and 255 and separated by a period, or dot. This scheme is known as dotted decimal notation. The IP address shown above can be written as and spoken as 172 dot 16 dot 128 dot Cisco Systems, Inc. Building a Simple Network 1 69
8 IP Address Classes To accommodate different sizes of networks and aid in classifying them, IP addresses are divided into categories called classes. This topic describes the IP address classes and the structure of the IP addresses within them. IP Address Classes: The First Octet 2007 Cisco Systems, Inc. All rights reserved. ICND1 v Class A Class B Assigning IP addresses to classes is known as classful addressing. The classes were determined during the early days of the Internet by the Internet Assigned Numbers Authority (IANA). Each IP address is broken down into a network ID and the host ID. In addition, a bit or bit sequence at the start of each address determines the class of the address. The figure shows three of the five IP address classes, as follows. The Class A address uses only the first octet (8 bits) of the 32 bit number to indicate the network address. The remaining three octets of the 32 bit number are used for host addresses. The first bit of a Class A address is always 0. Since the first bit is a 0, the lowest number that can be represented is (decimal 0), and the highest number that can be represented is (decimal 127). However, these two network numbers, 0 and 127, are reserved and cannot be used as network addresses. Any address that starts with a value between 1 and 126 in the first octet of the 32 bit number is a Class A address. The Class B address uses two of the four octets (16 bits) to indicate the network address. The remaining two octets specify host addresses. The first 2 bits of the first octet of a Class B address are always binary 10. Starting the first octet with binary 10 ensures that the Class B space is separated from the upper levels of the Class A space. The remaining 6 bits in the first octet may be populated with either 1s or 0s. Therefore, the lowest number that can be 1 70 Interconnecting Cisco Networking Devices Part 1 (ICND1) v Cisco Systems, Inc.
9 Class C represented with a Class B address is (decimal 128), and the highest number that can be represented is (decimal 191). Any address that starts with a value in the range of 128 to 191 in the first octet is a Class B address. In a Class C address, the first three octets (24 bits) of the IP address identify the network portion, with the remaining octet reserved for the host portion. A Class C address begins with binary 110. Therefore, the lowest number that can be represented is (decimal 192), and the highest number that can be represented is (decimal 223). If an address contains a number in the range of 192 to 223 in the first octet, it is a Class C address. IP Address Ranges First Octet Dec. Value First Octet Binary Value *127 ( ) is a Class A address reserved for loopback testing and cannot be assigned to a network Cisco Systems, Inc. All rights reserved. ICND1 v The figure shows the IP address range of the first octet (in decimal and binary) for IP address classes A C, as well as the number of host addresses available for each class of addresses Cisco Systems, Inc. Building a Simple Network 1 71
10 Reserved IP Addresses Certain IP addresses are reserved and cannot be assigned to individual devices on a network. These reserved addresses include a network address, which is used to identify the network itself, and a broadcast address, which is used for broadcasting packets to all of the devices on a network. This topic describes the types of reserved IP addresses and provides examples of each. Reserved Address 2007 Cisco Systems, Inc. All rights reserved. ICND1 v Network Address An IP address that has binary 0s in all host bit positions is reserved for the network address. Therefore, as a Class A network example, is the IP address of the network containing the host As a Class B network example, the IP address is a network address, while would be a Class C network. A router uses the network IP address when it searches its IP route table for the destination network location. The decimal numbers that fill the first two octets in a Class B network address are assigned. The last two octets contain 0s because those 16 bits are for host numbers and are used for devices that are attached to the network. In the IP address , the first two octets are reserved for the network address; it is never used as an address for any device that is attached to it. An example of an IP address for a device on the network would be In this example, is the network address portion and 16.1 is the host address portion. Directed Broadcast Address To send data to all the devices on a network, a broadcast address is used. Broadcast IP addresses end with binary 1s in the entire host part of the address (the host field). For the network in the example ( ), in which the last 16 bits make up the host field (or host part of the address), the broadcast that would be sent out to all devices on that network would include a destination address of Interconnecting Cisco Networking Devices Part 1 (ICND1) v Cisco Systems, Inc.
11 The directed broadcast is capable of being routed. However, for some versions of the Cisco IOS operating system, routing directed broadcasts is not the default behavior. Local Broadcast Address If an IP device wants to communicate with all devices on the local network, it sets the destination address to all 1s ( ) and transmits the packet. For example, hosts that do not know their network number and are asking some server for it may use this address. The local broadcast is never routed. Local Loopback Address A local loopback address is used to let the system send a message to itself for testing. A typical local loopback IP address is Autoconfiguration IP Addresses Network ID Host ID When neither a statically nor a dynamically configured IP address is found on startup, those hosts supporting IPv4 link local addresses (RFC 3927) will generate an address in the /16 prefix range. This address can be used only for local network connectivity and operates with many caveats, one of which is that it will not be routed. You will mostly see this address as a failure condition when a PC fails to obtain an address via DHCP. The network portion of an IP address is also referred to as the network ID, which is important because most hosts on a network can directly communicate only with devices in the same network. If the hosts need to communicate with devices that have interfaces assigned to some other network ID, there must be a network device that can route data between the networks. This is true even when the devices share the same physical media segment. A network ID enables a router to put a packet onto the appropriate network segment. The host ID helps the router deliver the Layer 2 frame encapsulating the packet to a specific host on the network. As a result, the IP address is mapped to the correct MAC address, which is needed by the Layer 2 process on the router to address the frame. Each class of a network allows a fixed number of hosts. In a Class A network, the first octet is assigned to the network, leaving the last three octets to be assigned to hosts. The first host address in each network (all 0s) is reserved for the actual network address, and the final host address in each network (all 1s) is reserved for broadcasts. The maximum number of hosts in a Class A network is (subtracting the network and broadcast reserved addresses), or 16,777,214. In a Class B network, the first two octets are assigned to the network, leaving the final two octets to be assigned to hosts. The maximum number of hosts in a Class B network is , or 65,534. In a Class C network, the first three octets are assigned to the network. This leaves the final octet to be assigned to hosts, so the maximum number of hosts is 2 8 2, or Cisco Systems, Inc. Building a Simple Network 1 73
12 Public and Private IP Addresses Some networks connect to each other through the Internet, while others are private. For instance, the example addresses used in this course are private, which means that they are not assigned to public use. Both public and private IP addresses are required for both of these network types. This topic describes the purpose and sources for public and private IP addresses. Public IP Addresses 2007 Cisco Systems, Inc. All rights reserved. ICND1 v Public IP Addresses Internet stability depends directly on the uniqueness of publicly used network addresses. Therefore, some mechanism is needed to ensure that addresses are, in fact, unique. This responsibility originally rested within an organization known as the InterNIC (Internet Network Information Center). The IANA succeeded the InterNIC. IANA carefully manages the remaining supply of IP addresses to ensure that duplication of publicly used addresses does not occur. Such duplication would cause instability in the Internet and compromise its capability to deliver datagrams to networks using the duplicated addresses. To obtain an IP address or block of addresses, you must contact an Internet service provider (ISP). The ISP will then contact their upstream registry or their appropriate regional registry at one of these organizations: APNIC (Asia Pacific Network Information Center) ARIN (American Registry for Internet Numbers) RIPE NCC (Réseaux IP Européens Network Coordination Centre) With the rapid growth of the Internet, public IP addresses began to run out, so new addressing schemes such as Network Address Translation (NAT), classless interdomain routing (CIDR), and IPv6 were developed to help solve the problem Interconnecting Cisco Networking Devices Part 1 (ICND1) v Cisco Systems, Inc.
13 Private IP Addresses Class Private Address Range A to B to C to Cisco Systems, Inc. All rights reserved. ICND1 v Private IP Addresses While Internet hosts require a globally unique IP address, private hosts that are not connected to the Internet can use any valid address, as long as it is unique within the private network. But because many private networks exist alongside public networks, grabbing just any address is strongly discouraged. In 1994, the IETF released a document titled RFC 1597, which stated that many organizations used TCP/IP and IP addresses, yet remained unconnected to the Internet. RFC 1597 was updated to RFC 1918, suggesting that a block of the available IP address space could be set aside for private networks. Private networks that needed IP for application support without requiring connectivity to the Internet could simply use addresses from those allocated for private use. Three blocks of IP addresses (one Class A network, 16 Class B networks, and 256 Class C networks) have been designated for private, internal use. Addresses in this range are not routed on the Internet backbone (see figure). Internet routers are configured to discard private addresses. When addressing a nonpublic intranet, these private addresses can be used instead of globally unique addresses. When a network using private addresses must connect to the Internet, it is necessary to translate the private addresses to public addresses. This translation process is NAT. A router is often the network device that performs NAT Cisco Systems, Inc. Building a Simple Network 1 75
14 Dynamic Host Configuration Protocol (DHCP) There are several automated methods, using protocols, for assigning IP addresses. This topic describes the DHCP method for obtaining an IP address. DHCP DHCP server unicasts offer message 2007 Cisco Systems, Inc. All rights reserved. ICND1 v DHCP is used to assign IP addresses automatically and to set TCP/IP stack configuration parameters, such as the subnet mask, default router, and Domain Name System (DNS) servers. DHCP is also used to provide other configuration information as necessary, including the length of time the address has been allocated to the host. DHCP consists of two components: a protocol for delivering host specific configuration parameters from a DHCP server to a host, and a mechanism for allocating network addresses to hosts. Using DHCP, a host can obtain an IP address quickly and dynamically. All that is required is a defined range of IP addresses on a DHCP server. As hosts come online, they contact the DHCP server and request address information. The DHCP server selects an address and allocates it to that host. The address is only leased to the host, so the host will periodically contact the DHCP server to extend the lease. This lease mechanism ensures that hosts that have been moved or are switched off for extended periods of time do not hold on to addresses that they do not use. The addresses are returned to the address pool by the DHCP server, to be reallocated as necessary Interconnecting Cisco Networking Devices Part 1 (ICND1) v Cisco Systems, Inc.
15 Domain Name System The Domain Name System (DNS) application provides an efficient way to convert humanreadable names of IP end systems into machine readable IP addresses necessary for routing. This topic describes the function of DNS. DNS Application specified in the TCP/IP suite A way to translate human readable names into IP addresses 2007 Cisco Systems, Inc. All rights reserved. ICND1 v DNS is a mechanism to convert symbolic names into IP addresses. The DNS application frees users of IP networks from the burden of having to remember IP addresses. Without this freedom, the Internet would not be as popular or as usable as it has become Cisco Systems, Inc. Building a Simple Network 1 77
16 Using Common Host Tools to Determine the IP Address of a Host Most operating systems provide a series of tools that can be used to verify the host addressing. This topic focuses on the tools available in most PCs. Network Connection 2007 Cisco Systems, Inc. All rights reserved. ICND1 v The Network Connections tab under System setup allows you to set and view the IP address configured on the PC. In this example, the PC is configured to obtain the address from a DHCP server Interconnecting Cisco Networking Devices Part 1 (ICND1) v Cisco Systems, Inc.
17 IPCONFIG can be used to display all current TCP/IP network configuration values and refresh Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. Used without parameters, ipconfig displays the IP address, subnet mask, and default gateway for all adapters. Syntax ipconfig [/all] [/renew [Adapter]] [/release [Adapter]] [/flushdns] [/displaydns] [/registerdns] [/showclassid Adapter] [/setclassid Adapter [ClassID]] Parameters /all: Displays the full TCP/IP configuration for all adapters. Without this parameter, ipconfig displays only the IP address, subnet mask, and default gateway values for each adapter. Adapters can represent physical interfaces, such as installed network adapters, or logical interfaces, such as dialup connections. /renew [Adapter]: Renews DHCP configuration for all adapters (if an adapter is not specified) or for a specific adapter if the Adapter parameter is included. This parameter is available only on computers with adapters that are configured to obtain an IP address automatically. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters. /release [Adapter]: Sends a DHCPRELEASE message to the DHCP server to release the current DHCP configuration and discard the IP address configuration for either all adapters (if an adapter is not specified) or for a specific adapter if the Adapter parameter is included. This parameter disables TCP/IP for adapters configured to obtain an IP address automatically. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters Cisco Systems, Inc. Building a Simple Network 1 79
18 /flushdns: Flushes and resets the contents of the DNS client resolver cache. During DNS troubleshooting, you can use this procedure to discard negative cache entries from the cache, as well as any other entries that have been added dynamically. /displaydns: Displays the contents of the DNS client resolver cache, which includes both entries, preloaded from the local Hosts file and any recently obtained resource records for name queries resolved by the computer. The DNS Client service uses this information to resolve frequently queried names quickly, before querying its configured DNS servers. /registerdns: Initiates manual dynamic registration for the DNS names and IP addresses that are configured at a computer. You can use this parameter to troubleshoot a failed DNS name registration or resolve a dynamic update problem between a client and the DNS server without rebooting the client computer. The DNS settings in the advanced properties of the TCP/IP protocol determine which names are registered in DNS. /showclassid Adapter: Displays the DHCP class ID for a specified adapter. To see the DHCP class ID for all adapters, use the asterisk (*) wildcard character in place of Adapter. This parameter is available only on computers with adapters that are configured to obtain an IP address automatically. /setclassid Adapter [ClassID]: Configures the DHCP class ID for a specified adapter. To set the DHCP class ID for all adapters, use the asterisk (*) wildcard character in place of Adapter. This parameter is available only on computers with adapters that are configured to obtain an IP address automatically. If a DHCP class ID is not specified, the current class ID is removed. /?: Displays help at the command prompt Interconnecting Cisco Networking Devices Part 1 (ICND1) v Cisco Systems, Inc.
19 Summary This topic summarizes the key points that were discussed in this lesson. Summary IP network addresses consist of two parts: the network ID and the host ID. IPv4 addresses have 32 bits that are divided into octets and are generally shown in dotted decimal form (for example, ). When written in a binary format, the first bit of a Class A address is always 0, the first 2 bits of a Class B address are always 10, and the first 3 bits of a Class C address are always Cisco Systems, Inc. All rights reserved. ICND1 v Summary (Cont.) Certain IP addresses (network and broadcast) are reserved and cannot be assigned to individual network devices. Internet hosts require a unique, public IP address, but private hosts can have any valid private address that is unique within the private network. DHCP is used to assign IP addresses automatically, and also to set TCP/IP stack configuration parameters such as the subnet mask, default router, and DNS servers. DNS is an application that is specified in the TCP/IP suite, providing a means to translate human readable names into IP addresses Cisco Systems, Inc. All rights reserved. ICND1 v Cisco Systems, Inc. Building a Simple Network 1 81
20 Summary (Cont.) Host provides tools that can be used to verify the IP address of the host: Network connections IPCONFIG 2007 Cisco Systems, Inc. All rights reserved. ICND1 v Interconnecting Cisco Networking Devices Part 1 (ICND1) v Cisco Systems, Inc.