Networking - The OSI Model

Topics including TCP/IP, OSI, Netbios, exploiting share, proxies and much more

Networking - The OSI Model

Postby foldingstock » Thu Apr 09, 2009 10:20 am

This is a brief tutorial on the OSI model and how it works in a networked environment. Why is this important? You may not think like me, but I don't like to use tools without understanding the basic functionality of how it operates. This tutorial will not go into a detailed analysis, but it will explain the basics of networking. I hope that after reading this you will have more appreciation for network design and the simple ability to "browse the web" that we seem to take for granted today.

---------------------------------------------------------------------------------------------------------

Networking - The OSI Model

The Open Systems Interconnection Reference Model is used in network communications as a basic model for network design. Cisco courses and certifications (CCNA/CCNP/CCIE) heavily focus on the OSI model as a tool for network architecture.

The OSI model is divided into layers. Each layer receives a service from the layer below it, and provides a service to the layer above it. For example, the data link layer requires the physical layer below it to provide the physical connection and it sends/receives communication for the network layer above it.

Listed below are the seven layers that comprise the OSI model:

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


These seven layers provide seemless communication from the applications a user is working with all the way down to the physical cable connections. Understanding these layers and their individual function is key to understanding networks. Even a basic knowledge of this model can be a tremendous benefeit when trouble-shooting network connectivity.

Lets begin by looking at each layer in more detail. We will start with Layer 7, the application layer.

Layer 7: Application Layer

The application layer is the OSI layer responsible for providing end-user servies. Software applications that utilize networking components such as web browsing, file transfers, virtual terminal access, and email reside and operate at this layer. This includes common protocols such as HTTP, FTP, SSH, and SMTP.

Layer 6: Presentation Layer

Encoding, compression, encryption, and encapsulation are performed at the presentation layer. This layer receives data from the application layer, encapsulates this data into session protocol data units, and sends this data down the stack to the session layer.

Layer 5: Session Layer

The session layer is responsible for establishing and maintaining a process-to-process connection between local and remote applications. This layer is responsible for establishing, checkpointing, terminating, and restarting connection sessions.

Layer 4: Transport Layer

The transport layer delivers messages between networked hosts. Flow control, segmentations/desegmentation, and error control are used by the transport layer to control and maintain the reliability of a link. Because of this ability to control and maintain a link, this layer is able to segment data and retransmit any packets that fail to transfer. TCP and UDP operate at this level of the OSI model. The encapsulated session-layer packet is converted into either a TCP of UDP data packet at this layer.

Layer 3: Network Layer

The network layer is used by routers to communicate data between different local and wide area networks. The Internet Protocol (IP) operates at this level of the OSI model and serves as a way of addressing and segmenting different networks. This network is what makes the internet possible.

Layer 2: Data Link Layer

The data link layer is responsible for communications between network nodes, such as a hub or switch. WAN and LAN servies arrange bits from the pysical layer into logical sequences, called frames, which are used at the data link layer and later converted into network packets by the network layer. At this layer, hubs and switches use a device's physical MAC address to identify and communicate with it. The device's IP address is not used until a data frame is transferred from this layer to layer 3.

Layer 1: Physical Layer

The physical layer is responsible for bit-level transmission between network devices and the physical connection of these devices. This includes items such as: connector types, cable types, voltages, network adapters, etc. The physical layer establishes and terminates physical connections to a communications medium such as a NIC card.

----------------

To better understand how the OSI model works, lets look at an example. In the following example, a PC is accessing a web page and we will follow the OSI model to see how this process works. Keep in mind this is a rough depiction of how this process works. In reality there is a lot more going on, but for the sake of understanding we are going to keep this example simple.
Code: Select all
[PC] | | <---CAT5 ethernet cable, straight-through | {SWITCH} | | <----CAT5 ethernet cable, straight-through | (ROUTER) | | <-----WAN connection, coax/phone line/fiber optic/etc | *INTERNET*
The user at the pc will open a web browser and type "http://www.google.com" in to the web browser. Upon hitting enter, the HTTP protocol operating at the application layer (7) will send HTTP data to the presentation layer (6) where it is encapsulated and sent to the session layer (5) to establish a session between the PC and http://www.google.com. Before the session can be created, a reply from the google web server will need to be received.

Image

The transport layer will convert the session packet into a TCP packet, which the network layer will use. The PC will forward this packet out its default gateway, which is the router. As the packet leaves the PC, the data link layer establishes communication with the switch and the physical layer sends the actual bit-level electircal transmission to the switch. The switch, in turn, will forward this packet to the router using layers 2 and 1.

The router receives the transmission at the physical and data link layers. The packet is re-encapsulated at the network(3) and transport(4) layer into a TCP IP packet. The router forwards this packet onto the next network hop, which will forward the packet, and so on until it reaches google's web server.

This communication can be viewed with a network tool such as Wireshark. Part of it will look like the image below. 74.125.93.147 is the IP address that http://www.google.com is resolving to.
10.22.1.215 is the PC.
10.22.45.3 is the DNS that resolves http://www.google.com into the IP form for transfer.

Image

The google web server will receive this packet and establish a session (5). The application (7) layer, running the web server software (such as APACHE) will send the requested information via HTTP back on its journey to the router.

The router will receive the data packets from the google web server, and forward them to the PC. The switch receives this data from the router, sees it is destined for the PC, and forwards it on.

The network card on the PC will receive the physical electrical signals from the switch. These signals are converted into data frames by the data link layer, which will further be converted into TCP IP packets by layer 3 and 4. The established session (5) will be terminated once all the packets have been received. The presentation layer(6) decapsulates the packets, and the application layer (7) converts the raw HTML and displays the web page, http://www.google.com.

Image

All of this takes place while your browser "loads" the page. How fast does http://www.google.com load for you? Certainly something to think about.

If you found this information helpful or interesting, I want to encourage you to study more about networking. I will post more network-related tutorials as I find time.

-foldingstock
User avatar
foldingstock
htd0rg lieutenant
 
Posts: 300
Joined: Sat Aug 16, 2008 10:38 pm

Re: Networking - The OSI Model

Postby GhostHawk » Thu Apr 09, 2009 10:43 am

Rock and roll man.
Opinions are like ass holes, everyone has one. It is also my opinion, that I am an ass hole.
User avatar
GhostHawk
Ex-Mod
 
Posts: 1447
Joined: Wed Jul 30, 2003 12:10 am
ICQ: 231821255
Website: http://www.xpango.com?ref=91423378


Return to ā€œ%sā€ Networking Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

cron