The following instructions will help you set up an encrypted mesh network on Raspberry Pi's. It takes about 15 minutes to set up a node with the Pi 3. Obviously, to have a mesh you will need more than one node.
The software also supports Debian running on x86 and x64 boards, and many board that run Armbian (such as many models of Orange Pi hardware family). The same installation steps can be followed, except you would flash the SD card with Armbian instead of Raspbian or have Debian installed onto the computer. See Hardware Table for the full list of supported hardware and check for board specific installation details in our Frequently Asked Questions.
Set Up
Make sure you have the following items:
Raspberry Pi Zero, 1, 2, 3 (Pi 3 recommended), or for advanced users other compatible hardware
Create an empty file named ssh to enable SSH when the Pi boots:
$ touch /path/to/sd/boot/ssh
Plug the SD card and USB WiFi adapter into the Pi.
Plug the Pi into your router so it has connectivity to the Internet. SSH into the Pi with ssh [email protected] and password raspberry.
Optional: There are other ways to connect, such as connecting the Pi to your computer and sharing Internet to it. If you have multiple Pi's connected to your router, find their IPs 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 address ssh [email protected].
Note: After the install the node will be renamed to tomesh-xxxx where xxxx is the last 4 characters of your CJDNS address. Before the reboot the node will notify you of what the name is.
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:
During the installation, you may be able to pick a profile, or choose between many modules. To learn what each module is for, look at MODULES.md. This is important for the installation.
There is also the contrib folder for software that has been contributed to the project, but which might not actually be maintained by the core developers.
Check Status
Give the Pi about 15 seconds to reboot and SSH back into it. You should find the status of your mesh node automatically printed. You can also print this anytime by running status.
Verify that cjdns Service is active, and Mesh Interface (if applicable). 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 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. See phillymesh/cjdns-optimizations for expected throughput.
Update & Uninstall
To uninstall the services, run ./prototype-cjdns-pi/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-pi directory along with the install script, then repeat the last installation step.
Experimental Support for Other Boards
We have added support for other single board computers such as the Orange Pi family of boards. So far all the boards that have been tested support Armbian and usualy our install script needs no modification to work. To use one of these boards start with the Armbian nightly images linked in the table below, then follow the same installation steps as the Raspberry Pi. Below is a table of boards we have tested and some metrics of what you can expect from the board.
To add a new module, use scripts/ipfs/ as an example to:
Create a WITH_NEW_MODULE tag
Create scripts/new-module/install and scripts/new-module/uninstall
Make corresponding references in the main install, install2, status, uninstall files
Notes
We keep a list of Frequently Asked Questions. Feel free to add to this list with the issues you experienced on your boards.
We have a Troubleshooting doc with information to point you in the right direction of some common problems.
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. You can now also install this prototype stack on debian/ubuntu PC hardware. This includes a Virtual Machine.
Original plan for this repository and early benchmark results are available in the doc folder.
请发表评论