19 Eylül 2014 Cuma

Introduction to OSI model

OSI Layers
The 7 layer model is used to allow multi vendor networking devices and releases to cooperate and developers to use a layered approach to plan and approach how applications will interact.

In the 1970's the Open Systems Interconnection or IBM solution was release to break the barrier between companies and organisations - on a software and hardware level.
The model was created to break the barrier between vendors to create interoperable network devices. The model describes how data moves from the application onto the network. All of the processes required to communicate are set as a blueprint.

Todd Lammel sets this out in an easy to understand way. Think of a company. A large company right through to a small company each has layers that must work together to perform an operation. Sales, HR, Shipping all work together to allow a company to perform numerous operations . If one fails the rest go down.
For example the company isn't doing so well - so they hire a new Sales consultant. HR pick the wrong one, research creates a bad product, more of finances money needs to go into sales, marketing needs to work twice as hard...well it goes on. Its a simple rippled effect but you get the idea.

Each layer therefore needs to work together to allow the lower layers and upper layers to complete their task.

So what are the layers?

7. Application
6. Presentation
5. Session
4. Transport
3. Network
2. Data Link
1. Physical

The upper layers (7-5) work to provide an interface to the users, handles and formats data and keeps application data separate.
The lower layers 4-1 then allow the data to be reliably transmitted and error checked. They will then create logical addressing to allow data to be correctly routed and then converting the packets into acceptable transmission types to then be physically sent over the link.
Once received it will then move from the bottom layers (1-4) to the upper layers (5-7). Data therefore moves form the upper to the lower across the media to the lower levels of the receiving devices to then move to the upper layers again to be presented.

Each layer in the OSI model provides specific functions:

7. Application - File, Print, Message, Database, and Application services
6. Presentation - Data Encryption, Compressions and Translation
5. Session - Dialog control and session establishment
4. Transport - End to End connection
3. Network - Routing
2. Data Link - Framing
1. Physical - Physical connections and topology

7 - Application Layer

The application layer is the first layer to be presented. It allows the user to communicate with the other lower layers of the model to allow data transmission.
Now the first thing you must understand is the in most cases the application itself is not a layer 7 item..
For example - take an internet browser. You can send data across the network using it but it is not a layer 7 device. If you uninstall networking properties and services the program will still allow you to look and view local HTML files.
However if you try and communicate accross the network - your data will never make it.

Without the entry to the OSI model data cannot be transmitted and established on the network.
However protocols such as FTP or TFTP are layer 7 protocols as they establish a method of communicating with the lower levels.

The Application layer - is responsible for identifying and establishing the availability of the intended communication partner and determining whether sufficient resources for the communication exists.
This layer acts as the interface for the user, levels and protocols.

6 - Presentation Layer
The presenation layer - suprisingly - presents data to the network. It is responsible for translating data and formatting The layer provides coding and conversions functions to allow data to move from the upper layers to the lower layers.
Without this data cannot be presented and understood by the other layers. Failures here will mean data cannot be used to determine paths and session leaving it unable to move over the network.

Computers receive and send formatted data and convert it into a language understood by itself. By translating data the presentation layer can be sure that data can be understood by the receiving end.
Data compression, decompression, encryption and decryption are associated with the presentation layer.

5 - Session Layer
The session layer has a simple action to perform. It allows numerous presentation sessions to be separated and to remain separate. The session layer sets up these sessions, manages them and them tears them down when no longer active.
The session layer makes use of different modes - half duplex, full duplex or simplex. The layer provides dialogue between devices or nodes.
Basically put - the layer keeps different applications data separate.
There is more but at this level - you don't really need it.

4 - Transport
The transport layer segments data into numerous data streams resembling them on the other side. This provides end to end transport services and allows a logical session to be created when hosts connect.
At this layer we see 2 very common connection protocols: TCP and UDP. Notice that's a connection protocol NOT a routing protocol.

TCP is a connection orientated protocol. This means that for every connection and set number of packets sent the receiving host must acknowledge the sending host. This connection orientated method allows more reliable but slower communication across the network - although as devices become much faster these time differences are quickly decreasing.
TCP uses a number of services such as Flow control, CSMA/CD and Windowing to make sure that frames arrive when they should in the correct order.

Although not openly a topic within the OSI model its a nice time to go into it all.

Flow Control
Flow control allows for data integrity over the medium. TCP uses flow control to make sure that any packets sent are acknowledged and the they have not been lost/dropped in the process. It also makes sure that any data sent isn't going to cause issues on the receiving hosts end especially where buffering is concerned.

When segments arrive at the receiving host they are acknowledged. This is the key concept. This maintained and established with a three way handshake. The host will communicate with each other to make sure that the connection is active and that packets are going to arrive when and where they are specified.
This three way handshake is a critical part of the Transport layer process and is called the virtual circuit. Throught commubnication the 2 hosts will check with each other to make sure the connection is still active and that the sender or reciever has not lost contact.

In the handshake there are 3 parts. Initially there is a connection agreement where the hosts will request synchronization. The second segment will then be used to negotiate the link and acknowledge the requests to establish connection parameters/rules between the hosts.
The third segment will then acknowledge the connection and parameters.

By using flow control the receiving host makes use of 2 district states - Not ready and Go/Ready states. When communication occurs the speed of processing and the link can cause packets to queue. Although devices have a buffer i.e memory to store packets not yet processed this is limited. When this is full packets can be queued and lost. However in a connection orientated flow controlled state these packets are simply stopped.

The device once busy and full will send out a Not Ready message to the sending host. This basically means stop for a moment and let me finish what I am doing. Once complete the device send a Go packet and the sending host will check the link and begin sending once again.

The datagrams are received in the same sequence they are sent and the transmission will fail if this order is broken. To get around the problem of missing packets the host can acknowledge each packet that is sent.
The connection orientated service states the following characteristics:
  • A three way connection (virtual circuit) is established
  • Frames are sequenced
  • Acknowledgements are used
  • Flow control is established
Windowing and Acknowledgements come hand in hand. I realise this is getting pretty long so time to cut it down a bit.
Windowing is a method to set how many packets are sent before the host must send acknowledgments. Thats is. In a Window size of 4 the sender will send 4 packets before waiting for a response. If the host acknowledges the 5th packet (no thats not a typo) then connection resumes. Lets look at that again:

---> Send Segment 1 --->
---> Sned Segment 2 --->
Host 1 (Sender) ---> Send Segment 3 ---> Host 2 (Reciever)
---> Send Segment 4 --->
<--- Ack. Segment 5 ---

So the host will recieve the segments 1-4. Now its ready for 5. It isn't going to say ok I've got 4...because that could mean it didn't get 2 and 3. So instead it says simply I'm ready for 5 (acknowledge 5). If the host had a Window size of 3 then it would recieve segments 1,2 and 3..and acknowlege its ready for 4.

but what is a segment is missed?
Well the recieving host will acknowledge the missed segment...confisuing isn't it? Or maybe not!
So look at the below:

---> Send Segment 1 --->
---> Sned Segment 2 --->
Host 1 (Sender) ---> Send Segment 3 ERROR --\ Host 2 (Reciever)
---> Send Segment 4 --->
<--- Ack. Segment 3 ---
---> Send Segment 3 --->
<--- Ack Segment 5 --->

You see. Segment 3 was missed breaking the chain. Host 2 then realises the problem and acknowledges it - basically saying "Hey host 1 - something has messed up. I am going to admit (acknowledge) segment 3 was lost - please send it again". And there we have it. Segment 3 is send and then the host 2 will acknowledge that it has all the segments it needs and tells host 1 its ready for 5.

Hopefully that isn't to bad. You may initially fight it as I did at first - thinking well why not acknowledge you got the last frame?? but then you just accept it....

3 - Network Layer
Ok transport was big huh! It gets a little simpler now.
The Network layer is classed as Layer 3. Layer 3 works to find routes to networks. Packets passed around the network are recieved on the router/layer 3 switches interface. These packets are read finding the destination address of the network to which the network is being passed. Now there is a key point here. Layer 3 devices are concerned with the Networks - not the destination device. This is saved for the layer 2 devices.

Layer 3 devices use 2 main types of packets - Data Packets which transport data through networks and Route Packets which send routing information and updates to other layer 3 devices.
This layer concerns itself with routing information building routing tables to destination networks through routing protocols such as RIP or EIGRP etc.
This layer concerns more with the actual devices and due to the length I'm going to go into this layer in more detail in another post.

2 - Data Link Layer
The data link layer provides physical transmission of data through the network. This layers main jobs include Physical transmission of data, data error handling and notifications, network topology, and flow control.
This layer provides many of the main functions required to get data to its destination.
This layer formats the message into pieces called data frames. By working with data frames the physical layer provides further addressing to take it from the network layer network boundry to the actual device.

The unique identification of devices falls to Layer 2 using Logical Link Control (LLC) or Media Access Control (MAC).
MAC addressing is concerned with how packets are placed on the media. Using contention access - i.e first come first served access data is places on the media on a first come first served basis. Physical addressing is defined here as well as the logical topology to the devices and networks. The local topology defines how the signal path is generated to get from point A (the source) to point B (the destination)

LLC or Logical Link Control is used to determine the Network Layer Protocols being used by the packet. when a packet is recieved it is analysed to find where the packet is destined. eg IP at the network layer.
Switches are devices which run at layer 2 - these use mac addressessing to find devices. This is hardware based using ASIC as apposed to softaware based like a router which ses routing tables to determine routes.

1 - Physical Layer
Ok these last few layers are shorter as I am going to go into them in more depth later on.
The physical layer is a simple one - it converts the data frames to bits that are sent along the physical medium. By doing this you get from one device to another and complete the phyiscal routing of data.
The physical layer specifies the trasmission of data using 1s and 0s. This lays out the connection and specifies the electrical, mechanical, procedural and functional requirements for activating, maintaining and deactiviting a link.

Interfaces such as the DTE and DCE are determined here along with the end to end connectivity. Hubs work on this level as they provide the most simple form of connectivity - on that is exteremly rare in modern networks.

Once the data has moved down the 7 layers and is transmitted along the physical medium is arrives at the physical layer of the recieving host. It will not pass up the layers transerring from bits to frames through to packets and into the correct sessions.
From here it reaches the application without the users being any wiser about what has happened. 



Networking Essentials

Hiç yorum yok:

Yorum Gönder