Options

Mixed up about port numbers?

killuminati1987killuminati1987 Member Posts: 17 ■□□□□□□□□□
At what layer are port numbers actually assigned? Sometimes it's presented as the transport layer's job, but at others it's presented as the session layer's job. At the end of the day, whose job is it really?

Comments

  • Options
    Forsaken_GAForsaken_GA Member Posts: 4,024
    I suppose it depends on which protocol you're talking about, but TCP and UDP operate at layer 4, and ports are an integral part of their operation, so their ports are also layer 4
  • Options
    killuminati1987killuminati1987 Member Posts: 17 ■□□□□□□□□□
    Sorry, what I meant was, at what layer are the destination and source port numbers actually assigned during the creation of a TCP/UDP session? For instance, I want to use FTP and need to access a web server, and destination port number is 21 and source port number is, say, 3633 during this TCP session. Which layer determines this assignment of port numbers?

    I understand, for the most part, which protocols operate at which layer, but what I don't understand is which layer assigns the actual source and destination port that are used during any one session.
  • Options
    Forsaken_GAForsaken_GA Member Posts: 4,024

    The application is what actually determines what source and destination port to use. Most applications default to a well known port, for example, FTP is traditionally port 21, so if you don't specify a port, it will default to that. The application then generates a random source port from the ephemeral port range. Some applications that do autodiscovery of ports may do it at a layer lower than 7, but for the most part, the destination port of any application that's going to act as a client has to be defined ahead of time, and likewise with the listening port on the server side.

    It's largely unimportant, though. OSI is a set of guidelines, not law, and the Net+ doesn't get that deep into OSI theory and methodology. That kind of question is more important for a developer than a network engineer
  • Options
    elderkaielderkai Member Posts: 279
    I agree with Forsaken. You're just overthinking it a little man. :) TCP and UDP ports are at layer 4 as the protocols themselves are at 4. There isn't a layer that universally handles "ports".
  • Options
    killuminati1987killuminati1987 Member Posts: 17 ■□□□□□□□□□
    Thanks guys. Yeah, sometimes I go way overboard trying to understand the concepts. lol
Sign In or Register to comment.