- Nov 9, 2001
Let's start with a few definitions. A network model reflects a design or architecture to accomplish communication between different systems. Network models are also referred to as network stacks or protocol suites. Examples of network models includes TCP/IP, Sequenced Packet Exchange/Internet Packet Exchange (SPX/ IPX) used by Novelle Netware, the Network Basic Input Output System (Net-BIOS), which comprises the building blocks for most Microsoft networking and network applications; and AppleTalk, the network model for Apple Macintosh computers.
A network model usually consists of layers. Each layer of a model represents specific functionality. Within the layers of a model, there are usually protocols specified to implement specific tasks. You may think of a protocol as a set of rules or a language. Thus, a layer is normally a collection of protocols.
There are a number of different network models. Some of these models relate to a specific implementation, such as the TCP/IP network model. Others simply describe the process of networking, such as the International Organization for Standardization/Open System Interconnection Reference Model (ISO/ OSI-RM, or more simply, OSI-RM).
The International Organization for Standardization (ISO) is a worldwide body that promotes standards internationally. In the late 1970s, ISO began work on developing a standard for multivendor computer interconnectivity. The result, published in the late 1980s, was the Open System Interconnection (OSI) model. The OSI model incorporates protocols that can be used to implement a network stack. These protocols are not used extensively largely due to the popularity of the TCP/IP protocol suite. Consequently, the OSI model, with its well-defined layers, is used primarily as a reference model, hence, OSI-RM. Many network models are described by way of OSI-RM and so we provide a description of it here. The OSI-RM is depicted in Figure 11.
Figure 11 The OSI-RM
As indicated in Figure 11, each of the layers are numbered 1 through 7 from physical to application layer.
LAYER 7 All of the capabilities of networking begin in the Application layer. File transfer, messaging, web browsing, and other applications are in this layer. Each such application will appropriately invoke processing of data for transmission through well-defined interfaces to layer(s) below this one.
LAYER 6 The Presentation layer is responsible for data formatting. It takes care of such things as bit and byte ordering and floating point representation. Examples include External Data Representation (XDR) and Abstract Syntax Notation (ASN).
LAYER 5 The Session layer handles the exchange of data through dialog procedures or chat or conversation protocols. This layer is largely designed for mainframe and terminal communications. It has no relevance with respect to TCP/IP networking.
LAYER 4 The Transport layer is responsible for the reliable transfer of data between systems. It manages the communication session including flow control, ordering of information, error detection, and recovery of data.
LAYER 3 The Network layer owns the responsibility of delivering data between different systems in different interconnected networks (internets 1).
LAYER 2 The Data Link layer provides rules for sending and receiving data between two connected nodes over a particular physical medium.
LAYER 1 The Physical layer defines the required hardware, such as cables and interfaces, for a given medium of communication, such as electrical, radio frequency, and light-based. In this way, methods for transmitting and receiving bit-streams of information are defined.
There is a great deal more to the OSI model than we have discussed here. For complete details on this standard, visit
Also, see "For Further Reading" on page 15 for more resources on this topic.
Next, we discuss the TCP/IP model and begin our journey into the world of TCP/IP networking. We will compare it with the OSI model at the end of the next section.
The TCP/IP Network Model
The TCP/IP network model takes its name from two of its protocols, the Transmission Control Protocol (TCP) and the Internet Protocol (IP). Figure 12 provides a five-layer 2 representation of the TCP/IP Model. By utilizing a five-layer model, the lower four layers are numbered identically to the lower four layers of the OSI-RM model.
The lower four layers of the model represent functionality performed internally by the Linux kernel. The Application layer includes commands and daemons.
The process of initiating a network communication, like executing telnet hostname, causes the initiator (usually the client) to encapsulate application data, beginning at the top of the model and moving down, for the network transmission. In other words, each layer wraps the data passed to it by the previous layer with information used to determine where the packet is supposed to go and which service needs to be invoked to handle the application data itself. The information added by each layer is called a header when it is prefixed to the data from the previous layer, and a trailer when it is suffixed. On the left-hand side of Figure 12, you see an increasing number of rectangles as you scan down the layers. The area in gray represents the information added by each layer.
The receiving system, normally the server, performs the same steps except in reverse (bottom to top), deencapsulating the data. Each layer is responsible for
Figure 12 The TCP/IP Model
interpreting the header generated by the same layer on the sending system. This process is known as peer-to-peer communication.
The information produced during encapsulation, or read during deencapsula-tion by each layer is ascribed a name as shown in Figure 12. For Layer 5, if the underlying Transport layer protocol is the TCP, then the data produced or read by Layer 5 is called a stream; if the underlying Transport layer protocol is the User Datagram Protocol (UDP), then it is called a message. For Layer 4, if the protocol used is TCP, then the data produced or read by Layer 4 is called a segment. Otherwise, if it is UDP, then it is called a packet. The data of Layer 3 is called a datagram; of Layer 2, a frame or cell; and of Layer 1, a signal.
The term packet is commonly used instead of signal and/or frame.
In the following sections, we will briefly review the information generated by each layer and its purpose.
The Hardware Layer
The Hardware layer is responsible for exactly that_hardware. This includes cables, interface cards, and repeaters. It accepts the data passed to it by the Network Interface layer and prefixes something called the Preamble, which is a well-known sequence of 64 bits used for synchronization purposes. When it finishes its work, it generates a signal to be submitted to the media (electrically-based cables in most cases). The Hardware layer also imposes the maximum transfer unit (MTU) used by the Internet layer to ensure that the Hardware layer does not get frames 3 that are too large or too small. For Ethernet, the MTU for the signal is 1526 octets, and the minimum signal size is 72 octets.4 There are two hardware devices which operate at this layer: repeaters and amplifiers. A repeater is a device with a number of ports (usually four or more) that is capable of receiving signals, filtering out noise (phenomena not related to the communication at hand), and repeating the signals to every port except the ingress (incoming) port. Amplifiers perform the same task, except that they do not filter noise. Consequently, repeaters are employed in electrical communications environments and amplifiers are employed in light-based communications environments. These devices are often called hubs or concentrators. We will discuss this layer in greater detail in Chapter 2.
The Network Interface Layer
You may think of the Network Interface layer as a collection of device drivers. Its responsibility is to prepare the data passed to it from the Internet layer for signaling. It does this by prefixing its header (indicated as NILH in Figure 12), computing a Cyclic Redundancy Check (CRC_a 32-bit checksum), appending the CRC to the datagram, and passing this information to the device (interface) for signaling in what is called a frame. In particular, this layer understands physical addresses (often referred to as Media Access Control [MAC] addresses). When using Ethernet, this is often called an Ethernet address. Physical addresses are local and only need to be unique within the local network. For Ethernet interface chipsets, they are 48-bit addresses permanently written into the programmable read-only memory (PROM).
The Network Interface layer writes both the destination and source physical address into its header during encapsulation. Consequently, it is at this layer that, during deencapsulation, initial decisions are made about whether or not to continue processing an incoming frame up the stack. This is discussed in detail in Chapter 2.
There is one device associated with this layer. It is a switch. Switches look very much like repeaters, a piece of hardware with at least two network ports, but are more intelligent than repeaters. Since they operate at the Network Interface layer, they are able to make decisions based on physical addresses. Switches are sometimes called hubs or bridges or layer 2 routers.
Switches are sometimes called bridges (or the other way around, if you like). Bridge is an older term that is not commonly used today. Unfortunately, the terms switching, layer 2 switching, and layer 3 switching all confound the issue of what is really being described. Most of the variation in the base term "switch" comes from vendors of switches and routers. An argument could be made that the proper term for the layer 2 device that is capable of making packet-forwarding decisions based on physical addresses is "bridge." A similar argument could be made for the term switch. I could coin a new term, say swidge, but I haven't got the courage, and, besides, it would probably make matters worse. After all, companies like Cisco aren't likely to change their terminology just because I say so. I had to make a decision about which term to use. So I decided to use switch. Throughout this book, I will make no distinction between bridge and switch and will use the term switch to mean a layer 2 device that is capable of making packet-forwarding decisions based on physical addresses.
The Internet Layer
The Internet layer is responsible for a variety of tasks. In order to accomplish these tasks it uses three principal protocols. The Internet Protocol (IP), the Internet Control Messaging Protocol (ICMP), and the Internet Group Management Protocol (IGMP). The IP is responsible for routing and fragmentation.5 The ICMP generates error messages, assists routing through redirection, may implement rudimentary flow control, supports the ping command, supports router discovery, and may generate timestamp and netmask queries and responses. The IGMP supports Internet Layer multicasting. Each of these protocols has two available versions: 4 and 6.
The device that operates at this layer is a router. Routers are nodes that implement the intelligence of the Internet layer protocols and forward datagrams to the appropriate networks or subnetworks (discussed in Chapter 4) based on IP addresses and the routing algorithm (described in Chapter 6). Routers are sometimes called layer 3 switches. Unfortunately, routers are also sometimes called hubs.
The Internet layer produces or reads the Internet layer header. The header contains a lot of information and, in particular, includes the source and destination IP address associated with the packet. There are two versions of the protocols in this layer: version 4 and version 6. IPv4 addresses are 4 octets while IPv6 addresses are 16 octets. These are global addresses, meaning that all nodes throughout a collection of networks that are interconnected (internet) must be uniquely identified by this address. Data is passed through such an internet by the process of routing. Routing is performed by examining a portion of an IP address in order to determine to which network the data needs to be sent (effectively the purpose of the routing algorithm). Linux systems can act as routers. This header, together with the overall functionality of the Internet layer, is largely discussed in Chapters 4, 5, and 6. Additional details of the Internet layer and Linux router functionality are given in the last six chapters of this book.
The Transport Layer
The Transport Layer is responsible for the end-to-end flow of data. There are two primary protocols used within this layer (TCP and the UDP). An application will use one or the other of these protocols for a given communication. These protocols, the headers they produce or read, and the Transport layer are described in Chapter 7.
The Application Layer
This is the layer where all the applications live. These applications are responsible for understanding the data format as well as interpreting the data. Example applications include the Domain Name Service (DNS), the Dynamic Host Configuration Protocol (DHCP), the Network File System (NFS), Samba, electronic mail (e-mail), the file transfer protocol (FTP), and the telnet utility. The Application layer is discussed in Chapter 8.
The device that operates at this layer is the gateway. Unfortunately, gateway is a term, somewhat like hub, that is used in many ways. We generally define it to mean a link between distinct and/or different computer networks. Often, it is used to refer to a system that is capable of converting from one network protocol stack to another, such as a system that is interconnected into both a TCP/IP network and a Netware network. Gateway is often used to refer to a system that interconnects an internal internetwork and an external network such as the Internet. Other uses of the term gateway are described as they arise.