prototype-cjdns-pi2
The following instructions will help you set up an encrypted mesh network based on Raspberry Pi 2's and 3's. It takes about 5 minutes to set up one node. Obviously, to have a mesh you will need more than one node.
Set up
-
Make sure you have the following items:
- A Raspberry Pi 2 or 3
- An SD card that works with the Pi
- A TP-LINK TL-WN722N
-
Flash the SD card with Raspbian Jessie Lite.
-
Create an empty file named ssh to enable SSH when the Pi boots.
-
Plug the SD card and TL-WN722N into the Pi.
-
Plug the Pi into your router, so it has connectivity to the Internet. SSH into the Pi with
ssh pi@raspberrypi.local
and password raspberry.Optional: There are other ways to connect, such as connecting the Pi to your computer and sharing Internet to it. Or if you have multiple Pi's connected to your router, find its IP with
nmap -sn 192.168.X.0/24
(where 192.168.X is your subnet) and SSH to the local IP assigned to the Pi you want to addressssh pi@192.168.X.Y
. -
In your SSH session, run
passwd
and change your login password. It is very important to choose a strong password so others cannot remotely access your Pi. -
Run the following, then let the installation complete. After about 5 minutes the Pi will reboot:
$ wget https://raw.githubusercontent.com/tomeshnet/prototype-cjdns-pi2/master/scripts/install && chmod +x install && ./install
Optional: If you have a TP-LINK TL-WN722N and want to configure it as a 802.11s Mesh Point interface, set the
WITH_MESH_POINT
flag totrue
.Optional: If you have a Raspberry Pi 3 and want to configure the on-board WiFi as an Access Point, set the
WITH_WIFI_AP
flag totrue
. The default configuration routes all traffic to the Ethernet porteth0
.Optional: If you want to install IPFS, set the
WITH_IPFS
flag totrue
.To install with all optional features:
$ wget https://raw.githubusercontent.com/tomeshnet/prototype-cjdns-pi2/master/scripts/install && chmod +x install && WITH_MESH_POINT=true WITH_WIFI_AP=true WITH_IPFS=true ./install
Check status
-
Give the Pi about 15 seconds to reboot and SSH back into it, then check the status with:
$ ./prototype-cjdns-pi2/scripts/status
-
Verify that the Mesh Interface and cjdns Service are both active. The NODE section should display a single IPv6 address, that's the identity of your Pi in the cjdns mesh. The PEERS section should indicate a list of IPv6 addresses that are active peers to your node. This list will be empty, until you have another nearby node with the same set up.
Network benchmark
You can benchmark the network throughput with more than one node. Let's name our two Pi's Hillary and Friend.
-
SSH to Friend and run
./prototype-cjdns-pi2/scripts/status
, note its IPv6. -
Run
iperf3 -s
to start listening. Do not end the SSH session. -
In another Terminal session, SSH to Hillary and run
iperf3 -c FRIEND_IPV6
. You should start seeing Hillary sending encrypted packets to her Friend. On a Pi 2, we can expect about 14 Mbps throughput, and 40 Mbps on a Pi 3.
Update & Uninstall
To uninstall the services, run ./prototype-cjdns-pi2/scripts/uninstall
.
If you are updating, run the same uninstall script, but keep all configuration files and data directories when prompted, remove the prototype-cjdns-pi2 directory along with the install script, then repeat the last installation step.
Notes
-
Your computer can be a node too! It will mesh with the Pi's over your router. See the cjdns repository on how to set this up.
-
Plan for this repository and detailed benchmark results are available in the doc folder.