0

I am not able to understand TCP/IP model where in layer 4 it says suppose using TCP means connection is oriented and packets will follow certain path but in layer 3 it says IP is connectionless and packets can take any independent path what does that mean?

Edit: My understanding as per my research says that at layer 5 TCP connection is done and at layer 4 data is encapsulated to segment means segments will follow certain path and at layer it is encapsulated to packets where it can transmitted using independent paths. but data is encapsulated as we go down till layer 2 and then all together transmitted using layer 1, then where does this path following takes place?

This is my take on this

1) Does that mean data transfer as we go top to bottom will follow path to go to next layer? and sends ACK to previous layer if connection oriented is used.

2) Or Does that mean then parallel layer at receiver side will send ACK as data is received?

3) Or Does that mean after data received at receiver end..till layer 3 it ll be connectionless and from layer 3 to layer 4 it ll follow certain path?

  • What does your research show? Where did you see this information you posted? – Moab Oct 08 '19 at 14:59
  • @Moab now check question again..i have done editing..exact information i never got on this but these are some points which i am confused. i followed youtube tutorials on this – shivaniverma6991 Oct 08 '19 at 15:28

3 Answers3

1

TCP/IP should not be discussed in terms of the OSI model, since it lumps the seven layers of OSI into its own four layers, as follows:

enter image description here

Here the Application layer is protocol (HTTP, FTP etc), the Transport layer is TCP/UDP, the Internet is IP, and Network Access is connection and delivery.

Each layer has its own mechanisms, so headers accumulate. Only TCP needs an ACK mechanism, because it is the only one that needs the three-way handshake.

enter image description here

For your questions:

1) Does that mean data transfer as we go top to bottom will follow path to go to next layer? and sends ACK to previous layer if connection oriented is used.

No, only TCP needs ACK.

2) Or Does that mean then parallel layer at receiver side will send ACK as data is received?

TCP will send an ACK as data arrives, but there is no one-to-one correspondence between data and ACK.

3) Or Does that mean after data received at receiver end..till layer 3 it ll be connectionless and from layer 3 to layer 4 it ll follow certain path?

I admit I don't Understand the question, probably because you are using OSI layers instead of TCP/IP layers. You should be thinking in terms of the latter.

harrymc
  • 480,290
  • i appreciate you answer..i need to undetstand both models and stucked with some doubts..so acc to TCP/IP model..where does Encryption, Data Compression takes place like in OSI layer 6 it happens..Here my take is that it ll happen in Application layer..Also TCP Connection which place at layer 5 in OSI..where does it take place in this model? – shivaniverma6991 Oct 08 '19 at 18:15
  • I can't discuss the 7 OSI layers since they don't apply to the 4 layers of TCP/IP. The OSI layers date from the beginning of the Internet, when it was viewed theoretically and not at all practically. This theoretical view has nothing to do today with reality, which was why TCP/IP had to redo it all. OSI tried to dissect it in too-fine a manner. It was impractical to manage so many layers. – harrymc Oct 08 '19 at 18:27
  • acc. to TCP/IP model encryption or ssl takes place at application level bcoz browser will take care of it. but i studied that ssl handshake happens after tcp connection, tcp connection established after that SSL Handshake happens, but SSL Handshake should happen in Layer application level..how does that happen? – shivaniverma6991 Oct 08 '19 at 18:32
  • Although sending certificates and such belongs to the Application layer, it then dictates the packet format which is on a lower level. Conclusion: TLS is not in any layer. You should understand that today (and always) implementation comes first, then the theoreticians try to fit it into their models, not always with success. – harrymc Oct 08 '19 at 18:55
  • but then what about that SSL Handshake? where does it happen? – shivaniverma6991 Oct 08 '19 at 18:59
  • See this link, where trying to analyze the layers sort of verges on the absurd. As SSL is taking place between software, I would say that it is in the Application level and even higher, not really part of the communication stack and only sort-of fits-in with (too) great an effort. The 4 TCP/IP layers care nothing about the payload that is being transferred, as to them these are just bytes to be transported. So I would say that SSL is not in these layers at all (but many would disagree). – harrymc Oct 08 '19 at 19:10
0

TCP is connection oriented. What this means is

  • there's two (no more, no less) parties in a TCP connection, client and server.

  • these parties expect what is sent to arrive at the other end in order it was sent.

  • the connection is opened, and data can be sent/received until one side closes it.

IP makes no guarantees at all. IP does not guarantee

  • that the packet will take a given path

  • that the packet will arrive in a given timeframe

  • that the packet will arrive at all

then where does this path following takes place?

Operating systems maintain a table of sockets - a socket is an IP address + a port.

For each socket, various state is maintained such as sequence number, window size, and segments (tagged with sequence numbers) that haven't been acknowledged yet.

Between the socket and the TCP segment sequence number, it knows how to reassemble things in the right order before delivering the stream fragment to the application.

Segments are confirmed sent through ACKs.

If TCP doesn't receive an ACK because IP didn't deliver the packet, it resends the segment (same sequence number) and shortens the window size. The window size is how many segments it will send before getting an ACK back.

If the other end doesn't respond in a certain time (timeout), TCP closes it and tells the application the other end timed out.

till layer 3 it ll be connectionless and from layer 3 to layer 4 it ll follow certain path?

Connection is a layer 4 concept, so yes, everything 3 and below is "connectionless".

TCP only cares about segment numbers and not the path. The path could be from anywhere as long as it's the same IP + port. In this way TCP does its job and doesn't have to worry about anything above or below.

LawrenceC
  • 73,957
  • great answer..few more points needs to be clarified..acc. to model encryption or ssl takes place at layer 6 but i studied that ssl handshake happens after tcp connection, means coming down to layer 5, tcp connection established after that SSL Handshake happens, but SSL Handshake should happen in Layer 6..how does that happen? – shivaniverma6991 Oct 08 '19 at 18:20
0

TCP connections only ensure ordering and delivery, but they do not establish a fixed path at all. You might be confusing it with other circuit-based technologies such as ATM or X.25 (where a path is configured during call setup and all packets follow it).

Each TCP segment is sent as an IP packet, and IP makes routing decisions separately for each packet, again and again. Of course endpoint addresses remain static, but the path might even change in the middle of a connection, and TCP will not even notice the change happening.

u1686_grawity
  • 452,512
  • but acc. to OSI model encryption or ssl takes place at layer 6 but i studied that ssl handshake happens after tcp connection, means coming down to layer 5, tcp connection established after that SSL Handshake happens, but SSL Handshake should happen in Layer 6..how does that happen? – shivaniverma6991 Oct 08 '19 at 18:40
  • I'm trying to think of a good answer to that, but in the meantime I honestly think you should unlearn all of the theory you've learned and stop putting so much faith in the OSI model... – u1686_grawity Oct 08 '19 at 20:56
  • you got any answer regarding my above question? – shivaniverma6991 Oct 09 '19 at 08:48
  • First realize that layer order does not necessarily correspond to temporal order, because some layers or protocols might need a preparatory step before they could be used. For example, the TCP handshake is done as an explicit step before the application can try to send data. Very similarly, the TLS (SSL) handshake is also a separate preparatory step, and it's not initiated by a lower layer (TCP), it's initiated by a higher layer (the app itself). – u1686_grawity Oct 09 '19 at 09:40
  • Alternatively, you could say that it's TLS itself which initiates the TCP handshake before passing the actual data down to the TCP layer. – u1686_grawity Oct 09 '19 at 09:45
  • you mean connection initiation is done at application level and connection estalishment is done down the layer? – shivaniverma6991 Oct 09 '19 at 09:53