Home > Documentation > intermediate

Janmesh - Linux Documentation

Make sure you read beginner documentation to know what we'll talk about here.

Intermediate tutorial n°1: Share the internet connexion with a computer that is only connected to Janmesh

Voodoo computing warning The author of this tutorial achieved to make things work but does not fully understand how or why. Use at your own risk.
We got two Janmesh nodes, connected together through CoOoOw mesh-local wifi. Both got the /etc/init.d/janmesh script installled. If you're not sure to know what this mean, please refer to the beginner's tutorials.
One station is the "client", whishing to have internet access. The other station has internet access through Ethernet (eth0) and whishes to share this access with the client.
The first thing to edit is the two /etc/cjdroute.conf files on each computer.

$ sudo nano /etc/cjdroute.conf
Locate in this file the "publicKey" for each one. We'll need them.

On the gateway, look at the output of the
command and take note of the "adr inet6" given for the "eth0" interface.
We want the adress of the form 111:1111:1111:1111:1111:1111 and NOT the "/64" or whatever mask (number) is used.
then on the gateway, give credential to the client, by editing gateway's cjdroute.conf this way:
in the section "router > iptunnel > allowedConnection" edit the section this way
//  It's ok to only specify one address.
                 {      //anduril access
                     "publicKey": "herepastethePublicKeyoftheclient.k",
                     "ip6Address": "1111:1111:1111:1111:1111:1111:1111",
                     "ip6Prefix": 0,
                     "ip4Address": "",
                     "ip4Prefix": 0

As you can see, you have to edit "publicKey" and "ip6Address" with the numbers that you were asked to keep at hand previously.
Then on the client, indicate that we want to link with the gateway:
in the section "router > iptunnel > outgoingConnections", on a new line, add the following:
With the public key of the gateway that you got previously.
Then we gonna edit the /etc/init.d/janmesh startup scripts on both machines to set the correct routing and adresses upon start of the Janmesh service.
1111:1111:1111:1111:1111:1111:1111 still refer to the adress you took note of previously.
On the gateway:
case $1 in 
                /usr/bin/nmcli con up id janmesh;
                /usr/bin/cjdroute < /etc/cjdroute.conf;
                ip -6 addr ad dev tun0 1111:1111:1111:1111:1111:1111/64
                ip addr add dev tun0;
                ip route add dev tun0;
                ip -6 route add dev eth0 1111:1111:1111:1111:1111:1111:1;
                ip -6 route add dev tun0 1111:1111:1111:1111:1111:1111/64;
                ip -6 route add default via 1111:1111:1111:1111:1111:1111;
                iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;
                iptables -A FORWARD -i eth0 -o tun0 -m state --state RELATED,ESTABLISHED -j ACCEPT;
                iptables -A FORWARD -i tun0 -o eth0 -j ACCEPT;;

                /usr/bin/killall cjdroute;
                /usr/bin/killall olsrd;;
		/usr/bin/nmcli conn down janmesh;;
NOTE THE TRAILING ":1" on the line ip -6 route add dev eth0 1111:1111:1111:1111:1111:1111:1;
And on the client:
case $1 in 
                /usr/bin/nmcli con up id janmesh;
                /usr/bin/cjdroute < /etc/cjdroute.conf;
                sleep 25;
                ip route add via;
                ip route add default via;;
                /usr/bin/killall cjdroute;
                /usr/bin/killall olsrd;
		/usr/bin/nmcli conn down janmesh;

DNS configuration

You'll have to know the IPv4 adress of your home modem/router (box provided by your ISP), which could be, say,,, or whatever ! Good luck (or alternatively you can make use of any other online public DNS server's IP address). Indicate it by editing
this way:
replace the dot-separated numbers with the actual address of your internet box.

You're done. Once Janmesh service relaunched on both computing devices, you should be able to ping google.com or whatever from the client, starting from now.
The "sleep 25" seems mandatory, since adresses not associate instantly when the network is brought up. If you got an error message when running /etc/init.d/janmesh starton the client, wait for one second or two and retry, generally it's enough.
Licensing: this tutorial is placed under two licenses. Code is placed under AGPLv3 license. Other text content here is licensed under Creative Commons BY-SA 4.0 license. Authors are : Shangri-l