After trying out Cosmos Cloud (and it not working for the clients), I’m back at square one again. I was going to install Docker Desktop, but I see it warns that it runs on a VM. Will this be a problem when trying to remote connect to certain services, like Mealie or Jellyfin?

  • foggy@lemmy.world
    link
    fedilink
    English
    arrow-up
    8
    ·
    24 hours ago

    Welcome to foggy’s IP, ports, and containers lesson, take a shot of espresso, we’re going in!

    special IP addresses:

    127.0.0.1 - “This same machine.” Talking to yourself. Also written as localhost.

    192.168.x.x - private home network range. What your router hands out to your devices. Not routable on the internet. 10.x.x.x - another private range. Bigger, used by businesses and some routers. Same idea as 192.168.

    172.16.x.x to 172.31.x.x - the third private range. Docker likes this one for its internal container networks.

    0.0.0.0 - “all interfaces” or “any address.” When a service binds to this, it means “listen on every network this machine is connected to.” Also sometimes means “no specific address” depending on context.

    255.255.255.255 - brosdcast. “Everyone on this network.” Rarely something you’ll type, but you’ll see it.

    169.254.x.x - link-local. What your machine assigns itself when it wanted a DHCP address from the router but didn’t get one. If you see this, something’s wrong with your network.


    Port talk:

    Ports 0-1023: well-known ports. Reserved for standard services. On Linux you need root to bind to these. The ones you’ll actually see:

    • 22: SSH (remote terminal access)
    • 53: DNS
    • 80: HTTP (unencrypted web)
    • 443: HTTPS (encrypted web)
    • 25, 465, 587: email sending (SMTP and variants)
    • 143, 993: email reading (IMAP)

    Ports 1024-49151: registered ports. Assigned to specific apps by convention. A sampling:

    • 3306: MySQL/MariaDB
    • 5432: PostgreSQL
    • 6379: Redis
    • 8080: common “alternate HTTP” port, used when 80 is taken
    • 8096: Jellyfin
    • 32400: Plex
    • 27017: MongoDB

    Nothing enforces these: they’re just conventions. You could run Jellyfin on port 7777 if you wanted.

    Ports 49152–65535: ephemeral ports. A neato part:

    When you connect to a servers port 443, for example, your machine connects to the server’s port 443, but it also needs a port on your end for the server to send replies back to. Your OS grabs a random unused port from this high range, uses it for that one connection, and releases it when done. Thus, ‘ephemeral’


    Containers? Sure:

    A container is a program packaged in a bubble. It’s basically a VM without the machine part. Let’s say you wanna run Jellyfin AND Plex. Let’s say tomorrow there’s a brand new video file format and Jellyfin supports it and Plex doesn’t. Jellyfin needs to use some new version of ffmpeg that Plex cannot use. The solution? Containers.

    Each program is containered with what it needs to run happily. Nothing more. Your machine does the rest.

      • foggy@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        13 hours ago

        If it’s a Linux box, everything over 1023 just needs root.

        For Debian flavors,

        /proc/sys/net/ipv4/ip_local_port_range

        At least for those I use. Idk for rhel etc.

        I can check my boxes with system ctl:

        sysctl net.ipv4.ip_local_port_range

        And tested on a VM, this wide s your ephemeral range:

        sysctl -w net.ipv4.ip_local_port_range=“1024 65535”

        Manage persistence in /etc/sysctl.conf

        I’ll be honest here, I asked Claude for the windows equiv of that. I haven’t tested. Proceed with caution:

        To check:

        netsh int ipv4 show dynamicport tcp

        To expand ephemeral range:

        netsh int ipv4 set dynamicport tcp start=10000 num=55535

        Syntax makes enough sense to me, but I repeat I have not vetted this.

        HOWEVER,

        all moot. You have 65k ports PER CONNECTION, holmes. Sorry I’m drunk now my tones changes and typos = more :)

        So you at 10.0.0.1 connect to Google at 8.8.8.8 and cloudflare at 1.1.1.1, you can use 130k connections between the two. So this isn’t as useful as you may think you need it to be (idk what you’re doing lol, load balancer?)

        If you’re churning through tons of short connections, you can “run out” of ports even though you have plenty… they’re all just cooling down.

        net.ipv4.tcp_tw_reuse=1

        lets the kernel grab them sooner.

        Claude says Windows would be

        HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\TcpTimedWaitDelay

        That’s a registry change. Proceed with extreme caution. Use a VM or throw away machine. I have absolutely not vetted the windows version here and registry edits are inherently dangerous. I usually yell at an AI that tells me to use regedit. Probably don’t do this unless the system is backed up and those backups are tested.

        Hope this helps your crazy load balancer or whatever :)

    • Hezaethos@piefed.zipOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      21 hours ago

      You should be a teacher. You made me go from despising Networking to interested in learning it more

      • foggy@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        13 hours ago

        Thanks! I hope it helped.

        I’m actually literally in the process of reaching out to my old Computability and Complexity professor who is now cs chair and cyber security lead for my alma mater. Wanna pitch him some ideas for me doing an adjunct in a cyber warfare lab 🤓