10

I've read that the session layer is also called the ports layer, and a CBT nugget video implied ports were a layer 5 thing.

I always thought they were layer 4, just because I guess. (well and tcp and udp have the ports)

Strangely I don't get much for results on this, maybe it doesn't matter.

5 Answers 5

11

TCP or UDP ports are defined in either layer 4 of the OSI model or layer 3 of the TCP/IP model, both are defined as the 'transport' layer.

OSI layer 5 'session layer' uses the ports defined in layer 4 to create sockets and sessions between communicating devices/programs/etc.

The result I got from Google that actually mentioned 'Ports Layer' is a completely incorrect page on a known link-farming site, so take it with a grain of salt. I don't know why CBT would refer to layer 5 with that name, but I don't have the video to watch.

2
  • There's a 3- and 4- layer version of the TCP/IP model. It's a good practice to say which one you're referring to.
    – Hack-R
    Sep 21, 2017 at 18:29
  • 1
    Can you link the 3-layer TCP/IP model? That's a new one to me.
    – cpt_fink
    Jun 1, 2018 at 5:58
8

Layer 4 - Transport layer. This is the layer charged with handling end-to-end communication; be it reliable or unreliable.

You'll frequently find that most networking concepts don't fit neatly into the OSI model.

1

I believe that after watching some more vids (Keith Barker), that it's one of those things that doesn't fit perfectly into the OSI model. I'm still leaning towards layer 4 as the primary layer for dealing with ports, but layer 5 definitely has a role there.

1
  • 2
    Nothing in the OSI model is perfect, it's just a reference framework to be able to separate functions into problems that can be troubleshot and solved semi-independently. Plus the layers have to interoperate with the layer above and below, so some coordination between layers is required.
    – cpt_fink
    Mar 5, 2015 at 5:34
-2

This is my own understanding regarding Ports:

The Ports are defined in the 5th layer of the OSI model which establishes and controls the dialogue between the source and destination. Port definition is done in the diaogue establishment process.

In the TCP/IP model, Layers 5,6 and 7 of the OSI model are included into one Layer (Layer 4 of the TCP/IP model).

So to answer your question, it all depends on the model you are considering. if you are using the OSI model, "Port" is a layer 5 definition, otherwise if you are using the TCP/IP model it will be considered as a layer 4 entity.

P.S.: for a more specific and maybe more correct answer you should take a look at the OSI model basic definitions in the ISO/IEC 7498-1 (Link Here)

Cheers,

3
  • 1
    The port number specified in Layer 4 provides information to Layer 5, but the port number is not defined in Layer 5. This is illustrated in your link on page 40.
    – cpt_fink
    Mar 3, 2015 at 6:20
  • Port addresses are part of the TCP header and are encapsulated to the PDU (Protocol Data Unit) in Layer 4.That proves your point. but explicitly where does the raw data (later to be written into the TCP header as port address) come from? They are part of the PDU formed on Layers 7,6,5 right? I mean, the machine doesn't write what he wants to write in the 16bit allocated to port addresses, it must come from somewhere... P.S.: I might be wrong, but it intrigues me Mar 3, 2015 at 10:19
  • 1
    PDU's are dependent on the layer, so the Layer 4 PDU is the segment which is encapsulated with the [UDP|TCP] port number and then passed down to Layer 3 for IP encapsulation. The actual address that is used depends on the initiating machine (source port) and the service being called upon (destination port + IP).
    – cpt_fink
    Mar 4, 2015 at 5:05
-4

Layer 4 in the TCP/IP model, but of layer 5 in the OSI model.

Not the answer you're looking for? Browse other questions tagged or ask your own question.