I often see that network settings have a field for logical port. What is this field.referring to?

  • @TheBananaKing
    link
    English
    281 year ago

    One network interface has just one IP address, but it can have a bunch of different programs listening and talking.

    A server might have both a webserver and a mail server running on the same machine - and they don’t want each other’s network traffic.

    So you mark each packet with a destination port number, to let the server work out which program you’re talking to.

    Your web browser will mark all its packets with port 80 or port 443, and when the server gets those, it knows it’s web traffic, and passes it to the webserver software.

    Your email client will mark all its packets with port 25 or 993, and when the server gets those, it knows it’s email traffic, and passes it to the mailserver software.

    Typically each separate kind of network service will have its own well-known port number assigned to it.

    There’s also a source port field on packets, so that your computer can get return traffic back to the right program running on your machine.

    • Andrzej
      link
      fedilink
      41 year ago

      Ok I have a follow up question if you’ll indulge me - why those numbers in particular?

      • iByteABit
        link
        fedilink
        51 year ago

        No reason, they’re conventions. Check out this list and you’ll get a better idea. It’s simply a number that the developer assigns without a particular meaning. It’s kinda like telephone help lines, one thing that a developer might want to try is to find a pretty memorable number while trying to avoid conflicts with other programs running at the same time.

        • PupBiru
          link
          fedilink
          11 year ago

          id say your telephone number example can be extended:

          1800 is for free numbers, but why? no particular reason, just that’s the number that got chosen at some time… same with port 80 being HTTP: that’s just the number that got chosen!

          you can also have an HTTP server running on port 25 (usually mail); it’s just bad practice… just like there’s no reason why your phone company couldn’t make a regular phone number toll free!

          what’s pretty normal though is running an HTTP server on say, port 5000: this is just for more technical users though, because you have to know the port; your browser doesn’t “remember” it for you

      • TechyShishy
        link
        fedilink
        11 year ago

        Mostly history. Numbers were chosen rather than other identifiers because they were simpler to use over the wire back in the day when the protocol was written when every bit cost, and nobody at the time could imagine a single physical machine managing more than 65535 programs at the same time, since that was how you conventionally hooked things up. The IANA (International Assigned Numbers Authority, https://iana.org/) is responsible for maintaining a list of “registered” numbers, but those are largely by convention, not by requirement. Web browsers associate https traffic with port 443 by default, but as a developer, we can set up a webserver on port 50443 and send our browser to if we specify that number explicitly. It just wouldn’t know about it by default.

        Nowadays, with virtual machines, NAT subnetworks, and the absurdity that is involved in port-per-transaction networking (We’re looking at you nginx proxy frontends), it’s gotten a bit congested. Fortunately, IPv6 has relieved quite a bit of that, and we now have a much larger pool of 2x(IP/Port) quads to draw from, but it was a real issue there for a while.

    • Brkdncr
      link
      fedilink
      21 year ago

      For convulsion’s sake, one network interface can have more than one ip.

      • BaroqueInMind
        link
        fedilink
        11 year ago

        For convulsion’s sake

        Yeah… Networking makes me want to hurl and puke sometimes as well.