Показаны сообщения с ярлыком OSI. Показать все сообщения
Показаны сообщения с ярлыком OSI. Показать все сообщения

пятница, 16 июля 2010 г.

OSI 7 layers model

OSI 7 layers model

Автор - Владислав Спектор
2009
OSI 7 layers model – создана организацией ISO в 1984 году (обратите внимание на инверсию слов ISO - OSI).
Формальное определение OSI: многоуровневое абстрактное представление и объяснение коммуникаций и дизайна протоколов компьютерных сетей.
Уровень (Layer) – это набор функций, которые обеспечивают сервисы вышележащему уровню и получают услуги от нижележащего уровня.
Сетевой протокол (Network protocol) — набор правил, позволяющий осуществлять соединение и обмен данными между двумя и более включёнными в сеть устройствами.
Для чего нужна модель OSI?
OSI – прекрасный способ изучения сетевой архитектуры. В любой области для решения сложной задачи ее раскладывают на составные элементы, которые поддаются решению. Сети и набор протоколов связи довольно сложны и разложение на уровни очень облегчает задачу объяснения и понимания проблемы.
Уровни также дают возможность создавать совместимые по интерфейсам (стандартным способам взаимодействия) и, в то же время, независимые протоколы, т.к. скрывают (наподобие черного ящика) технологии каждого уровня.
Как результат, производители протоколов и оборудования (сетевых карт, роутеров, свитчей и т.д.) получают возможность вместо одного протокола внедрить другой, более эффективный, не меняя при этом протоколы других уровней.
Например, на втором уровне вместо Ethernet можно использовать Token Ring или Frame Relay, а программы или вышележащие протоколы не будут об этом догадываться и продолжат работать как обычно.
Или, на физическом уровне, вместо медного кабеля можно использовать оптику или Wireless, а другие протоколы и программы не будут иметь об этом понятия.
В результате получается такой конструктор из слоев, где каждый слой-уровень можно заменять другими "деталями" без вреда для всей конструкции.
Пример из жизни: если у "Мерседеса" меняют коробку передач, не обязательно менять мотор или корпус, достаточно чтобы интерфейс между коробкой и другими "слоями" оставался тем же.
И, кстати, об интерфейсах: руль и педали – это пример интерфейса (стандартного способа взаимодействия) между человеком и машиной.
Вообщем, как всегда выигрывает стандартизация и взаимозаменяемость.
Ну, а поскольку сети рождены для соединения различного оборудования, средств передачи (media), протоколов, то стандартизация здесь важнее, чем во многих других областях.

А теперь настало время познакомиться непосредственно с самой моделью OSI. Кстати, она родилась в качестве теоретической и только потом были осуществлены попытки (не слишком удачные) внедрения ее в практику.
Рисунок
OSI 7 Layers Model
L7. APPLICATION L7. APPLICATION
L6. PRESENTATION L6. PRESENTATION
L5. SESSION L5. SESSION
L4. TRANSPORT L4. TRANSPORT
L3. NETWORK L3. NETWORK
L2. DATA LINK L2. DATA LINK
L1. PHYSICAL L1. PHYSICAL
>>>===========================>>>
На рисунке схематически изображены уровни модели OSI, которых насчитывается 7.
Стандартный случай взаимодействия двух сетевых сущностей (компьютеров, роутеров и т.д.) таков: два хоста (компьютера, роутера и т.д.) заинтересованы создать логические коммуникации по горизонтали, т.е. между собой, с целью предачи информации.
С другой стороны, реальное взаимодействие происходит по вертикали, когда информация передается от какой-либо аппликации вниз по всем уровням (вертикально) и лишь затем транспортируется на другой хост (горизонтальное взаимодействие на уровне ниже первого).
Итак, по горизонтали мы имеем логические, виртуальные коммуникации при помощи протоколов, по вертикали – реальные, через связующие интерфейсы (для программистов замечу - API интерфейсы).

Теперь сравним дата-коммуникации с работой почты.
Представим себе писателя, который пишет роман и хочет передать его редактору для отзыва и правки (редактирования).

Рисунок
Layer7. APPLICATION - Писатель отдает роман секретарше
Layer6. PRESENTATION
Layer5. SESSION
Layer4. TRANSPORT - Секретарша делит роман на листы-сегменты
Layer3. NETWORK - Секретарша надписывает адрес
Layer2. DATA LINK - Секретарша бросает конверт в почтовый ящик
Layer1. PHYSICAL - Почта из почтового ящика передается почтальону
Layer0. Почтальон доставляет почту ====>>
Далее следует объяснение представленного рисунка.
Layers 7-6-5. Писатель (все три верхних уровня аппликаций) передает роман секретарше.
Layer 4. Секретарша (транспортный уровень) разделяет его на отдельные листы, вкладывает их в конверты, нумерует и надписывает имя адресата (при помощи протокола TCP поток данных разделяется на сегменты, каждый из которых получает последовательный номер, а также номер порта).
Layer 3. Следующая секретарша (сетевой уровень) надписывает адрес (протокол IP добавляет IP адрес в заголовок пакета).
Layer 2. Еще одна секретарша (уровень Data-Link) берет конверт и бросает его в почтовый ящик (передает фрейм сетевой карте). Кроме того в заголовок фрейма добавляется MAC-адрес ближайшего роутера (обычно в свойствах TCP/IP он называется Default Gateway), хотя реальный почтальон и сам знает, где находится ближайшее почтовое отделение.
На этом уровне взаимодействуют драйвер и сетевая карта.
Layer 1. Почта из почтового ящика (сетевой карты на физическом уровне) передается почтальону (средству передачи, например медному кабелю), который на велосипеде доставляет ее в почтовое отделение (сетевые импульсы от сетевой карты по кабелям локальной сети или другими средствами приходят на Default Gateway), которое распределяет все приходящие конверты-пакеты по месту назначения (роутинг) и перегружает их на соответствующий транспорт, движущийся в нужном направлении: машину, корабль, самолет, (медный или оптический кабель локальной сети, сериальный интерфейс глобальной сети, инфракрасное или микроволновое излучение, радио-излучение со спутников и т.д.).
В итоге роман прибывает в место назначения (другой хост) разными способами и путями.
Затем наш роман претерпевает обратный процесс подъема по коммуникативным уровням на другом хосте и, в итоге, попадает на стол редактору (или в нужную аппликацию). Обратите внимание, что писателя и редактора (уровень аппликаций) интересует только взаимодействие между собой (горизонтальное), хотя по техническим причинам им приходится пользоваться услугами помощников - нижележащих уровней (т.е. вертикальными взаимодействиями).
Кстати, сами компьютерные аппликации (Word, Internet Explorer и т.д.) находятся выше уровня аппликаций (L7), а передача по проводам или другим средствам коммуникаций, ниже физического уровня (L1).
Некоторые считают, правда, что средства коммуникаций находятся непосредственно на первом уровне, но мы будем придерживаться мнения таких авторитетов, как Эндрю Таненбаум, создатель системы MINIX (свободная Unix-подобная операционная система для студенческих лабораторий) и знаменитой книги по компьютерным сетям, которая стала фактическим стандартом в данной области.
В дальнейшем мы рассмотрим, что происходит на пути следования, но уже сейчас можно заметить, что информация периодически поднимается до 3-го уровня, и лишь в конце, на целевом хосте, она восходит на самый верх к своей цели. Обычно таковой является какая-либо программа.
Также, в дальнейшем, мы подробно разберем, что же происходит между 2-мя хостами, когда кто-либо пишет в адресной строке своего Internet Explorer: http://www.google.com

Правильный и полный ответ на этот вопрос является признаком хорошего осознавания сетевых процессов и определенного профессионализма.
Но, вернемся к нашим баранам :).
Модель OSI не является единственной моделью сетевых взаимодействий.
Из других, самая известная – модель TCP/IP.
Она отличается тем, что была создана на практике до создания теоретических обоснований. Как результат, она гораздо эффективнее в реальной практике, чем модель OSI и является сегодня стандартом De Facto.
Нужно сразу отметить, что TCP/IP - это и модель и набор действующих протоколов. Причем количество протоколов не два, как можно было бы предположить по названию, а гораздо больше.
В TCP/IP некоторые протоколы занимают сразу несколько уровней в нарушение строгих правил OSI, где каждому протоколу соответствует свой определенный уровень, который выполняет только ему отведенные функции.
В модели TCP/IP существует всего 4 уровня: группы 3-х верхних аппликативных и 2-х нижних модели OSI слиты каждая в единственный уровень модели TCP/IP, что уменьшает количество уровней и ускоряет процессы вертикальных коммуникации. Излишняя подробность OSI уменьшает реальную производительность, т.к. каждое взаимодействие между уровнями занимает время. Кроме того в OSI функции коррекции ошибок дублируются на 2 и 4 уровнях, что также отнимает время.
В то же время разбивка по слоям нужна и, даже, необходима. Можно, конечно, вообразить некий единый протокол, который будет простираться на все 7 уровней OSI. За счет отсутствия вертикальных взаимодействий между разными протоколами он будет, конечно, очень быстрым и никогда не возникнет проблем совместимости протоколов. Но это будет, так сказать, "одноразовый" протокол, т.е. им сможет воспользоваться лишь одна какая-то специфическая программа. В принципе, каждая программа, нуждающаяся в сетевых взаимодействиях, могла бы иметь свой собственный специализированный протокол. Как и каждый специализированный аппарат или программа, такой протокол мог бы быть чрезвычайно эффективным также и потому, что был бы совершенно лишен лишних универсальных функций, ведь универсальность добавляется, так сказать, "на всякий случай". Это напоминает эффективность DOS-овских игр, каждая из которых имела прямой доступ к железу компьютера и собственные драйверы (аналог протоколов). Эти игры работали очень быстро даже на слабом железе. Но мир почему-то все же отказался от такой эффективности в пользу универсальности. Уж очень она удобна и невероятно добавляет гибкости, а эффективность достигается другими способами, да и не во всех случаях эффективность стоит во главе угла, хотя и всегда принимается во внимание.
Существует также удобная 5-уровневая модель, которая является компромиссом между OSI и TCP/IP.
По аналогии с TCP/IP, три верхних уровня слиты в один - аппликативный, но 2 нижних (Phisycal и DataLink) разделены между собой так же, как и в модели OSI.

Добавoчные замечания

Интерфейс, протокол, драйвер, интерфейсная карта – важные понятия, которые существуют не только в сетях, но и в случае связи компьютера с периферийными устройствами.

Прозрачность Switches: на L1 все уст-ва прозрачны, на L2 SW прозрачны для комп., но комп. Видны свитчам, на L3 все видят друг друга.

На L2 действуют сетевая карта и ее сетевой драйвер.

MAC жестко хранится в NIC, а IP хранится в OS, поэтому MAC никогда не изменяется, а IP может изменяться каждый раз, например при помощи DHCP.

Routers – имеют CPU, который производит всю работу, а современные Switches имеют ASIC на каждом порту. Поэтому свитчи очень быстры.

ARP broadcasts запрашивают адреса IP, а NIC отвечающей стороны их не знает, поэтому ARP broadcasts поднимаются на уровень протокола IP и, соответственно, нагружают OS и CPU. В больших сетях, не разделенных роутерами или VLAN-ами, broadcasts способны значительно загрузить CPU всех комп. сети.

Роутеры также производят свитчинг (в общем понимании этого термина). Такой свитчинг 3-го уровня или Packet Switching называют Routing. Кроме Packet Switching существует Circuit (Channel) Switching.

Switching 2-го уровня производят свитчи и он называется Frame Switching. Это более знакомый нам вид свитчинга.

CSMA/CD нужен в случае Shared Media, коаксиальный кабель иначе работать не может. TS (twisted pair) дает принципиальную возможность отказаться от Shared Media и CSMA/CD за счет внедрения Switches.

Functions & Components of LAN

Exploring the Functions of Networking

(Compiled by Vladislav Spector)

clip_image002[5]

What is a LAN

A local area network is a computer network covering a small geographic area, like a home, office, or group of buildings e.g. a school.

The defining characteristics of LANs, in contrast to Wide Area Networks (WANs), include their much higher data transfer rates, smaller geographic range, and lack of a need for leased telecommunication lines.

History of LAN

The first LAN put into service occurred in 1964 at the Livermore Laboratory to support atomic weapons research. LANs spread to the public sector in the late 1970s and were used to create high-speed links between several large central computers at one site. Of many competing systems created at this time, Ethernet and ARCNET were the most popular.

Initially, LANs were limited to a range of 185 meters or 600 feet and could not include more than 30 computers. Today, a LAN could connect a max of 1024 computers at a max distance of 900 meters or 2700 feet.

Functions of a LAN

· Data and applications

· Resources (file sharing, print sharing)

· Network storage

· Backup devices

· Communication path to other networks


Network User Applications

· E-mail (Microsoft Outlook, Yahoo, GMail and so on)

· Web browser (IE, Firefox, and so on)

· Instant messaging (Skype, Microsoft Messenger, and so on)

· Collaboration (Whiteboard, Netmeeting, WebEx, and so on)

· Databases

LAN Components

§ Computers, PCs, Servers

§ Interconnections: NICs, Media

§ Network devices: Hubs, Switches, Routers

§ Protocols: LAN, Network

Network card

A network card, network adapter, LAN Adapter or NIC (network interface card) is a piece of computer hardware designed to allow computers to communicate over a computer network.

It is both an OSI layer 1 (physical layer) and layer 2 (data link layer) device, as it provides physical access to a networking medium and provides a low-level addressing system through the use of MAC addresses.

Network hub

A network hub or concentrator is a device for connecting multiple twisted pair or fiber optic Ethernet devices together, making them act as a single network segment.

Network switch

A network switch is a computer networking device that connects network segments.

Low-end network switches appear nearly identical to network hubs, but a switch contains more "intelligence" than a network hub. Network switches are capable of inspecting data packets as they are received, determining the source and destination device of that packet, and forwarding it appropriately.


Router

A router is a computer whose software and hardware are usually tailored to the tasks of routing and forwarding, generally containing a specialized operating system (e.g. Cisco's IOS).

Network Topology

Network topology is the study of the arrangement or mapping of the elements (links, nodes, etc.) of a network, especially the physical (real) and logical (virtual) interconnections between nodes

clip_image004[5]

Physical Topology Categories

· Bus Topology - All devices receive the signal.

· Star Topology - Transmission through a central point, Single point of failure.

· Ring Topology - Signals travel around ring, Single point of failure.

· Full-Mesh Topology - Highly fault-tolerant, Expensive to implement.

· Partial-Mesh Topology - Trade-off between fault tolerance and cost.


Summary of Network

§ A network is a connected collection of devices that can communicate with each other. Networks carry data in many kinds of environments, including homes, small businesses, and large enterprises.

§ There are four major categories of physical components in a computer network: the computer, interconnections, switches, and routers.

§ The major resources that are shared in a computer network include data and applications, peripherals, storage devices, and backup devices.

§ The most common network user applications include e-mail, web browsers, instant messaging, collaboration, and databases.

§ User applications affect the network by consuming network resources.

§ The ways in which networks can be described include characteristics that address network performance and structure: speed, cost, security, availability, scalability, reliability, and topology.

§ A physical topology describes the layout for wiring the physical devices, while a logical topology describes how information flows through a network.

§ In a physical bus topology, a single cable effectively connects all the devices.

§ In a physical star topology, each device in the network is connected to the central device with its own cable.

§ When a star network is expanded to include additional networking devices that are connected to the main networking device, it is called an extended-star topology.

§ In a ring topology, all the hosts are connected in the form of a ring or circle. In a dual-ring topology, there are two rings to provide redundancy in the network.

§ A full-mesh topology connects all devices to each other; in a partial-mesh topology, at least one device has multiple connections to all other devices.

§ There are three common methods of connecting the small office to the Internet: DSL using the existing telephone lines, cable using the CATV infrastructure, and serial links using the classic digital local loops.

Understanding the Host-to-Host Communications Model

clip_image005[5]

Understanding Host-to-Host Communications

§ Nonstandards-based Older model (before OSI)

– Proprietary (IBM SNA, Digital DECnet)

– Application and combinations software controlled by one vendor

§ Standards-based model (OSI)

– Multivendor software

– Layered approach

Why a Layered Network Model?

§ Simplifies teaching and learning

§ Reduces complexity

§ Facilitates modular engineering (free changing of Protocols)

§ Standardizes interfaces


Communication between Hosts

(Horizontal Communication)

clip_image007[5]

Communication between Layers
(Vertical Communication)

clip_image009[5]

q Data Encapsulation

Moving from the top, down - messages get larger and larger ! !  

A message is passed down, and the lower layer adds a header to it. 

This is called encapsulation, because it is like placing an object into a capsule. 

The header is sometimes called a wrapper. 

Each successive lower layer encapsulates what it receives from the layer above it. 

q De-Encapsulation

Moving from the bottom, up - messages get smaller and smaller ! ! 

A message is first stripped of it's header, and then the inner contents (the "data" portion) is passed up. 

This is "decapsulation" but no one uses that term. 

Each successive upper layer receives the data message from the layer below, and then strips off it's own header and passes the data up.

Although there are seven layers in the OSI model,

they can be grouped into three areas:

q High-level Protocols (layers 5, 6 and 7  -  Session, Presentation, and Application) - how the data is presented, displayed, and summarized for the user  -  and in the reverse direction, how the user prepared data is assembled into meaningful data structures (high-level protocols).

q Medium-level Protocols (Layers 3 and 4 - Network and Transport) - how the data is assembled into packets and frames and how error checking and flow control is implemented - and in the reverse direction, how the received packets and frames are assembled into structures such as files and databases (medium-level protocols)

q Low-level Protocols (Layers 1 and 2 - Physical and DataLink) - how the data is converted into electrical pulses of ones's and zero's (bits) and sent across cables or the physical medium, and in the reverse direction, how the electrical pulses are taken off the cable and converted to ones and zero's.

TCP/IP Stack

§ Defines four layers

§ Uses different names for Layers 1 through 3

§ Combines Layers 5 through 7 into single application layer

Summary

§ The OSI reference model defines the network functions that occur at each layer.

§ The physical layer defines the electrical, mechanical, procedural, and functional specifications for activating, maintaining, and deactivating the physical link between end systems.

§ The data link layer defines how data is formatted for transmission and how access to the physical media is controlled.

    • The network layer provides connectivity and path selection between two host systems that may be located on geographically separated networks.

clip_image011[6]

Troubleshooting networking using the OSI model

When troubleshooting networking it is always sensible to approach the problem from the perspective of the OSI model. The OSI, or Open System Interconnection, model defines a networking framework for implementing protocols in seven layers. The beauty of this model is the fact that you can individually troubleshoot every layer using simple methods. I suggest working from layer 1 upwards until you find the problem.

Physical (Layer 1)

This layer conveys the bit stream - electrical impulse, light or radio signal -- through the network at the electrical and mechanical level.

It provides the hardware means of sending and receiving data on a carrier, including defining cables, cards and physical aspects.

Fast Ethernet, RS232, and ATM are protocols with physical layer components.

Data Link (Layer 2)

Ethernet, ATM, Frame Relay, etc.  At this layer, data packets are encoded and decoded into bits. It furnishes transmission protocol knowledge and management and handles errors in the physical layer, flow control and frame synchronization.

The data link layer is divided into two sublayers: The Media Access Control (MAC) layer and the Logical Link Control (LLC) layer.

The MAC sublayer controls how a computer on the network gains access to the data and permission to transmit it.

The LLC layer controls frame synchronization, flow control and error checking.

Network (Layer 3)

Typically IP (the bottom half of TCP/IP).  This layer provides switching and routing technologies, creating logical paths, known as virtual circuits, for transmitting data from node to node.

Routing and forwarding are functions of this layer, as well as addressing, internetworking, error handling, congestion control and packet sequencing.

Transport (Layer 4)

Usually TCP (the top half of TCP/IP).

This layer provides transparent transfer of data between end systems, or hosts, and is responsible for end-to-end error recovery and flow control.

It ensures complete data transfer.

Session (Layer 5)

This layer establishes, manages and terminates connections between applications.

The session layer sets up, coordinates, and terminates conversations, exchanges, and dialogues between the applications at each end.

It deals with session and connection coordination.

Presentation (Layer 6)

This layer provides independence from differences in data representation (e.g., encryption) by translating from application to network format, and vice versa.

The presentation layer works to transform data into the form that the application layer can accept.

This layer formats and encrypts data to be sent across a network, providing freedom from compatibility problems. It is sometimes called the syntax layer.

This layer looks at things like JPEG, MPEG, MIDI, QUICKTIME and other files of the same nature. Most of your troubleshooting will be with the applications that create them (at layer 7) but be aware that you can hex files to look at the structure and change them.
Application (Layer 7)

This layer supports application and end-user processes. Communication partners are identified, quality of service is identified, user authentication and privacy are considered, and any constraints on data syntax are identified. Everything at this layer is application-specific. This layer provides application services for file transfers, e-mail, and other network software services. Telnet and FTP are applications that exist entirely in the application level. Tiered application architectures are part of this layer.
If all of the other layers are working and have been tested, then this is usually just a matter of applying patches to software or reinstalling. Everyone probably has experience troubleshooting problems in windows. Telnet is an excellent tool for connecting to virtually any port to check to see if the above layers are functioning properly

TCP/IP Abc's

http://www.yourdictionary.com/computer/tcp-ip-abc-s

The immense influence of the Internet caused its communications protocol to become the world standard. Almost all networks, except for the circuit-switched networks of the telephone companies, have migrated to TCP/IP.
TCP/IP is a robust and proven technology that was first tested in the early 1980s on ARPAnet, the U.S. military's Advanced Research Projects Agency network, the world's first packet-switched network. TCP/IP was designed as an open protocol that would enable all types of computers to transmit data to each other via a common communications language.

Multiple Layers

TCP/IP is a layered protocol, which means that after an application initiates the communications, the message (data) to be transmitted is passed through a number of software stages, or layers, until it actually moves out onto the wire, or if wireless, into the air. The data are packaged with a different header at each layer. At the receiving end, the corresponding software at each protocol layer unpackages the data, moving it "back up the stack" to the receiving application.

TCP and IP

TCP/IP is composed of two parts: TCP (Transmission Control Protocol) and IP (Internet Protocol). TCP is a connection-oriented protocol that passes its data to IP, which is connectionless. TCP sets up a connection at both ends and guarantees reliable delivery of the full message sent. TCP tests for errors and requests retransmission if necessary, because IP does not.

UDP

An alternative protocol to TCP within the TCP/IP suite is UDP (User Datagram Protocol), which does not guarantee delivery. Like IP, UDP is also connectionless, but very useful for transmitting audio and video that is immediately heard or viewed at the other end. If packets are lost in a UDP transmission (they can be dropped at any router junction due to congestion), there is neither time nor a need to retransmit them. A momentary blip in a voice or video transmission is not critical.

Application Layer 7

The top layer of the protocol stack is the Application Layer. It refers to the programs that initiate the communications in the first place. TCP/IP includes several Application Layer protocols for mail, file transfer, remote access, authentication and name resolution. These protocols are embodied in programs that operate at the top layer just like any custom-made or packaged client/server application.

FTP, SMTP, Telnet, DNS and WINS

Some of the most widely known application protocols in the TCP/IP suite are FTP (File Transfer Protocol), SMTP (Simple Mail Transfer Protocol), Telnet, DNS (Domain Name System) and WINS (Windows Internet Name System). FTP programs are widely used to copy files across the network. All TCP/IP-based mail programs use SMTP to send e-mail. Telnet is a terminal emulator that provides access to a remote host. DNS and WINS allow hosts to be given understandable names, and the DNS and WINS servers turn those names into the IP address required by TCP/IP networks.

Other Client/Server Applications

The language and format in a user's proprietary client/server program are not known to TCP/IP. They are known only to the sending and receiving programs that must communicate with each other. The data from all applications, whether a proprietary program or part of the TCP/IP suite (FTP, Telnet, etc.), are "handed down" from the Application Layer in the client to the lower layers in the stack for transport. At the server side, they are "handed up" the stack to the appropriate application for processing. The operation is reversed for data sent back from the server to the client.

IP Addresses

All nodes in a TCP/IP network (clients, servers, routers, etc.) are assigned an "IP address," which is written as four numbers between dots, such as 193.4.64.01. The first part of the address is the network address, and the second part is the host (station) address, also known as the netid and hostid. The network address allows TCP/IP packets to be routed to a different network. The number of bytes used for the netid and hostid vary according to a class system, and the first three bits of the first byte determine this ratio (see IP address for details).

Ports and Sockets

A program identifies the program it wishes to communicate with by its socket, which is a combination of (1) the server's IP address and (2) the program's port. If it does not know the IP address, but knows the server by name, it uses a Domain Name System server (DNS server) to turn the name into the IP address. In Windows networks, a Windows Internet Name System server (WINS server) is used to map NetBIOS names, which are assigned to many Windows machines in small networks, to IP addresses.
The port is a logical number assigned to every application. For FTP, SMTP, HTTP (Web) and other common applications, there are agreed-upon numbers known as "well-known ports." For example, HTTP applications on the Web are on port 80, so a Web server is located by its IP address and port 80. An organization's internal client/server applications are given arbitrary ports for their own purposes.

OSI Layers 5, 6 & 7 Are All in the Top Layer

OSI Layers 5, 6 and 7 are all included in TCP/IP's Application Layer. For example, OSI Layer 6 (Presentation Layer) is where data conversion (ASCII to EBCDIC, floating point to binary, etc.) and encryption/decryption are performed. OSI Layer 5 is the Session Layer, which is performed in Layer 4 in TCP/IP. Thus we jump from Layer 7 down to Layer 4.

clip_image001

From Application to Transport Layer

The application delivers its data to the communications system by passing a stream of data bytes to the transport layer along with the socket of the destination machine. The dotted lines in this diagram are conceptual. DNS and WINS requests go down the stack (in a UDP packet) like everything else in order to go out onto the network.

Transport Layer 4 - TCP & UDP

TCP establishes a connection at both ends, creating a "virtual connection" between the two machines before any data can be transmitted. Once established, both sides negotiate the maximum size of a TCP packet. Although TCP supports packets up to 64KB, in most cases, the size will be based on the underlying network, such as Ethernet, which can hold a maximum of 1518 bytes. Token Ring and FDDI support larger frames. TCP attaches a header onto the packet that contains the source and destination ports as well as the sequence number of the packet, and it hands it over to IP along with the destination IP address. (A TCP packet is technically a Protocol Data Unit or segment, but is more often called a packet in common parlance.)

The Sliding Window

TCP uses a sliding window system, which is an adjustable buffer that allows a number of packets to be received before an acknowledgment is sent back. The size of the window can be changed as conditions change, and TCP handles this "flow control" in real time. It also handles the retransmission of packets that have been received with errors.

UDP (User Datagram Protocol)

UDP is an alternative to TCP that does not establish a connection, makes no guarantees and provides no flow control or error detection. Either it does not matter as would be the case for real-time audio or video, or the application programs using UDP must themselves include the error detection and recovery that TCP provides.

clip_image002

From Transport to Network Layer

TCP and UDP hand over their packets to IP along with the IP address of the destination node. The packet size is typically the size of the underlying data link layer such as Ethernet or Token Ring.

Network (Internet) Layer 3 – IP

The IP protocol accepts the packets from TCP or UDP and prepares them for the Data Link Layer below by turning the IP addresses into physical station addresses (MAC addresses) and fragmenting the packets (if necessary) into the required frame size. IP uses the ARP (Address Resolution Protocol) to obtain the MAC address, unless (1) the address has already been ARP'd and is in the cache or (2) there is a predefined configuration file that contains the addresses. An ARP request is broadcast onto the network, and the machine with that IP address responds with its MAC address. If the target machine is in a different network or subnetwork than the source machine, IP supplies the target address of the default gateway, which is the router that can direct the packet to the appropriate network.

Datagrams

IP outputs packets called "datagrams," and each datagram is prefixed with an IP header that contains source and destination IP addresses. If IP has to fragment the packet further, it creates multiple datagrams with sequence numbers so that they can be reassembled by IP on the other end. IP hands over each datagram to the data link layer below along with the MAC address (Ethernet address) of the target station or router.

Multicast

IP supports a very useful feature called "multicast," which allows one message to be delivered to multiple recipients. That means one IP data stream can travel a long, circuitous route before it is fanned out to all the target stations by the last router.

clip_image003

From Network to Data Link Layer

IP datagrams are handed over to Ethernet, Token Ring, ATM or some other data link protocol responsible for moving the data across the wire. The dotted lines in the diagram are conceptual. ARP requests go down the stack like everything else in order to go out onto the network.

IP Is the Routing Mechanism

In a large enterprise or on the Internet, the IP protocol is used to route the packets from network to network. Routers contain routing tables that move the datagrams to the next "hop," which is either the destination network or another router. Datagrams can traverse several routers within an enterprise and dozens of routers over the Internet.

Fragmentation

Routers that span different types of networks may have to fragment the datagrams even further if they direct them onto routes that use a smaller frame size than the incoming frame; for example, from FDDI to Ethernet.

From Hop to Hop

Routers inspect only the network portion (netid) of the address and direct the incoming datagrams to the appropriate outgoing port for the next hop. Routers move datagrams from one hop to the next as they are mostly aware of only the devices that are directly connected to them. Eventually, if the routing tables are correctly updated, the datagrams reach their destination. Routers use routing protocols to obtain current routing information about the networks and hosts that are directly connected to them.

clip_image004

Routing Table Example

If a router receives packets for a remote network, it sends them out the port that will reach the next router. Router ports are entirely different than socket ports. Router ports are physical pathways to and from the router connected via cable. Socket ports are logical assignments made to running programs.

Data Link Layer 2 – Ethernet

IP can connect directly to Ethernet, Token Ring, FDDI, ATM, SONET, X.25, frame relay and other networks. Since Ethernet is the most widely used data link protocol, or network access method, we use it in our example. Ethernet wraps the IP datagrams into its own frame format, which includes a header with source and destination MAC addresses (station addresses) and a trailer that contains checksum data.

Ethernet Packets Can Collide

Ethernet uses the CSMA/CD (carrier sense multiple access/collision detection) access method to broadcast the frames onto the wire. If two stations transmit at the same time, their frames collide, and they each back off and wait a random amount of time before trying again (in milliseconds). The data link layer is responsible for reliable node to node transmission. If an Ethernet frame is received with errors, Ethernet handles retransmission until it is received error free.

LAN to WAN

If IP datagrams start out in a LAN, go to a wide area network (WAN) and then to a LAN at the other side, the Ethernet LAN frames are converted into WAN frames by a router and back again to Ethernet frames by the router at the other side.

clip_image005

Onto the Wire

The data link layer is responsible for reliable node to node transmission within a subnetwork. When Ethernet frames traverse several routers, the same frames are retransmitted over again by the next router.

Packets, Datagrams or Frames?

The message starts out in one host, goes down the protocol stack, over the wire, and back up the stack on the receiving host. The counterpart protocols unpackage the frames, datagrams and packets and deliver the data to the application for processing.
Although the terms are technically TCP segments, IP datagrams and Ethernet frames, they all ride over packet-switched networks and are frequently called packets at all stages.

IP Is "The" Standard

IP has become the worldwide standard protocol for all forms of electronic communications, including data, voice and video. The amount of data communications is increasing far more than voice traffic, and it is expected that all data, voice and video will ride over IP-based networks in the future. See IP on Everything.

clip_image006

Transporting IP

Transporting IP packets over a LAN is typically done via Ethernet. Over the WAN, IP generally rides over SONET or on ATM on top of SONET. In the future, IP is expected to ride directly over DWDM fiber (rightmost diagram).

clip_image007

Summary of the TCP/IP Stack

TCP/IP References

Perhaps the simplest reference ever written on the subject is "An Introduction to TCP/IP" by John Davidson, published by Springer-Verlag (ISBN 0-387-96651-X). Although written in 1988 and only 100 pages, it is the easiest read on the subject you will ever find.
The Bibles for TCP/IP have been "Internetworking with TCP/IP," Volumes I, II and III, by Douglas E. Comer. Updated to its 5th edition in 2005, Volume I covers, as its subtitle states, the principles, protocols and architecture of the subject. Published by Prentice Hall (ISBN 0-13-187671-6).

вторник, 13 июля 2010 г.

How to use the OSI Model to Troubleshoot Networks

by David Davis, vExpert, VCP, CCIE 9369 - January 7, 2009

In a previous article, we explained the OSI model and how it works. In that article, we went over how the OSI model is a standard theoretical model for how networking hardware, software, protocols work together. What we didn’t discuss in that article is how the OSI model can help you in your day to day life.

Some of you might be thinking “theoretical models don’t help me” or “the OSI model is just some engineering thing for the nerds”. However, in reality, it is quite the opposite. The OSI model can help you. Let me show you how.

 

Using the OSI model

First off, I want you to have a visual image of the OSI mode. It looks like this:

 image

This graphic is courtesy of the Abdus Salam International Centre for Theoretical Physics

On the left hand side is a user. On the right hand side, you could have a server. Every request AND response has to travel from the left, down every layer, to the physical layer, across the physical layer, up the layers on the right, and up to the server on the top right hand corner.

By understanding this information and having a visual image of how the OSI model works, you have a very valuable troubleshooting tool. If you can visualize the different pieces that complete the path of the data, you will have much less trouble resolving a networking issue. You can think of the OSI model as a map for the path that your data takes. If your data is not completing the path, you can check each “waypoint” on the map until you find the area that is causing the problem. 

 

My experience with the OSI model

In my time spent as a network administrator, I would use the OSI model daily. Let me explain how.

When a get a call from a user that explains a problem they are having, I would immediately visualize the OSI model. The user might say that they can’t bring up a graphic they are trying to download from the Internet. That graphic is brought up in an application.  (layer 7 of the OSI model). I could either start at the top or the bottom, depending on what I suspected was the problem. I would usually start at the bottom (termed the “bottom up approach”). At the bottom of the OSI model is the physical layer (layer 1). So, I would proceed to ask them questions like this:

  • Is your network cable plugged in? (physical)

  • Is there a link light on the Ethernet switch and Ethernet NIC? (data-link)

  • Do you have an IP address? (network)

  • Can you ping your default gateway? (network, testing LAN IP connectivity)

  • Do you have DNS server information?

  • Can you ping your DNS server? (network, testing IP connectivity)

  • Do you have a firewall configured? (network on up to application)

  • Can you ping the host you are trying to get to by name? (application, DNS and network WAN IP connectivity)

  • What format is the graphic in? Do you have a viewer for that format? (presentation)

  • Can your web browser open up another website? (basic application troubleshooting)

It may turn out that the graphic they were trying to bring up was a .TIFF file and they didn’t have a decoder for that type of file. Thus, this would have been a presentation error issue as the presentation layer deals with formats of graphics & files, as well as compression and encryption.

 

Methods of using the OSI model

I just gave you an example for using the OSI model with a “bottom up” approach to troubleshooting. There are three different ways to use the OSI model:

  • Bottom up – troubleshooting by going from the physical layer (layer 1) up to the application layer (layer 7)

  • Top down - troubleshooting by going from the application layer (layer 7) down to the physical layer (layer 1)

  • Divide and Conquer – in this method, you start with whatever layer you feel is most likely the cause of the problem, then move in whatever direction you feel is the more likely cause of the issue (either up or down the OSI model)

In Summary

Now you may not be a network administrator but the OSI model can help anyone troubleshoot any networking problem. I hope that this example gave you some ideas as to how you can use the OSI model, everyday, to troubleshoot your networking problems.

OSI Model Concepts

by Daniel Petri - January 8, 2009

The standard model for networking protocols and distributed applications is the International Standard Organization's Open System Interconnect (ISO/OSI) model. It defines seven network layers.

Short for Open System Interconnection, an ISO standard for worldwide communications that defines a networking framework for implementing protocols in seven layers. Control is passed from one layer to the next, starting at the application layer in one station, proceeding to the bottom layer, over the channel to the next station and back up the hierarchy.

At one time, most vendors agreed to support OSI in one form or another, but OSI was too loosely defined and proprietary standards were too entrenched. Except for the OSI-compliant X.400 and X.500 e-mail and directory standards, which are widely used, what was once thought to become the universal communications standard now serves as the teaching model for all other protocols.

Control is passed from one layer to the next, starting at the application layer in one station, proceeding to the bottom layer, over the channel to the next station and back up the hierarchy.

image

(This graphic is taken from The Abdus Salam International Centre for Theoretical Physics).

Understanding how the OSI Model works is not only useful for taking certification exams, but also for real life scenarios. Read How to use the OSI Model to Troubleshoot Networks for more info.

Layer 1 - Physical

Physical layer defines the cable or physical medium itself, e.g., thinnet, thicknet, unshielded twisted pairs (UTP). All media are functionally equivalent. The main difference is in convenience and cost of installation and maintenance. Converters from one media to another operate at this level.

 

Layer 2 - Data Link

Data Link layer defines the format of data on the network. A network data frame, aka packet, includes checksum, source and destination address, and data. The largest packet that can be sent through a data link layer defines the Maximum Transmission Unit (MTU). The data link layer handles the physical and logical connections to the packet's destination, using a network interface. A host connected to an Ethernet would have an Ethernet interface to handle connections to the outside world, and a loopback interface to send packets to itself.

Ethernet addresses a host using a unique, 48-bit address called its Ethernet address or Media Access Control (MAC) address. MAC addresses are usually represented as six colon-separated pairs of hex digits, e.g., 8:0:20:11:ac:85. This number is unique and is associated with a particular Ethernet device. Hosts with multiple network interfaces should use the same MAC address on each. The data link layer's protocol-specific header specifies the MAC address of the packet's source and destination. When a packet is sent to all hosts (broadcast), a special MAC address (ff:ff:ff:ff:ff:ff) is used.

 

Layer 3 - Network

NFS uses Internetwork Protocol (IP) as its network layer interface. IP is responsible for routing, directing datagrams from one network to another. The network layer may have to break large datagrams, larger than MTU, into smaller packets and host receiving the packet will have to reassemble the fragmented datagram. The Internetwork Protocol identifies each host with a 32-bit IP address. IP addresses are written as four dot-separated decimal numbers between 0 and 255, e.g., 129.79.16.40. The leading 1-3 bytes of the IP identify the network and the remaining bytes identifies the host on that network. The network portion of the IP is assigned by InterNIC Registration Services, under the contract to the National Science Foundation, and the host portion of the IP is assigned by the local network administrators. For large sites, the first two bytes represents the network portion of the IP, and the third and fourth bytes identify the subnet and host respectively.

Even though IP packets are addressed using IP addresses, hardware addresses must be used to actually transport data from one host to another. The Address Resolution Protocol (ARP) is used to map the IP address to it hardware address.

 

Layer 4 - Transport

Transport layer subdivides user-buffer into network-buffer sized datagrams and enforces desired transmission control. Two transport protocols, Transmission Control Protocol (TCP) and User Datagram Protocol (UDP), sits at the transport layer. Reliability and speed are the primary difference between these two protocols. TCP establishes connections between two hosts on the network through 'sockets' which are determined by the IP address and port number. TCP keeps track of the packet delivery order and the packets that must be resent. Maintaining this information for each connection makes TCP a stateful protocol. UDP on the other hand provides a low overhead transmission service, but with less error checking. NFS is built on top of UDP because of its speed and statelessness. Statelessness simplifies the crash recovery.

Layer 5 - Session

The session protocol defines the format of the data sent over the connections. The NFS uses the Remote Procedure Call (RPC) for its session protocol. RPC may be built on either TCP or UDP. Login sessions uses TCP whereas NFS and broadcast use UDP.

Layer 6 - Presentation

External Data Representation (XDR) sits at the presentation level. It converts local representation of data to its canonical form and vice versa. The canonical uses a standard byte ordering and structure packing convention, independent of the host.

 

Layer 7 - Application

Provides network services to the end-users. Mail, ftp, telnet, DNS, NIS, NFS are examples of network applications.

Introduction to the OSI Model

by Jason Zandri - June 2, 2010

The Open System Interconnection Reference Model (OSI) is a seven layer model that was developed as part of the effort to standardize networking that was started in the late 1970's as part of the Open Systems Interconnection (OSI) initiative.

This article will be a brief overview of the model itself and the tie in to the Cisco Certified Network Associate Routing & Switching exam (640-802 CCNA), as well as the Network+ exam.

OSI Model's place in the CCNA and Network+ exams

Both the 640-802 CCNA exam and the Network+ exam test for some of the common knowledge of the OSI Model.

For the CCNA 640-802 exam this information is tested as part of the "Describe how a network works" domain as part of the following subtopics:

  • Use the OSI and TCP/IP models and their associated protocols to explain how data flows in a network
  • Describe the purpose and basic operation of the protocols in the OSI and TCP models
  • Select the components required to meet a network specification

Beyond these subtopics you'll need to have at least a general understanding of the model across some of the other exam topics as well but this is the primary area of focus.

For the Network+ exam most of this relates to subtopic  4.1 Explain the function of each layer of the OSI model.

For both certification exams you'll need to know where in the model certain protocols function as well as knowing at what layers hardware devices such as routers, switches, bridges, et cetera work. Additionally, you'll need to have a good understanding of how security of data is handled through the devices and what security features are offered to the data in transit and at which levels of the OSI model offer what types of security.

The Seven Layers of the OSI Model

In summary the four layers of the OSI model are broken as follows:

The Physical Layer defines the electrical and physical properties and the operating specifications for the devices and media in use. The main job of the Physical Layer is the physical "connection" or attachment of given media and how it is configured (e.g. Token Ring cable, size of cable used, termination in place etc.). In some instances, there may be secondary responsibilities of this layer depending on the device for things such as flow control, modulation/demodulation and so forth. The protocol data unit in use at this level of the OSI model is referred to as a "bit."

The Data Link Layer provides the practical means to transfer data between network nodes as its main job is to transfer data between network nodes in a wide area network or between nodes on the same local area network segment/subnet. It has the secondary responsibility to detect and correct errors (as permissible) that may take place at the Physical Layer. The protocol data unit in use at this level of the OSI model is referred to as a "frame."

The Network Layer handles the forwarding and routing of data along logical paths between network connected nodes. In addition to routing and forwarding functions of this layer of the model is also performs addressing, error handling, quality of service control, congestion control and packet sequencing. The protocol data unit in use at this level of the OSI model is referred to as a "packet."

The Transport Layer is responsible for the reliable, end to end transfer, recovery and flow control of the segments between the nodes. The protocol data unit in use at this level of the OSI model is referred to as a "segment."

The Session Layer addresses the build up and tear down of the connection sessions between nodes on a network. The protocol data unit in use at this level (and all of the subsequent levels) of the OSI model is referred to simply as "data."

The Presentation Layer is responsible for taking the data from applications at the application layer and breaking it down for use on the session layer as well as the reverse. It also has the task of formatting the data so that it can be sent to other nodes.

The Application Layer handles the initial connection of a given application to the network. It is where applications and application type activities such as browsing the web, sending and receiving email and performing file transfers take place. There are applications that wholly reside at the level such as Telnet and FTP.

 

Protocol Use at each of the TCP/IP Model Layers

At each layer of the OSI Model there are associated protocols that are in use.

These are not fully comprehensive lists but are examples of the more common protocols that are functioning at these different levels of the OSI Model.

At the Application layer you can find many but some of the more common ones include:

  • DHCP - Dynamic Host Configuration Protocol
  • FTP - File Transfer Protocol
  • HTTP - HyperText Transfer Protocol
  • IMAP - IMAP4, Internet Message Access Protocol (version 4)
  • LDAP - Lightweight Directory Access Protocol
  • LPD - Line Printer Daemon Protocol
  • MIME (S-MIME) - Multipurpose Internet Mail Extensions and Secure MIME
  • NFS - Network File System
  • NNTP - Network News Transfer Protocol
  • NTP - Network Time Protocol
  • POP - POP3, Post Office Protocol (version 3)
  • RDP - Remote Desktop Protocol
  • RPC - Remote Procedure Call
  • SMTP - Simple Mail Transfer Protocol
  • SNMP - Simple Network Management Protocol
  • SNTP - Simple Network Time Protocol
  • SSH - Secure Shell
  • TELNET - Terminal Emulation Protocol of TCP/IP
  • TFTP - Trivial File Transfer Protocol

At the Presentation layer you can find these common protocols:

  • MIME - Multipurpose Internet Mail Extensions
  • SSL - Secure Sockets Layer
  • TLS - Transport Layer Security
  • XDR - eXternal Data Representation

At the Session layer you can find socket driven connections and session establishment in Transmission Control Protocol (TCP), Session Initiation Protocol (SIP), and Real-time Transport Protocol (RTP).

You can also find Named Pipe sessions, a protocol in the Server Message Block (SMB) suite as well as the NetBIOS (Network Basic Input/Output System) application Programming Interface (since NetBIOS is not formally a true networking protocol).

Session Announcement Protocol (SAP) is a protocol for broadcasting multicast session information and it is also found at the Session layer.

 

At the Transport layer you can find these common protocols:

  • SPX - Sequenced Packet Exchange
  • TCP - Transmission Control Protocol
  • UDP - User Datagram Protocol
  • SCTP - Stream Control Transmission Protocol

At the Network Layer you can find these common protocols:

  • ATP - AppleTalk Transaction Protocol
  • IPv4 - Internet Protocol v4
  • IPv6 - Internet Protocol v6
  • IPX - Internetwork Packet Exchange
  • ICMP - Internet Control Message Protocol
  • IGMP - Internet Group Management Protocol
  • OSPF - Open Shortest Path First

At the Data Link Layer you can find these common protocols:

  • PPP - Point-to-Point Protocol
  • PPTP - Point-to-Point Tunneling Protocol
  • SLIP - Serial Line Internet Protocol
  • L2TP - Layer 2 Tunneling Protocol

Since the Physical Layer is really for defining the physical "connection" or attachment of given media and how it is configured as well as the electrical and physical properties and the operating specifications for the devices and media in use there are no actual TCP/IP common protocols that are in use.

You can find certain combinations of media and standards at this layer such as RS-232 (Recommended Standard 232) which is the standard for data and control signals connecting between a DTE (Data Terminal Equipment) and a DCE (Data Circuit-terminating Equipment) and Digital Subscriber Line (DSL) which provides digital data transmission over local telephone lines.

In this article we reviewed the tie in of the OSI Model to the CCNA and Network+ exams as well as took a look at the breakdown of the seven layers of the OSI Model

We wrapped up with a quick look at some of the protocols that are in use at each of the OSI Model Layers

Thanks for investing your time in my Introduction to the OSI Model article.

I am always looking forward to any feedback you have on this or any of the articles I have written so feel free to offer your feedback.

Additionally, I would welcome any suggestions topics of interest that you would like to see and based on demand and column space I’ll do what I can to deliver them to you.