Aoraki Digital Technologies/Level 2/DT 2.50 AS91377/Networking Theory and Protocols

Introduction
In this section we are going to learn about some of the theory behind how computers communicate across a network. In particular, the topics we will cover are:


 * The OSI model of computer networking
 * How TCP/IP is used to ensure a network message is resilient to faults in transmission
 * UDP
 * Bandwidth requirements of a network
 * Ethernet Access Control
 * CSMA/CD

The OSI Model
The Open Systems Interconnection model (OSI model) is a method of thinking of computer networking in terms of Abstraction layers. Different communication technologies with similar functions are grouped into different logical layers on the OSI Model. Each layer of the OSI Model makes use of functions provided by the layers below it and provides functions that are used layers above.

Description of OSI layers
According to the standard OSI Model there are seven layers. Each layer is dependant upon the layers below it to function.

Some aspects of computer networking, such as management and security, use or are used on every layer.

Layer 1: physical layer
The physical layer refers to Electrical and physical aspects of devices. In particular, it specifies how a device sends and receives information, such as using copper wires or fiber-optic cables. Examples of this include Ethernet or Fiber optic cables, phone cords used for dial-up or DSL services, the Coaxial cable used to provide Broadband internet, the wires used to connect various components of a computer or even the radio signals used in Wireless comunication. Other functions of the physical layer include the conversion of signals into something that another layer can use (refered to as a Bit, and adjusting the signal to allow for multipul users to use the same connection.

Layer 2: data link layer
The Data Layer mainly is the method in which information from the network is broken down into Data_frames and trasmited over the physical layer. This layer is also responsable for some Error detection and correction and some addressing so different devices can tell each other apart in larger systems.

Layer 3: network layer
The Routing Layer performs Routing Protocols to ensure that large files are transfered. In other words, while the data link layer deals with the method in which the physical layer is used to tranfer data, the network layer deal with organizing that data for transfer. This layer also handles aspects of [routing|Routing Protocols], passing the information from one network to the next to ensure delivery of the data.

Layer 4: transport layer
The Transport Layer is the level at which system relability and quality are ensured. This layer manages traffic flow through the network layer to reduce congestion on a network, and performs error checking ensuring quality of service by resending data when data has been corrupted. Some of the most popular methods of Encryption and Firewall security occure on this layer.

Layer 5: session layer
The Session layer uses the stable communication system created by the trasport layer to create and control coversations (or sessions) between two computers. Computer sessions consist of a series of requests and responses that are used by higher layers to manage communication between different systems. This allows for such things as password validation, and video streaming.

Layer 6: presentation layer
The Presentation Layer is where the human readable programming languages are translated into machine code instructions used by the lower layers. At this level it is often hard to distinguish this level from the Application Layer. In general terms, this layer works by taking care of the directions given by the user at the aplication layer.

Layer 7: application layer
This is the level that the user often interacts with. This is where data turns into websites, chat programs and so on. Many protocols run at this layer, such as FTP, SMTP, DNS, POP3, NFS, HTTP.

Using the OSI model to troubleshoot problems on a network
The OSI model is used by network administrators worldwide to troubleshoot problems on networks, large and small. Here is how: The OSI model describes how computers connect to each other in terms of physical cables, protocols and software. By working your way through the model from checking cables through to checking sodtware, a network administrator will have checked, systemmatically and efficiently any possible source of network error. A very good description of how this is done is given at http://www.petri.co.il/csc_how_to_use_the_osi_model_to_troubleshoot_networks.htm and http://www.geekstogo.com/forum/topic/254154-troubleshooting-networks-using-the-osi-model/.

The TCP/IP Model
The TCP/IP model describes how packets of data are transmitted across a network, a brief description is here: http://en.wikibooks.org/wiki/A-level_Computing/AQA/Computer_Components,_The_Stored_Program_Concept_and_the_Internet/Structure_of_the_Internet/TCP/IP_protocol_stack#TCP.2FIP_stack

ICMP
The Internet Control Message Protocol (ICMP) is one of the core protocols of the Internet Protocol Suite. It is chiefly used by the operating systems of networked computers to send error messages indicating, for example, that a requested service is not available or that a host or router could not be reached.


 * ICMP differs from transport protocols such as TCP and UDP in that it is not typically used to exchange data between systems, nor is it regularly employed by end-user network applications (with the exception of some diagnostic tools like ping andtraceroute).
 * ICMP for Internet Protocol version 4 (IPv4) is also known as ICMPv4. IPv6 has a similar protocol, ICMPv6.
 * ICMP is in the network layer of the OSI model

What is Bandwidth?
We all use the term 'bandwidth' but few of us really knows what it means. In simple terms, bandwidth is a measure of how many bits per second can be transmitted across a network connection. Note that it is bits and not bytes! (Remember that 8 bits = 1byte)

The wikipedia article on bandwidth gives an indication of the typical available bandwidth for various networks - a LAN is typically 1 GBit/sec. The bandwidth required by some common applications/uses of LANs are shown below The bandwidth requirements of various applications are listed in the table below. The rates are shown in bits/sec (bits per second), Kbits/sec (thousands of bits per second), Mbits/sec (millions of bits per second), and Gbits/sec (billions of bits per second). Compression and other techniques can reduce these requirements.

Bandwidth Required By Some Common Applications
The bandwidth of various networks devices is shown in the table below. Remember that a typical modern LAN network runs at 1Gbit/sec.

Bandwidth Capibilities of Some Common Network Types
This table shows the maximum bandwidth (the physical layer Net bitrate) of common Internet access technologies. For a more detailed list see List of device bandwidths, bit rate progress trends and list of bit rates in multimedia.

(Taken from https://en.wikipedia.org/wiki/Bandwidth_(computing))

Calculating Bandwidth Requirements
The two tables above can be used to calculate the practical applications that can run over a particular network.


 * For example, a network is designed to run at 1 Gbit/sec - all the computers, cables and routers can run at this speed.
 * Using the calculator at http://www.ibeast.com/content/tools/band-calc.asp, 1 Gbit/sec is 1000000000 bits/sec
 * Compressed video requires at least 2 Mbit/sec - which is 2000000 bits/sec
 * So 1000000000 divided by 2000000 is 500
 * This means that the network has the capacity to simulataneously run 500 computers using the compressed video
 * In practice you might allow some other bandwidth for other applications.

Preventing Collisions on the Network
Networks have bits travelling at high speed, often along cables. At some point or other, two packets of information are likely to collide. This section describes what happens when packets collide and how future collisions are prevented.

Another explanation of CSMA/CD plus an animation of it is available at http://www.datacottage.com/nch/eoperation.htm



Carrier sense multiple access with collision detection (CSMA/CD) is a Media Access Control method in which:


 * a carrier sensing scheme is used.
 * a transmitting Data station that detects another signal while transmitting a frame, stops transmitting that frame, transmits a jam signal, and then waits for a random time interval before trying to resend the frame.

CSMA/CD is a modification of pure Carrier sense multiple access (CSMA). CSMA/CD is used to improve CSMA performance by terminating transmission as soon as a collision is detected, thus shortening the time required before a retry can be attempted.

Algorithm
When a station or device or node wants to send some information, it uses the following algorithm:

Main procedure

 * 1) Is my frame ready for transmission? If yes, it goes on to the next point.
 * 2) Is medium idle? If not, wait until it becomes ready
 * 3) Start transmitting.
 * 4) Did a collision occur? If so, go to collision detected procedure.
 * 5) Reset retransmission counters and end frame transmission.

Collision detected procedure

 * 1) Continue transmission until minimum packet time is reached to ensure that all receivers detect the collision.
 * 2) Increment retransmission counter.
 * 3) Was the maximum number of transmission attempts reached? If so, abort transmission.
 * 4) Calculate and wait random backoff period based on number of collisions.
 * 5) Re-enter main procedure at stage 1.

This can be likened to what happens at a dinner party, where all the guests talk to each other through a common medium (the air). Before speaking, each guest politely waits for the current speaker to finish. If two guests start speaking at the same time, both stop and wait for short, random periods of time (in Ethernet, this time is measured in microseconds). The hope is that by each choosing a random period of time, both guests will not choose the same time to try to speak again, thus avoiding another collision.

Methods for collision detection are media dependent, but on an electrical bus such as 10BASE-5 or 10BASE-2, collisions can be detected by comparing transmitted data with received data or by recognizing a higher than normal signal amplitude on the bus.

Jam signal
The jam signal is a signal that carries a 32-bit binary pattern sent by a data station to inform the other stations that they must not transmit.

The maximum jam-time is calculated as follows: The maximum allowed diameter of an Ethernet installation is limited to 232 bits. This makes a round-trip-time of 464 bits. As the slot time in Ethernet is 512 bits, the difference between slot time and round-trip-time is 48 bits (6 bytes), which is the maximum "jam-time".

This in turn means: A station noting a collision has occurred is sending a 4 to 6 byte long pattern composed of 16 1-0 bit combinations. Note: The size of this jam signal is clearly beyond the minimum allowed frame-size of 64 bytes.

The purpose of this is to ensure that any other node which may currently be receiving a frame will receive the jam signal in place of the correct 32-bit MAC CRC, this causes the other receivers to discard the frame due to a CRC error.

Applications
CSMA/CD was used in now obsolete shared media Ethernet variants (10BASE5, 10BASE2) and in the early versions of Twisted-pair Ethernet which used Repeater hubs. Modern Ethernet networks built with switches and Full-duplex connections no longer utilize CSMA/CD though it is still supported for backwards compatibility. IEEE Std 802.3, which defines all Ethernet variants, for historical reasons still bears the title "Carrier sense multiple access with collision detection (CSMA/CD) access method and physical layer specifications".

Variations of the concept are used in Radio frequency systems that rely on Frequency sharing, including Automatic Packet Reporting System.