The TCP/IP Protocol Layers

The TCP/IP Protocol Layers
Figure 2.1 shows the TCP/IP protocol suite in relationship to the OSI reference model. The network
interface layer, which corresponds to the OSI physical and data link layers, is not really part of the
specification. However, it has become a de facto layer either as shown in Figure 2.1 or as separate
physical and data link layers. It is described in this section in terms of the OSI physical and data link
layers.

The physical layer contains the protocols relating to the physical medium on which TCP/IP will be
communicating. Officially, the protocols of this layer fall within four categories that together describe all
aspects of physical media:
Electrical/optical protocols describe signal characteristics such as voltage or photonic levels, bit
timing, encoding, and signal shape.
Mechanical protocols are specifications such as the dimensions of a connector or the metallic
makeup of a wire.
Functional protocols describe what something does. For example, "Request to Send" is the
functional description of pin 4 of an EIA-232-D connector.
Procedural protocols describe how something is done. For example, a binary 1 is represented on
an EIA-232-D lead as a voltage more negative than –3 volts.
The data link layer was described in Chapter 1, "Basic Concepts: Internetworks, Routers, and Addresses."
This layer contains the protocols that control the physical layer: how the medium is accessed and shared,
how devices on the medium are identified, and how data is framed before being transmitted on the
medium. Examples of data link protocols are IEEE 802.3/Ethernet, IEEE 802.5/Token Ring, and FDDI.
The internet layer, corresponding to the OSI network layer, is primarily responsible for enabling the
routing of data across logical internetwork paths, such as in Figure 1.9, by defining a packet format and
an addressing format. This layer is, of course, the one with which this book is most concerned.
The host-to-host layer, corresponding to the OSI transport layer, specifies the protocols that control the
internet layer, much as the data link layer controls the physical layer. Both the host-to-host and data link
layers can define such mechanisms as flow and error control. The difference is that while data link
protocols control traffic on the data link— the physical medium connecting two devices— the transport
layer controls traffic on the logical link— the end-to-end connection of two devices whose logical
connection traverses a series of data links.
The application layer corresponds to the OSI session, presentation, and application layers. Although
some routing protocols such as BGP and RIP reside at this layer, the most common services of the
application layer provide the interfaces by which user applications access the network.
A function common to the protocol suite of Figure 2.1 and any other protocol suites is multiplexing
between layers. Many applications may use a service at the host-to-host layer, and many services at the
host-to-host layer may use the internet layer. Multiple protocol suites (IP, IPX, AppleTalk, for example)
may share a physical link via common data link protocols.
The IP Packet Header
Figure 2.2 shows the format of the IP packet header, specified in RFC 791. Most fields in this packet have
some importance to routing.

Version identifies the I P version to which the packet belongs. This four-bit field is usually set to binary
0100; version 4 (IPv4) is in current, common use. A newer version of the protocol, not yet in widespread
deployment, is version 6 (IPv6), sometimes referred to as" next-generation IP"(IPng). All currently
assigned version numbers can be seen in Table 2.1, along with a few of the relevant RFCs. All versions
other than 4 and 6 (built on an earlier proposal called Simple Internet Protocol, or SIP, which also carried
a version number of 6) now exist only as "culture," and it will be left to the curious to read their cited
RFCs.
Header Length is a four-bit field that tells, as the name implies, the length of the IP header. The reason
this field is included is that the Options field (described later in this section) can vary in size. The
minimum length of the IP header is 20 octets, and the options may increase this size up to a maximum of
24 octets. This field describes the length of the header in terms of 32-bit words— five for the minimum
160-bit size and six for the maximum.
Table 2.1. IP version numbers.
Number Version RFC
0 Reserved
1–3 Unassigned
4 Internet Protocol (IP) 791
5 ST Datagram Mode 1190
6 Simple Internet Protocol (SIP)
6 IPng 1883
7 TP/IX 1475
8 P Internet Protocol (PIP) 1621
9 TCP and UDP over Bigger Addresses (TUBA) 1347
10–14 Unassigned
15 Reserved
Type of Service (TOS) is an eight-bit field that can be used for specifying special handling of the packet.
This field actually can be broken down into two subfields: Precedence and TOS. Precedence sets a
priority for the packet, the way a package might be sent overnight, 2-day delivery, or general post. TOS
allows the selection of a delivery service in terms of throughput, delay, reliability, and monetary cost.
Although this field is not commonly used (all the bits will usually be set to zero), early specifications of
the Open Shortest Path First (OSPF) protocol called for TOS routing. Also, the Precedence bits are occasionally used in Quality of Service (QoS) applications. Figure 2.3 summarizes the eight TOS bits; for
more information , see RFC 1340 and RFC 1349.
Figure 2.3. The Type of Service field.
Total Length is a 16-bit field specifying the total length of the packet, including the header, in octets. By
subtracting the header length, a receiver may determine the size of the packet's data payload. Because the
largest decimal number that can be described with 16 bits is 65,535, the maximum possible size of an IP
packet is 65,535 octets.
Identifier is a 16-bit field used in conjunction with the Flags and Fragment Offset fields for fragmentation
of a packet. Packets must be fragmented into smaller packets if the original length exceeds the Maximum
Transmission Unit (MTU) of a data link through which they pass. For example, consider a 5,000-byte
packet traveling through an internetwork. It encounters a data link whose MTU is 1,500 bytes— that is,
the frame can contain a maximum packet size of 1,500 bytes. The router that places the packet onto this
data link must first fragment the packet into chunks of no more than 1,500 octets each. The router then
marks each fragment with the same number in the Identifier field so that a receiving device can identify
the fragments that go together.[1]
[1] A fragmented packet is not reassembled at the other end of the data link; the packet stays fragmented until it reaches its final destination.
NOTE
The DF bit can be used in troubleshooting to determine a path's MTU.
Flags is a three-bit field in which the first bit is unused. The second is the Don't Fragment (DF) bit. When
the DF bit is set to one, a router cannot fragment the packet. If the packet cannot be forwarded without
fragmenting, the router drops the packet and sends an error message to the source. This function enables
the testing of MTUs in an internetwork. The DF bit can be set using the Extended Ping utility on Cisco
routers, as shown in Figure 2.4.
30

TCP/IP Review

The TCP/IP Protocol Layers
The IP Packet Header
IP Addresses
ARP
ICMP
The Host-to-Host Layer
The purpose of this chapter is to examine the details of the protocols that enable, control, or contribute to
the routing of TCP/IP, not to do an in-depth study of the TCP/IP protocol suite. Several books on the
recommended reading list at the end of the chapter cover the subject in depth. Read at least one.
Conceived in the early 1970s by Vint Cerf and Bob Kahn, TCP/IP and its layered protocol architecture
predates the ISO's OSI reference model. A brief review of TCP/IP's layers will be useful in understanding
how the various functions and services examined in this chapter interrelate.