this post was submitted on 09 Apr 2024
228 points (95.2% liked)

Asklemmy

43817 readers
883 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy ๐Ÿ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~

founded 5 years ago
MODERATORS
 

It's the one thing when I'm configuring things that makes me wince because I know it will give me the business, and I know it shouldn't, but it does, every time. I have no real idea what I'm doing, what it is, how it works, so of course I'm blindly following instructions like a monkey at a typewriter.

Please guide me into enlightenment.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] neidu2@feddit.nl 3 points 7 months ago* (last edited 7 months ago)

They're defined by the software that listens for incoming connections. For example, a web server will (by default) open a listening port on port 80, as that's what is defined in the http standard. If said server supports https (which most of them do) it will also open a listening socket on 443.

It's easy to reconfigure a webserver (or any other server) to listen on any other port instead, provided that it's not already claimed by a different server software. The only caveat is that any clients that want to connect will have to specify the correct port. For example, if the webserver is instead running on port 1234, you'd type http://example.com:1234/ in the address field.

Ports are identified by their number which is in the range of 1 through 65535. The first 1024 ports are "official", which can often be observed by the fact that most of the fundamental protocols that makes the internet function is in this range (http, https, ftp, ssh, dns, smtp, pop3, imap just to name a few). And on linux systems, opening a listening socket on a port below 1024 requires root privileges.

It's worth noting that no port number is "better" than any other. Port 2 will work just as well as 22222. It's just a way for a server to know which server software should receive the incoming packets.

A bit beyond what you're asking, but I consider it a natural furtherance thereof: you can talk to a webserver manually by using telnet. It's easy, I just don't remember the syntax in my head, but it's an easy question for google.