Showing posts with label OSI Reference Model. Show all posts
Showing posts with label OSI Reference Model. Show all posts

Tuesday, August 12, 2008

OSI Reference Model: Layer 1 hardware

A description of layer 1 of the OSI reference model and the hardware which relates to that layer.

The Open System Interconnect (OSI) reference model is a model, developed by the International Standards Organization (ISO), which describes how data from an application on one computer can be transferred to an application on another computer. The OSI reference model consists of seven conceptual layers which each specify different network functions. Each function of a network can be assigned to one, or perhaps a couple of adjacent layers, of these seven layers and is relatively independent of the other layers. This independence means that one layer does not need to be aware of what the implementation of an adjacent layer is, merely how to communicate with it. This is a major advantage of the OSI reference model and is one of the major reasons why it has become one of the most widely used architecture models for inter-computer communications.

The seven layers of the OSI reference model, as shown in Figure 1, are:

  • Application
  • Presentation
  • Session
  • Transport
  • Network
  • Data link
  • Physical

Figure 1: Diagram of the OSI reference model layers, courtesy of catalyst.washington.edu

Over the next few articles I will be discussing each layer of the model and the networking hardware which relates to that layer. This article, as you have probably guessed from the title, will discuss layer 1; the physical layer.

While many people may simply state that all networking hardware belongs exclusively in the physical layer, they are wrong. Many networking hardware devices can perform functions belonging to the higher layers as well. For example, a network router performs routing functions which belong in the network layer.

What does the physical layer include? Well, the physical layer involves the actual transmission of signals over a medium from one computer to another. This layer includes specifications for the electrical and mechanical characteristics such as: voltage levels, signal timing, data rate, maximum transmission length, and physical connectors, of networking equipment. For a device to operate solely in the physical layer, it will not have any knowledge of the data which it transmits. A physical layer device simply transmits or receives data.

There are four general functions which the physical layer is responsible for. These functions are:

  • Definitions of hardware specifications
  • Encoding and signaling
  • Data transmission and reception
  • Topology and physical network design

Definitions of hardware specifications

Each piece of hardware in a network will have numerous specifications. If you read my previous article titled Copper and Glass: A Guide to Network Cables [link this title to my previous article of that title], you will learn about some of the more common specifications which apply to network cables. These specifications include things like the maximum length of a cable, the width of the cable, the protection from electromagnetic interference, and even the flexibility.

Another area of hardware specifications are the physical connectors. This includes both the shape and size of the connectors as well as the pin count and layout, if appropriate.

Encoding and signaling

Encoding and signaling is a very important part of the physical layer. This process can get quite complicated. For example, let's look at Ethernet. Most people learn that signals are sent in '1's and '0's using a high voltage level and a low voltage level to represent the two states. While this is useful for some teaching purposes, it is not correct. Signals over Ethernet are sent using Manchester encoding. This means that '1's and '0's are transmitted as rises and falls in the signal. Let me explain.

If you were to send signals over a cable where a high voltage level represents a '1' and a low voltage signal represents a '0' the receiver would also need to know when to sample that signal. This is usually done with a separate clock signal being transmitted. This method is called a Non-return to Zero (NRZ) encoding, and has some serious drawbacks. First, if you do include a separate clock signal you are basically transmitting two signals and doubling the work. If you don't want to transmit the clock signal, you could include an internal clock in the receiver but this must be in near perfect synchronization with the transmitter clock. Let's assume you can synchronize the clocks, which becomes much harder as the transmission speed increases, there is still the problem of keeping this synchronization when there is a long stretch of the same bit being transmitted; it is the transitions which help synchronize the clocks.

The limitations of the NRZ encoding can be overcome by technology developed in the 1940s at the University of Manchester [link University of Manchester to http://www.manchester.ac.uk/], in Manchester, UK. Manchester encoding combines the clock signal with the data signal. While this does increase the bandwidth of the signal, it also makes the successful transmission of the data much easier and reliable.

A Manchester encoded signal, transmits data as a rising or falling edge. Which edge represents the '1' and which represents the '0' must be decided first, but both are considered Manchester encoded signals. Ethernet and IEEE standards use the rising edge as a logical '1'. The original Manchester encoding used the falling edge as a '1'.

One situation which you may be thinking about is that if you need to transmit two '1's in a row the signal will already be high when you need to transmit the second '1'. This isn't the case because the rising or falling edge which represents data is transmitted in the middle of the bit boundaries; the edge of the bit boundaries either contain a transition or do not, which puts the signal in the right position for the next bit to be transmitted. The end result is that at the center of every bit is a transition, the direction of the transition represents either a '1' or a '0' and the timing of the transition is the clock.

While there are many other encoding schemes, many of which are much more advanced than NRZ or Manchester encoding, the simplicity and reliability of Manchester encoding has kept it a valuable standard still widely in use.

Data transmission and reception

Whether the network medium is an electrical cable, an optical cable, or radio frequency, there needs to be equipment that physically transmits the signal. Likewise, there also needs to be equipment that receives the signal. In the case of a wireless network, this transmission and reception is done by highly designed antennas which transmit, or receive, signals at predefined frequencies with predefined bandwidths.

Optical transmission lines use equipment which can produce and receive pulses of light, the frequency of which is used to determine the logical value of the bit. Equipment such as amplifiers and repeaters, which are commonly employed in long-haul optical transmissions, are also included in the physical layer of the OSI reference model.

Topology and physical network design

The topology and design of your network is also included in the physical layer. Whether your network is a token ring [link token ring to http://en.wikipedia.org/wiki/Network_topology#Ring], star [link star to http://en.wikipedia.org/wiki/Network_topology#Star], mesh [link mesh to http://en.wikipedia.org/wiki/Network_topology#Mesh], or a hybrid topology [link hybrid topology to http://en.wikipedia.org/wiki/Network_topology#Hybrid_network_topologies], the decision of which topology to use was chosen with the physical layer in mind.

Also included in the physical layer is the layout of a high availability cluster, as described in my previous article titled High Assurance Strategies [link High Assurance Strategies to my previous article].

In general all you need to remember is that if a piece of hardware is not aware of the data being transmitted then it operates in the physical layer. In my next article I will discuss the Data link layer, what makes it different from it's adjacent layers and what hardware is included in it. As always, if you have any questions or comments on what I have written in this article feel free to send me an email.




OSI Reference Model: Layer 2 Hardware

A discussion of the second layer of the OSI reference model from a hardware perspective.

In my last article, I introduced the Open System Interconnect (OSI) reference model and discussed it's first layer; the Physical Layer. In this article I will discuss the second layer, the Data Link Layer, from a hardware perspective.

The data link layer provides functional and procedural methods of transferring data between two points. There are five general functions which the Data Link layer is responsible for. These functions are:

  • Logical Link Control
  • Media Access Control
  • Data Framing
  • Addressing
  • Error Detection

Logical Link Control

The Logical Link Control (LLC) is usually considered a sublayer of the Data Link layer (DLL), as opposed to a function of the DLL. This LLC sublayer is primarily concerned with multiplexing protocols to be sent over Media Access Control (MAC) sublayer. The LLC does this by splitting up the data to be sent into smaller frames and adding descriptive information to these frames, called headers.

Media Access Control

Like LLC, the Media Access Control (MAC) is considered a sublayer of the DLL, as opposed to a function of the DLL. Included in this sublayer is what is known as the MAC address. The MAC address provides this sublayer with a unique identifier so that each network access point can communicate with the network. The MAC sublayer is also responsible for the actual access to the network cable, or communication medium.

Data Framing

If one were to simply send data out onto the network medium not much would happen. The receiver has to know how, and when, to read the data. This can happen in a number of ways and is the sole purpose of framing. In general terms, framing organizes the data to be transferred and surrounds this data with descriptive information, called headers. What, and how much, information these headers contain is determined by the protocol used on the network, like Ethernet.

The structure of a frame adhering to the Ethernet protocol is shown below in Figure 1.

Figure 1: Structure of an Ethernet frame (Courtesy: Wikipedia)

Addressing

Addressing in layer 2 happens, as I mentioned earlier, with the MAC address of the MAC sublayer. It is very important not to confuse this with network or IP addressing. It can be helpful to associate the MAC address with a specific network access point and the network or IP address associated with an entire device (i.e. a computer, server, or router).

Speaking of routers, keep in mind that routers operate in layer 3, not layer 2. Switches and hubs do operate in layer two, and therefore direct data based on layer 2 addressing (MAC addresses) and are unaware of IP or network addressing. And, just so that I don't get an inbox filled with complaints ... yes I know... some routers also include layer 2 functionality. I will discuss routers with layer 2 functionality in another future article.

Error Detection and Handling

Whenever data is sent over any kind of transmission medium, there exists a chance that the data will not be received exactly as it was sent. This can be due to many factors including interference and, in the case of long transmissions, signal attenuation. So, how can a receiver know if the data received is error free? There are several methods that can be implemented to accomplish this. Some of these methods are simple and somewhat effective – others are complicated and very effective.

Parity bits are an example of an error detection protocol that is simple and, despite its limited effectiveness, its use is widespread. A parity bit, simply put, is an extra bit added to a message. There are two options for the value of this bit. Which value is chosen depends on the flavor of parity bit detection that is in use. These two flavors are even and odd parity detection. If even parity is in use, then the parity bit is set to the value ('1' or '0') to make the number of '1's in the message even. Likewise, if odd parity is in use the parity bit is set to the value needed to make the number of '1's in the message odd.

When using parity bit error detection the receiver will check all '1's in the frame, including the parity bit. The receiver will have a setting for even or odd parity; if the number of '1's in the frame does not match this setting, an error is detected. Now this is great, but as I mentioned earlier the effectiveness of this error detection method is limited. It is limited because if there is an even number of errors in the frame then the evenness or oddness of the number of '1's will be maintained and this method will fail to detect any errors – thus the need for a more rigorous error detection method.

A checksum error detection method can give us more rigor especially if used with a parity bit method. A checksum method, as its name suggests, will basically check the sum of all the '1's in a message and check that value against the checksum value added by the sender to the message. While a checksum method can provide more rigor to your error detection efforts, there are still limitations. For example, a simple checksum cannot detect an even number of errors which sum to zero, an insertion of bytes which sum to zero, or even the re-ordering of bytes in the message. While there are some more advanced implementations of the checksum method, including Fletcher's checksum method, I will discuss an even more rigorous method here.

One of the most rigorous methods of error detection is the cyclic redundancy check (CRC). What a CRC does is convert the message to a polynomial where the value of the coefficients correspond to the bits in the message and then divide that polynomial by a predetermined, or standard, polynomial called a key. The answer, more specifically the remainder part of the answer, is what is sent along with the message to the receiver. The receiver performs the same polynomial division with the same key and then checks the answer. If the answers match, then the chances are pretty good that there were no errors. I say pretty good because there are a lot of possible polynomials one could use for a key and not all polynomials provide equally good error detection. As a general rule, longer polynomials provide better error detection but the mathematics involved with this are quite complex and as with many aspects of technology there is some debate as to which implementations of this method provide the best error detection.

Lastly, I would like to point out that these error detection methods are not limited to transmissions of data over a network medium; they can be used equally well in a data storage scenario where one wants to check that the data has not been corrupted.

In my next article I will discuss layer 3 of the OSI model. I will also explain in a little more detail why routers (mostly) belong in the 3rd layer and not the 2nd. And as always, if you have any questions about this or any previous article, please do not hesitate to email me and I will do my best to answer any and all questions.



OSI Reference Model: Layer 3 Hardware

A discussion of the third layer of the OSI reference model, focusing mostly on routers and why they are usually placed in this layer.

In my last two articles I discussed the Open System Interconnect (OSI) reference model and its first two layers. In this article I will discuss the third layer; the network layer. The network layer is concerned with getting data from one computer to another. This is different from the data link layer (layer 2) because the data link layer is concerned with moving data from one device to another directly connected device. For example, the data link layer is responsible for getting data from the computer to the hub it is connected to, while the network layer is concerned with getting that same data all the way to another computer, possibly on the other side of the world.

The network layer moves data from one end point to another by implementing the following functions:

  • Addressing
  • Routing
  • Encapsulation
  • Fragmentation
  • Error handling
  • Congestion control

Addressing

Those who have read my previous article may be curious why layer 3 implements addressing when I also said that layer 2 implements addressing. To cure your curiosity, remember that I wrote that the layer 2 address (the MAC address) corresponds to a specific network access point as opposed to an address for an entire device like a computer. Something else to consider is that the layer 3 address is purely a logical address which is independent of any particular hardware; a MAC address is associated with particular hardware and hardware manufacturers.

An example of layer 3 addressing is the Internet Protocol (IP) addressing. An illustration of an IP address can be seen here in figure 1.

Figure 1: Illustration of an IP address (Source:Wikipedia.com)

Routing

It is the job of the network layer to move data from one point to its destination. To accomplish this, the network layer must be able to plan a route for the data to traverse. A combination of hardware and software routines accomplish this task known as routing. When a router receives a packet from a source it first needs to determine the destination address. It does this by removing the headers previously added by the data link layer and reading the address from the predetermined location within the packet as defined by the standard in use (for example, the IP standard).

Once the destination address is determined the router will check to see if the address is within its own network. If the address is within its own network the router will then send the packet down to the data link layer (conceptually speaking that is) which will add headers as I described in my previous article (link previous article to my OSI Layer 2 article) and will send the packet to its destination. If the address is not within the router's own network, the router will look up the address in a routing table. If the address is found within this routing table the router will read the corresponding destination network from the table and send the packet down to the data link layer and on to that destination network. If the address is not found in this routing table the packet will be sent for error handling. This is one source of errors which can be seen in data transmission across networks, and is an excellent example of why error checking and handling is required.

Encapsulation

When a router sends a packet down to the data link layer which then adds headers before transmitting the packet to its next point, this is an example of encapsulation for the data link layer.
Like the data link layer, the network layer is also responsible for encapsulating data it receives from the layer above it. In this case it would be from the data received from layer 4, the transport layer. Actually, every layer is responsible for encapsulating data it receives from the layer above it. Even the seventh and last layer, the application layer, because an application encapsulates data it receives from users.

Fragmentation

When the network layer sends data down to the data link layer it can sometimes run into trouble. That is, depending on what type of data link layer technology is in use the data may be too large. This requires the network layer have the ability to split the data up into smaller chunks which can each be sent to the data link layer in turn. This process is known as fragmentation.

Error handling

Error handling is an important aspect of the network layer. As I mentioned earlier, one source of errors is when routers do not find the destination address in their routing table. In that case, the router needs to generate a destination unreachable error. Another possible source of errors is the TTL (time to live) value of the packet. If the network layer determines that the TTL has reached a zero value, a time exceeded error is generated. Both the destination unreachable error and the time exceeded error messages conform to specific standards as defined in the Internet Control Message Protocol (ICMP).

Fragmentation can also cause errors. If the fragmentation process takes too long, the device can throw an ICMP time exceeded error.

Congestion control

Another responsibility of the network layer is congestion control. As I am sure you know, any given network device has an upper limit as to the amount of throughput the device can handle. This upper limit is always creeping upward but there are still times when there is just too much data for the device to handle. This is the motivation for congestion control.

There are many theories for how to best accomplish this, most of which are quite complicated and beyond the scope of this article. The basic idea of all of these methods is that you want to make the data senders compete for their messages to be the ones to get accepted into the throughput. The congested device wants to do this in a way that lowers the overall amount of data it is receiving. This can be accomplished by 'punishing' the senders which are sending the most data which causes the senders to 'slow' their sending activity to avoid the punishment and thereby reducing the amount of data seen by the congested device (which at this point is no longer congested).

Author's rant: The congestion control algorithms are quite complex for various reasons. Firstly, the mathematics involved is intense. So, for all of you who have ever wondered why people study mathematics in university and what job they could possibly get with that education.... this is an important one, and one that pays well with networking companies such as CISCO and Nortel. Secondly, after you have determined the proper mathematics to accomplish this task, how can it be implemented in a efficient and fast manner? This is the domain of engineers, who need to understand the mathematics, possible software implementation strategies, possible hardware implementation strategies, and design methodologies. Many people, including those who work in the tech industry, do not really understand what these, and other, professions bring to the table: they should. It is important.

In my next article I will discuss the fourth layer of the OSI reference model; the transport layer. Until then, as always, if you have any questions about this or any previous article please feel free to send me an email; I will do my best to answer any and all questions.


OSI Reference Model: Layer 4 Hardware

The previous articles in the series have discussed the first three layers of the OSI Reference Model. We will now discuss the fourth layer; the Transport layer.

The Transport layer provides the functionality to transfer data from one end point to another across a network. The Transport layer is responsible for flow control and error recovery. The upper layers of the OSI Reference Model see the Transport Layers as a reliable, network independent, end-to-end service. An end-to-end service within the transport layer is classified in one of five different levels of service; Transport Protocol (TP) class 0 through TP class 5.

TP class 0

TP class 0 is the most basic of the five classification levels. Services classified at this level perform segmentation and reassembly.

TP class 1

TP class 1 services perform all of the functions of those services classified at TP class 0 as well as error recovery. A service at this level will retransmit data units if they were not received by the intended recipient.

TP class 2

TP class 2 services perform all of the functions of those services classified at TP class 1 as well as multiplexing and demultiplexing, more on this below.
TP class 3

TP class 3 services perform all of the functions of those services classified at TP class 2 as well as sequencing of the data units to be sent.

TP class 4

TP class 4 services perform all of the functions of those services classified at TP class 3 as well as the ability to provide its services over either a connection oriented or connectionless network. This class of Transport Protocols is the most common and is very similar to the Transmission Control Protocol (TCP) of the Internet Protocol (IP) suite.
I say that TP class 4 is very similar to TCP because there are some key differences. TP class 4 uses 10 data types while TCP uses only one. This means that TCP is simpler but also means that it must contain many headers. TP class 4, while more complicated, can contain one quarter of the headers that TCP contains which obviously reduces a lot of overhead.

Connection oriented networks

Connection oriented networks are like your telephone. A connection is made before data is sent and is maintained throughout the entire process of sending data. With this type of network, routing information only needs to be sent while setting up the connection and not during data transmission. This reduces a lot of overhead which improves communication speed. This type of communication is also very good for applications, like voice or video communications, where the order of the data received is especially important.

Connectionless networks

Connectionless networks are the opposite of connection oriented networks, in that they do not set up a connection prior to sending data. Nor do they maintain any connection between two end points. This requires that routing information is sent with each packet, which therefore increases the communication overhead.
Keep in mind that just because data is being sent in packets does not mean that it is a connectionless network; virtual circuits are an example of a connection oriented network that use packets.
Since, in my previous articles, I have already covered aspects of error detection and recovery and since this article is focused on hardware I am going to give a basic introduction to a widely known (yet poorly understood) aspect of the Transport Layer; multiplexing and demultiplexing.

Multiplexing

Multiplexing (or muxing as it is often referred to) is one of those words that people often hear while not really understanding what it means. Many people may know that muxing is the process of combining two or more signals into one signal, but how exactly is that done? Well, there are multiple ways in which this can be done. Digital signals can be muxed in one of two ways, time-division multiplexing (TDM) and frequency division multiplexing (FDM). Optical signals use a method called wavelength-division multiplexing, although this is the same thing as FDM (wavelengths of course being inversely proportional to frequency).
To demonstrate how muxing works, let's take a simple case of TDM. In this example let's assume a two signal input. A two input muxing device will require three inputs; one for each of the signals and one for the control signal. A two input muxing device will also have one output. This device will alternate between the two input signals putting the resulting signal onto its output.

Figure 1: Logic gate schematic of a two input mux. Courtesy of www.cs.uiowa.edu Figure 1, above, shows a two input mux. The two signals are represented as d0 and d1 while the control signal is represented as c. The output, which is a function of the two inputs, is represented as f. The symbols in this figure are standard symbols for representing logic gates. Figure 2, shows the meaning of these three gates.

Figure 2: Basic logic gates. Courtesy of www.cs.uiowa.edu
The mux works by receiving a digital signal on the c input. This c signal goes directly to one input of the 1 'AND' gate, and to the 'NOT' gate. The 'NOT' gate inverts the signal and then sends it to one input of the 2 'AND' gate. The outputs of the 'AND' gates will only be high when the control signal and the input signal (d0 or d1) are high. Since the control signal is sent through a 'NOT' gate prior to reaching the 2 'AND' gate only one of the two 'AND' gates will see a high control signal at any one instant in time. This process means that f will alternate between being equal to d0 and then to d1 at the frequency of c.
Now you might be thinking "that's great, but who cares about getting half the signal". Well, that does not necessarily have to be the case. If the frequency of the control signal is at least twice the frequency of input signals, then the output f will contain enough information about both d0 and d1 that a demuxer will be able to reconstruct the original input signals. This is the core idea of the Nyquist-Shannon sampling theorem.
Looking at the logic gates in Figures 1 and 2 those of you with programming or scripting experience will recognize these logic functions as common tools in a programmer’s repertoire. Keep in mind that while these functions are found in software programs, I am strictly talking about hardware functions which are carried out with a series of transistors, acting as switches, arranges in clever ways to achieve these logic functions.

Demultiplexing

A demuxer is basically the opposite of a muxer. A demuxer will have one input signal, and in the case described above will have two output signals. A demuxer, of course, also has a control signal although with demuxers it is often called the addressing signals. This control signal is called an address signal because the demuxing circuit can also be used to simply choose which output pin to put the input signal on to.

In my next article I will discuss the fifth layer of the OSI Reference Model. Until then, and as always, if you have any questions about this or any other article of mine, do not hesitate to send me an email; I will do my best to get back to you.



Comment Box is loading comments...