This repository provides a Containerlab project for setting up a private IPFS network. The network consists of 3 IPFS nodes and 3 routers.
git clone https://hydrokhoos/priv-ipfs.git
cd priv-ipfs
Note: Go needs to be installed first.
go install github.com/Kubuxu/go-ipfs-swarm-key-gen/ipfs-swarm-key-gen@latest
mkdir PC
touch PC/swarm.key
$(go env GOPATH)/bin/ipfs-swarm-key-gen > ./PC/swarm.key
Note: Ensure you have Containerlab installed.
sudo clab deploy -t priv-ipfs.yaml
docker exec clab-priv-ipfs-PC1 ipfs swarm peers
# Should return nothing initially.
./addBootstrap.sh
added /ip4/192.168.12.2/tcp/4001/p2p/12D3KooWLq1iApFjaWd2shtC2rUNNGAhvd5gFKHYEdYMCLLAE2qv
added /ip4/192.168.13.2/tcp/4001/p2p/12D3KooWKRVxsh1JgcxeHW7k7URRoemrfHKYcoZ9qzyTAhdCQwz6
Note: This step might take a little time.
docker exec clab-priv-ipfs-PC1 ipfs swarm peers
/ip4/192.168.12.2/tcp/4001/p2p/12D3KooWLq1iApFjaWd2shtC2rUNNGAhvd5gFKHYEdYMCLLAE2qv
/ip4/192.168.13.2/tcp/4001/p2p/12D3KooWKRVxsh1JgcxeHW7k7URRoemrfHKYcoZ9qzyTAhdCQwz6
docker exec clab-priv-ipfs-PC1 sh -c 'echo "Hello, world!" | ipfs add'
14 B / ? added QmeeLUVdiSTTKQqhWqsffYDtNvvvcTfJdotkNyi1KDEJtQ QmeeLUVdiSTTKQqhWqsffYDtNvvvcTfJdotkNyi1KDEJtQ
docker exec clab-priv-ipfs-PC3 ipfs cat QmeeLUVdiSTTKQqhWqsffYDtNvvvcTfJdotkNyi1KDEJtQ
Hello, world!
docker exec -it clab-priv-ipfs-PC1 bash
./pub_testcontents.sh
docker exec -it clab-priv-ipfs-PC2 bash
./get_testcontents.sh
Measurement results are saved in clab-priv-ipfs-PC2:/ipfs-find-provs-peer.csv
docker cp clab-priv-ipfs-PC2:/ipfs-find-provs-peer.csv .
sudo clab destroy -t priv-ipfs.yaml