November 9, 2024

How to install a CJDNS node on Debian 12

cjdns network map

CJDNS is a mesh network technology developed by Caleb James DeLisle (aka CJD). This software aims to make it easy and simple to build mesh networks that are IPv6 compliant and fully encrypted.

At the time of writing, there are currently about 340 active nodes world wide. Some of these nodes are hosting websites and other resources that can only be accessed if you are connected to the network. You can find a visual representation of the current active network here: https://routeserver.cjd.li/

If you want to become a part of the network or learn how to gain access to the network, you are in the right place. This article will walk you through the process of setting up a FULL CJDNS node on a simple Debian 12 server.

Part 1: Installation Instructions

Step 1: Install Rust

First you need to install Rust. You can accomplish this by running the following:

sudo apt install curl

followed by

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Additionally you can learn more about installing Rust on the main website.

https://www.rust-lang.org/tools/install

Step 2: Install Nodejs and other dependencies

Next we need to install Nodejs plus a few other dependencies.

sudo apt install nodejs git build-essential

Step 3: Download the latest source files from the github repository

At this point we are ready to download the CJDNS source files. You can clone the repo into your server by running:

git clone https://github.com/cjdelisle/cjdns.git cjdns

Once the clone has completed, you want to change directory into the folder you just created when cloning the repo. You can change the directory by executing the command below.

cd cjdns

Step 4: Build CJDNS

Now that you are inside the directory you want to build the program by running:

./do

This will initiate the build process.

Step 5: Generate a CJDNS conf file

Before we can start the node software, we need to generate a conf file. This will be the main configuration file for the node and provide us with a ipv6 address for our node. This is also where you will add the node information of the nodes you want to connect to.

sudo ./cjdroute --genconf >> cjdroute.conf

Step 6: Starting/running the node for the first time!

Now we are ready to to start the node software. You can do so by executing the following:

sudo ./cjdroute < cjdroute.conf

If you want to save the output of the node in a log file you can start the software by executing the following:
sudo ./cjdroute < cjdroute.conf > cjdroute.log

To stop the node you execute the following:
ps aux | grep cjdroute
This command above will help you find the process id (or pid) of the cjdroute process. You will see an output like this:

 

In this output above, the pid of cjdroute is 55885. So to stop the program you will execute:

kill 55885

Replace the number above with the pid number you see in the output of your server after running the ps aux command.

For more advanced users, you can create a systemd file so you can use the OS provided daemon management systemctl which will make it easier to start, stop and restart the service. That however is beyond the scope of this tutorial.

At this point you have successfully installed the CJDNS node software on your server. However, we are not quite done yet! Now we need to connect our node to another node on the network in order to be able to access the resources on the network.

Part 2: Connecting/peering with another node on the network

Before you proceed with the following steps, make sure that your node instance is not running. You can stop the software following the instructions above.

Step 7: Edit your cjdroute.conf file and add a node to connect to

Once you have made sure your node isn’t running, you can proceed. First, you want to go into your cjdns directory (if you’re not already in there).

cd cjdns

Once you are inside the directory, you want to edit the cjdroute.conf file. You can use your favorite file editor here (nano, vi, vim..etc). In this case we will use nano.

nano cjdroute.conf

After you execute this command, you will be able to see the contents of the file and you will also have the ability to edit it.

Important Note
When you open the file you will see these lines seen below. These are very important.

The “ipv6” string is your node’s auto generated ipv6 address. This is what other nodes on the network will use to connect to your node. This address is not accessible from the general internet. This address is only accessible when you are connected to the cjdns network.

Now that we got that out of the way, lets proceed with adding a node to connect to which will connect/add our node to the network. You will want to scroll down on the file until you reach the part of the file labeled “connectTo”. It should look like this screenshot below.

Here is where you will add details to the node you want to connect your node to. You might be wondering, where can I find connection details for other nodes to connect to? There is this repo here:

https://github.com/hyperboria/peers.

The peers or nodes are separated by geographic zone. In that repository you will see folders.

For example, in the image above you see a folder named EU (European Union) and NA (North American) and so on for all other areas of the world. For the sake of this example, we will be clicking on NA for North America.

Inside of this folder you will see 2 folders. CA for Canada and US for United States. We will be clicking on the US folder.

In this folder you will now see some folders with states that are a part of the US. We will be clicking on the newyork folder.

At the time of writing, there is one file in this folder. Click on that file to view the details of this node that is located in NY, USA.

We see in this file two code blocks. They both are used to connect to the same node. One will allow you to connect to the node via its IPv4 publicly routable ip address the other is to connect via its IPv6 publicly routable ip address. For this example we will use the IPv4 code block.

We will copy this code block and add it to our cjdroute.conf file.

This is what it will look like when you add the node information to your configuration file. You can add multiple nodes to your config if you so desire. In this example we will only be adding one.

Step 8: Start your node after configuring a peer

Once you have added the node information to the configuration file, save the file and exit the editor. At this point you are now ready to start your node.

sudo ./cjdroute < cjdroute.conf

This is what it looks like when your node stats up successfully. At this point we should now be connected to the cjdns network. We can actually perform a test to see if our connectivity to the network is working. We can ping an address on cjdns to verify our connectivity.


In this example we have pinged a service on the network and we are seeing a ping response.

Below are a few organizations that provide services on the CJDNS network.

PKT World operates the PKT World explorer on CJDNS along with other services like a public Electrum server.

IP: fcb0:17ef:1b11:c5e8:9a9c:676f:90e3:4033
HTTP: http://[fcb0:17ef:1b11:c5e8:9a9c:676f:90e3:4033]

Packetscan.io also is available over the network.

IP: fc77:61da:bdf1:cec9:f940:55f:b325:4ac4
HTTP: http://[fc77:61da:bdf1:cec9:f940:55f:b325:4ac4]

Congratulations you are now a part of the of the network and now have access to all of the resources available on it!