IPFS nodes hosted from a home network via port 4001

Some noob setup questions. TIA for assistance.

I want to set up four separate IPFS nodes on my home network and expose them all to public IPFS peers.

So I’m using my ISP’s router and sitting behind a NAT. I successfully configured my first node using the port forwarding instructions here https://docs.ipfs.io/how-to/nat-configuration/#port-forwarding

So now port 4001 is exposed and serving CIDs. I’ve tested their retrieval via public gateways. Super.

Now, can I assign ports 4002, 4003, and 4004 (or other?) to the other three nodes (each with their own internal IP on my home network) or does IPFS only work with port 4001?

Also, I’ve got a basic home internet plan which means I have a dynamic IP for my router. I’m assuming that’s not an issue for IPFS because my peer broadcasts its IP (including when it’s changed) whenever it pings the network? Is that right? Or do I have to set up Dynamic DNS somehow to make sure these IPFS nodes stay accessible?

1 Like

Edit .ipfs/config to change it (Addresses/Swarm).

Can you check that ipfs id actually shows an address with your /ip4/external_ip/tcp/4001 ? Ipfs also uses uPnP to setup port forwarding automatically in your router.

Should be ok for the most part, since they don’t change very often. Imho, when uPnP does not work, DDNS is best along with hardcoding the DNS addresses in Addresses/Announce as /dsn4/domain/tcp/4001 etc. That is the best way to ensure that your peer tells everyone else that they are reachable on that specific address.

1 Like

Hey @hector, thanks so much for your reply. Exactly the info I need.

Edit .ipfs/config to change it ( Addresses/Swarm )

Got it, thanks.

Can you check that ipfs id actually shows an address with your /ip4/external_ip/tcp/4001 ? Ipfs also uses uPnP to setup port forwarding automatically in your router.

Hmm, no it doesn’t. So something is not right here?

ubuntu@ubuntu:/media/usb0$ ipfs id
{
	"ID": "QmfXZsUcf19JHkdVHVq7A3SishsSxpV4MNWy3fSFqysoYv",
	"PublicKey": "CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDQmS/AtvWNkGRK+E2i9btAZaXnWUf1YR3+4hQRntYGLms98Plicyo+PiexfY9KxVm2UYkViMKpdIZ4MuIbkuoTq63WmIMc8uzDlbm97etVQz6eOoTojP+lz+uLER7v4F6s3i/Mh9I9gcP6ka9qFRsBzXLORX3RvCTR9JPn9r0ptOQAH8mH3qKsaKZe1dUjIQD+nfRmJ/5LVMza5Av7/sgzKGFyIUS1a+jN/PEMZHvY6qHPaoGD6rMFXOmreSxjO1NU/DVoLwXMKdo0BrITMjIDCRzFv/2coz5sv3nBNU34+sDQu+cl0CCO4ByW0O1BWOZoN1/PJIiizZ1EWG8ku2V/AgMBAAE=",
	"Addresses": null,
	"AgentVersion": "go-ipfs/0.7.0/",
	"ProtocolVersion": "ipfs/0.1.0",
	"Protocols": null
}

RE: DDNS. My Router and ISP don’t allow uPnP.

Should be ok for the most part, since they don’t change very often. Imho, when uPnP does not work, DDNS is best along with hardcoding the DNS addresses in Addresses/Announce as /dsn4/domain/tcp/4001 etc. That is the best way to ensure that your peer tells everyone else that they are reachable on that specific address.

Okay, I think I will set up DDNS anyway to be sure. So /dns4/<**example.com**>/tcp/4001 ?

Please start your ipfs daemon before running that.

Yes, that should work. You may also want to hardcode your LAN IP/port in that list.

Please start your ipfs daemon before running that.

Haha, doh! So yes, it actually does show an address now. Interestingly, though, it’s choosing to use the WLAN instead of ETH0 port on that node. I guess I can change that by forcing the address using Announce:? I’ll try that.

ubuntu@ubuntu:~$ ipfs id
...
    	"Addresses": [
    		"/ip4/10.0.0.175/tcp/4001/p2p/QmfXZsUcf19JHkdVHVq7A3SishsSxpV4MNWy3fSFqysoYv",
    		"/ip4/10.0.0.175/udp/4001/quic/p2p/QmfXZsUcf19JHkdVHVq7A3SishsSxpV4MNWy3fSFqysoYv",
    		"/ip4/127.0.0.1/tcp/4001/p2p/QmfXZsUcf19JHkdVHVq7A3SishsSxpV4MNWy3fSFqysoYv",
    		"/ip4/127.0.0.1/udp/4001/quic/p2p/QmfXZsUcf19JHkdVHVq7A3SishsSxpV4MNWy3fSFqysoYv",  
...

Yes, that should work. You may also want to hardcode your LAN IP/port in that list.

Okay, cool, thanks.

Right, but not those are local/LAN addresses, not the WAN one. The WAN one only appears (and is announced) after it has received some connections, but people don’t know they can connect there because it is not announced in the first place (unlike upnp addresses). This is why I hardcode the DDNS address in Announce.

Okay, yeah, it does have a WAN address too but I didn’t want to post my home IP here :slight_smile: But yes, will hardcode DDNS address here too. Just got that working.

1 Like

BTW, when I checked my IPFS daemon output I noticed that it says the Swarm was listening on the ETH0 port as well, but it only ‘announced’ on the WLAN port. I’m going to disable WLAN on that node and see what happens.

Yeah, that worked. Now it’s announcing the ETH0 ports (for which I have set up the port forwarding).

What is /ip4/10.0.0.158/udp/4001/quic?

udp? quic?

Okay, I think I’m in business here. Listening on the right (ETH0) port, announcing with my DDNS address.

Thanks very much for your help @hector Is there a ping/hello world test you can recommend to verify that I’m truly operational?

QUIC protocol, works on top of UDP (means you need to open udp:4001 too).

You can ask random people here or on IRC to run ipfs ping <yourPeerID>. It you are running, it should be able to resolve your public address from the DHT and contact your peer. You can run it yourself too if you have a VPS etc.

Зачем использовать 4 узла, если можно делать несколько сайтов на одном?
ipfs key gen --type=rsa --size=2048 onemorekey
ipfs name publish --key=onemorekey /ipfs/ещё-что-то