cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4763
Views
3
Helpful
6
Replies

Understanding OSI and TCP IP Model

mahmoodmkl
Level 7
Level 7

Dear Gents,

Well First i am apologise to post a basic question but i couldnt stop myself to get the experts comments.

I understand that OSI and TCP IP Models merge together from layer 4 .ie from Transport Layer.

Just to have a in depth view of how applications communicate over a network lets say how computers communicate below is my understancding.

Lets take a example of how browsing works.As per my understanding below is the process.

Our brower application which is hardcoded to use http protocol when entered with the url tires to resolve it and in this process contacts our dns server.

In retrun dns server sends back the ip of the website, from here my confusion starts.

I think from here the browser application which is hardcoded to use TCP forwards the data to TCP and TCP i underatand is the function of OS.

TCP takes the data and segments it correctly and forwards the data to network layer-- here i a m confused how does the nework layer knows how to add the source IP and Destination IP i mean from where  this info is provided --- is it from the application..?

Please clarify as i am confused about this a lot.

Thanks

6 Replies 6

Peter Paluch
Cisco Employee
Cisco Employee

Hello,

The issues of inter-layer communication (a higher layer communicating with the lower) are often confusing, even for myself. We have to think of layering not as total isolation of one layer from another, but more as concentrating or grouping of common/similar functions whose responsibilities and capabilities are well defined, and outside of that, they rely on other layers to provide the necessary functionality.

In TCP/IP world in particular, when your browser opens a TCP connection to a HTTP server, it creates what we call a socket. The socket is a communication endpoint that allows your browser to actually talk to the server, and . When a socket is created, you - as a software engineer programming the creation of that socket - would specify

  • Namespace of the socket (IPv4, IPv6) and the transport protocol (UDP, TCP, SCTP, DCCP, ...)
  • Destination address and port if applicable
  • Source address and port if necessary (can be omitted, if unspecified, the opearating system will assign the source address and port automatically)

Then you use this socket to start a conversation with the remote server.

Note that when the socket is created, it specifies many of the necessary details of the message delivery: both the transport layer and its addressing plus network layer and its addressing. In fact, the application has specified both the transport and network layer details of the required data delivery. It is now the task of the operating system that actually uses the socket object to perform the actual data delivery to use all these available data to call the appropriate drivers and send the message along its way.

Even if the layering seems to be strict, you are absolutely correct in that upholding such a strict isolation between layers would effectively prohibit their proper operation. In reality, while - for example - an application layer software does not perform the individual tasks of transport and network layers, it provides necessary supervisory or control information so that both transport and network layers can do its job. What the application layer does not do is itself packaging the data into transport segments, itself packaging the segments into network layer packets, etc. - that is the responsibility of the lower layers. However, the application layer still needs to tell them how it wants the service to be done.

Does this make a little more clear? Please feel welcome to ask further!

Best regards,

Peter

Hi,

So you mean that the application provides the transport and network layer info and the rest is handled by the OS.

Can you please confrim.

Thanks

Hello,

So you mean that the application provides the transport and network layer info and the rest is handled by the OS.

Yes, that is basically correct. It is the application that knows who is the intended recipient of its data, and how should the data be delivered, so it is the responsibility of the application to provide this addressing data.

The inter-layer communication does not stop at this stage, however. For example, TCP has to ask the IP for the MTU so that the TCP segments are not unnecessarily large and require fragmentation. IP has to work with the particular link-layer technology to perform adequate IP-to-L2 address mapping (MAC, DLCI, VPI/VCI). Just a glimpse on other inter-layer communication that takes place inside the operating system.

Best regards,

Peter

Hi Peter,

Thanks for your reply.

I do understand that all the layers need to communicate with each other in order to achieve the complete connection.

Just one more clarification..

In terms of TCP communication does the actual data transfer takes place after 3 Way handshake..?.

Thanks

Hello,

In terms of TCP communication does the actual data transfer takes place after 3 Way handshake..?.

Yes, that is correct. The three-way handshake in TCP must be completed first, only then the user data can be transferred.

Best regards,

Peter

mahmoodmkl,

Your questions may have been answered to your satisfaction, if so please ignore my post.  Though I understood the basic theory of OSI and TCP/IP layered models when I was first studying them, they didn't become much clearer until later when I found the source that "spoke" to me. (And that's another reason I encourage all students to diversify their study materials...somewhere you'll pick up a nugget that brings it all together).

Think of each layer as providing "services" to the upper layer.  As Peter has already said, the transport layer will provide transport services to the upper layer, but the upper layer will need to provide some information in order to use those services.  Much like you can use the post office (in the US) to get mail to a friend, they provide a number of services to you.  They can provide express mail, certified, registered, packages, letters, etc.  You tell them the end address and how you want it delivered, and they take care of getting it to the destination and any type of necessary confirmation.  Similar with the TCP/IP model...an upper layer would provide the data, address, and type of service that it wants to TCP, and from there the transport layer would take care of transport.  Note that the upper layer may take advantage of other lower-layer services to get some of that information.  You may use a phone book to look up a phone number or address.  An upper layer may use DNS to look up needed info before passing data along to a lower layer.

Then you also see the advantages of the layered model.  When you take your letter to the post office. you don't need to tell them whether they must use a truck, aircraft, pony express, etc. to deliver the letter to the destination.  They make the appropriate choice based on the data and media available.  Similar to the layered TCP/IP model.  Your application doesn't care if the data link and physical layers are Ethernet, ATM, serial, etc. It hands off the data to the transport, who coordinates with the lower layers to deliver it.

Some of my confusion was alleviated when I learned that the TCP/IP model is not a one-for-one match to the OSI model.  That wasn't clearly explained in some of the early literature I referenced, but if you do some reading on TCP/IP vs OSI layers the distinction may become a bit clearer.

Good luck!