I think this is a pretty “newbie” question. I’m just hoping to understand a little better how ipfs networking works. Maybe someone can clarify the concepts involved, explain what I’m not understanding, or point me to some helpful article.
Here’s my question:
My understanding is that when I’m connected to an ipfs swarm, I’m connected to a bunch of peers listening (receiving requests from other peers) via port 4001.
But in my experience, in order to run a home web server hosted on a computer within my LAN, I have had to manually go into my home router and open port 80 (and then forward all request to port 80 to a specific MAC address). Otherwise, no outside computer can connect with the webserver.
Similarly, I have had to explicitly open port 22 to allow ssh into my home LAN. Otherwise the router blocks these requets.
But I certainly have not done this for port 4001.
And yet, when I request a hash via the ipfs gateway (ipfs.io/ipfs) for a unique file I’ve pinned to my local computer (within my LAN), the ipfs gateway is able to retrieve the data.
My understanding is that this gateway has found a peer that is eventually connect to a peer that is connected to me, and this “direct peer” is requesting that data from my computer via port 4001 and then passing it on.
So I’m wondering how that is possible? I would be grateful of any clarifications, corrections, or pointers to helpful reading.