How to stop ipfs node connecting peers

Hi,

I’m trying to run the ipfs locally only, which don’t want it connect to any peers, so I did:

  • After creating the repo, I removed all the bootstrap peers before starting the daemon.
  • Blocked all incoming connections in the firewall.

It works fine, but as long as I start requesting some CID, e.g. ipfs dag get bafybeic4gops3d3lyrisqku37uio33nvt6fqxvkxihrwlqsuvf76yln4fm then it’s start connecting to peers.

Why is this happening? And how to stop it?

Thank you!

ipfs daemon --offline to make that at the daemon level (completely disable P2P)
ipfs dag get --offline for one single request (note this will not disable the background processes just make that request not able to reach the network and only access the local cache instead)

Thank you!

It works!

I’m still curious why, even if I block all the ipfs incoming connections, it can still connect with other peers?

How did you blocked incoming connections ?

Hi,

I’m using macOS (Ventura 13.4.1), and I’m using the build-in firewall to block the incoming connections, like this:

I don’t know about this, I use linux. My guess is that it does not block your node to contact other nodes.

Note if you want to do this from Kubo you can remove all addresses from .Addresses.Swarm in the config. This will remove al P2P listeners.

I’m not sure, but aren’t recent version of Kubo also using centralized indexers for lookups? Perhaps it is finding providers via non p2p ways, and connecting to them. Once it has connected to someone else, it will bootstrap itself to the rest of the network.

The DHT works even behind an input firewall because it’s your node opening the connection.