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

  • a_fancy_kiwi@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    1 year ago

    Imagine you need to go see your doctor. They work in a building with 65535 rooms. Some rooms are empty. Some rooms have people in them that provide different services. But you need your doctor so you look up their location.

    You learn the building address (IP address) and the room number (port)

    In practice, you attach services to specific ports so that other computers can access those services. Typically, http traffic is on port 80 and https is on port 443. So if you visit a website, you are likely connected to a server on one of those two ports. But it’s not a requirement. You could create a website and put it on port 2097, or 532, or 47210; it doesn’t matter.

  • intensely_human@lemm.ee
    link
    fedilink
    English
    arrow-up
    2
    ·
    23 days ago

    A port is like an apartment number. Except instead of apartments, it’s just mailboxes. Bob’s mailbox is number 25. If you want to get a message to Bob, uou write “box 25” on the address.

    A port number is just an additional piece of info that the operating system associates with a particular program. If something comes in on port 22, the sshd is going to handle it because it’s “listening on port 22”, meaning that it has registered itself with the OS as the recipient of anything that comes in marked “port 22”.

  • Aceticon@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    Imagine the computer as a shopping mall, which has a name and address (i.e the IP address).

    A port is a specific store in that mall, from were you can get specific things.

    The analogy even holds further in that for certain “stores”, the same store by name of certain chains (i.e. Burger King) will provide the same service in different malls if its present there (for example, port 80 is were the HTTP service is, by convention) and the same kind of service can be provided in other stores (nobody stops you from having an HTTP service on a different port).

    Were the analogy breaks is that unlike with chain store names (which are protected by trademark) there really is no enforcement that a certain port has a certain service (i.e. you can put whatever service you want on port 80 of a computer you control) and certain services being in certain ports is merely a convention.

  • Rikudou_Sage@lemmings.worldM
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Imagine your network card is a house. That house has an address (IP address in this case) and to get into the house you need doors (ports). The house is pretty big so it has exactly 65,535 doors (ports). But because the owner of the house is not insane, most of the doors are locked (firewall).

    When something communicates with you (or you with something), you use a port. For example when you open a webpage, your browser sends a request to the server on port 80 or 443 (80 for http, 443 for https). Those are standardized ports which have a well-defined meaning, but in general you only need the client (browser, app, whatever) and server to use the same port for the service.

    Let me know if that clears it up!