I have a big local network, where i need to distribute some file. Right now scp is used to upload files from server to destination node. The problem is, that some devices in local network have very poor connection, so scp fails with some timeout with a very big chance.
The common idea is to replace it with a some p2p mechanism, when there is some node in local network, that has source file and this node became some kind of seeder.
This node provide hash of seeding file, which is sent to other devices in local network. Other devices start downloading and distribute this file over whole local network. Important note: every time i need to distribute file, different node could be selected as source one.
Problems to solve:
Avoid wan overhead in terms of frame size;
Avoid failing on timeout.
Questions:
Is that possible with IPFS? If not, is there any p2p alternatives?
It seems that i donāt need bootstrap lists, because all peers iām interested in are behind firewall in my local network. Will IPFS work properly without bootstrap list? Is that possible to somehow discover peers in local network?
Is there a way to tell IPFS search for peers only in local network?
Seems like it would work for transferring files reliably, but you will another way to start the download on each node. I gather you have ssh access to the nodes, so that should be sufficient. Do the following after setting up your private IPFS swarm.
on the source node:
$ ipfs add filename.ext
QmSomehashNr3MHLhNbyXSdebCXCfVd6UbNr3MHLhNbyXs # This is $HASH below. Each file is different
on each destination node:
$ ipfs pin /ipfs/$HASH
$ ipfs cat /ipfs/$HASH > filename.ext
When finished, you may go back around and unpin the file from all the nodes.
$ ipfs pin rm /ipfs/$HASH
You will need to provide your own list of bootstrap peers instead of the default list that ships with IPFS. On each node you want to be a bootstrap node, select one or more of the lines listed under āAddressesā in the output of the following command. The nodes will need to have network connectivity to the address you chose.
$ ipfs id
Then on each node, remove the existing bootstrap set.
$ ipfs bootstrap rm --all
Then for each of the bootstrap addresses do this:
$ ipfs bootstrap add $ADDRESS
When you are done, check that you have all the addresses you want and nothing else.
$ ipfs bootstrap list
Configuring your own set of bootstrap peers does most of that. I think you will also need to disable MDNS discovery to keep IPFS nodes not setup by you on the local network from polluting your peer table.
I think @teknomunkās suggestions are mostly right, but Iād add in a couple caveats.
If you donāt want to deal with the hassle of setting up your own bootstrap nodes, your network supports MDNS, and the number of peers on your network isnāt huge (e.g. itās a few hundred) I donāt see why you couldnāt just use MDNS. If you actually setup a private swarm your node will not be able to successfully talk to any public IPFS nodes even if you learn about them through MDNS, they directly connect to you, etc.
If your local network is actually segregated from the public internet you probably donāt need to worry about private swarms since your network is already segregated. However, especially if the information in your network is sensitive, itād be good practice to setup a private swarm.
An additional note is that you could utilize the libp2p pubsub layer available via IPFS to let your nodes send out when they get a new file so that the other nodes on the network can start requesting it. There are also some other tools built on top of IPFS and libp2p such as Textileās Threads that could help you out with mutability/updating concerns.
Iām doing a similar thing where Iām planning to use MFS (Mutable File System) as the backbone for a āfederatedā platform where each instance on the network will maintain itās own complete set of certain MFS file structures (directory trees),
Iām hoping that using the MFS Copy command (like below) will have similar behavior to ārsyncā insofar as the ability to only copy mostly just changed data when āre-syncingā a across two nodes that are already nearly up to date (as a result of how chunking works). My assumption is that any files that didnāt change at all, for example, would result in zero transfer/storage during the copy operations. Iām hoping to issue just one copy command on the root of the folder structure, and let the ārecursiveā copy completely to the equivalent of an rsync.
Iām posting here since it is directly related to the above, and may help the OP, but also because I had this question of āam I crazy or notā. to try that. lol.
curl -X POST "http://127.0.0.1:5001/api/v0/files/cp?arg=<source>&arg=<dest>"
@adin, thank you! Iāve succeed to install ipfs over my local network. But what i donāt really like is that i should add bootstrap nodes to a new device in that network so it was able to find peers. Is there any automatic discovery mechanism supported by IPFS?
@MetalRex101 as was mentioned above the two main peer discovery systems in go-ipfs are MDNS and the DHT. The DHT requires some bootstrap peers from which to join the network and MDNS uses local discovery (e.g. think of how your computer can locate a smart tv or wireless printer https://en.wikipedia.org/wiki/Multicast_DNS).
If you have MDNS enabled in your config file (itās enabled by default) and your network supports MDNS (sometimes place like university networks, hotels, or VPN networks block it) then local discovery will work just fine. For example, on my home network I can create a new node on my laptop and remove all the bootstrappers and itāll find the node on my desktop. If youāre having issues with MDNS you may need to look into how your network is setup.
Note, as mentioned above if you do not segregate the networks by using a private swarm key then you could end up joining the rest of the world unless your network is totally isolated. For example, in the above scenario because my desktop is running the default go-ipfs what happens is my laptop actually discovers not just my desktop peer but the rest of the network too because the DHT ends up bootstrapping from my desktop automatically.
Hello! Sorry for bumping the old thread but I have a similar question with respect to js-ipfs. Let me know if I better create a separate thread for it.
I have a nodejs and a go IPFS (IPFS desktop app on Ubuntu) nodes running locally on my machine but the node started in browser canāt see any of them. Could it be that an IPFS node running in browser canāt have local peer discovery?