Mesh/WalkThrough

From Sudo Room
Jump to navigation Jump to search

This a walkthrough for flashing a node with the sudomesh firmware and then configuring it with makenode. At the end of the walkthrough, you'll be able to plug in your router and join the mesh. The walkthrough assumes you're using a linux-ish (OSX should mostly work) OS and that you have basic knowledge of the terminal. The basic idea of getting a node (router) on the mesh consists of flashing (copying files to flash memory) an operating system to the node and then using a software configurator finish setup.

If you do not want to use a per-compiled OpenWRT image, you can build your own from scratch using this how to: Mesh/Build An OpenWRT Image

Before you flash your router it is recommended that you read the Home node info to find out the router works as a mesh node.

Preparing Your Laptop

You will need to install the dependencies for the makenode utility developed by the SudoMesh project. Many of the quoted commands listed below may need sudo prepended to them.

Linux

If you are working with a fresh installation of Ubuntu Linux, you will need to install a few pieces of software. Do install them, open your terminal and type the following:

 sudo apt-get install nodejs
 sudo apt-get install git
 sudo apt-get install npm
 sudo apt-get install dropbear

Mac

Install the Homebrew package manager, then install the required binaries.

 brew install nodejs
 brew install git
 brew install npm
 brew install dropbear

Windows

For the moment, Windows users will have to figure out some of these steps on their own. Completing this process from a Windows machine has not been tested.

  • Install NodeJS - Make sure to install the 'npm package manager', and select to 'Add to Path'
  • Install Git
  • Install Dropbear (no known ports for Windows)

Install OpenWRT on your Router

Download the Sudomesh OpenWRT Image File For a Supported Router

Sudomesh firmware images can be found at https://builds.sudomesh.org/builds/chaos_calmer/ar71xx/

At the moment, we are supporting the following routers for home nodes:

Name Model No. OpenWRT Doc Firmware Image
TP-Link WDR3500 OpenWRT Docs firmware image
TP-Link WDR3600 OpenWRT Docs firmware image
TP-Link WDR4300 OpenWRT Docs firmware image
Western Digital MyNet N600 OpenWRT Docs firmware image
Western Digital MyNet N750 OpenWRT Docs firmware image

Download the image file for your supported router.

Flash your Router with OpenWRT

There are different techniques for flashing each of the routers. Use the links above to the OpenWRT wiki and follow the instructions there to flash the router with the firmware you've downloaded.

For example, if you have a Western Digital MyNet N600, follow these instructions:

  • Plug one end of the Ethernet cable into your laptop.
  • Plug the other end of the Ethernet cable into one of the normal ports on the router (not the Internet/WAN port).
  • With the router plugged in and power turned off, push a pin into the reset hole and hold it.
  • With the pin held down, turn on the router power button.
  • Watch the front blue light - they will flash on and off a few times.
  • Once the front blue is flashing, you can let go of the pin.

On your laptop edit your network settings to reflect the following:

  • Network Configuration Method: Manual
  • IP Address: 192.168.1.10 (some devices will only accept from this IP)
  • Subnet Mask: 255.255.255.0
  • Gateway: 0.0.0.0

See Network Configuration Guides: Linux Mac

In your web browser:

  • Go to http://192.168.1.1
  • Click 'Browse' and select the firmware file you downloaded
  • Click Install

Note: Sometimes the firmware upload will not complete. After you click on 'Install' You should get a page with a countdown of 120+ seconds. If this does not occur, reboot the router with the pin reset button depressed (as noted above), and try again.

Configuring Your OpenWRT Router to Work on the Sudomesh Network

After you have successfully flashed your router with the OpenWRT, you will need to use makenode to complete the setup. makenode registers your node on the SudoMesh network, resulting in the assignment of a 64 IPv4 address subnet to your node, in addition to applying basic configuration.

From your terminal, run the following:

 git clone https://github.com/sudomesh/makenode.git
 cd makenode
 npm install
 cp settings.js.example settings.js

The default settings in settings.js should suffice in most cases, but if you need to make changes, do them in settings.js.

A freshly flashed node will be setup on 172.22.0.1. You will need to configure your machine to use the following network settings to communicate with the node.

  • IP address: 172.22.0.9
  • Subnet mask: 255.255.255.0
  • Gateway: 0.0.0.0

See Network Configuration Guides: Linux Mac

Configuring the Home Node

Make sure the Ethernet cable is connected to the 4th port on the router.

Once your network configuration is refreshed, use the following command to run the script and configure your node:

 ./makenode.js

If you get the error "no such file or directory", open a new terminal and run this command to ensure that node points to your NodeJS executable:

 sudo ln -s nodejs node

In the new terminal, return to the 'makenode' source code directory and try again:

 npm install
 ./makenode.js

Now the configuration wizard will ask you a number of questions:

  • "enter valid hostname" - this is the host name when you SSH into the node - For info on what constitutes a valid hostname, see: valid characters of a hostname
  • "max share upstream bandwidth" - how much of your home network upstream bandwidth you wish to share with the mesh network, measured in kbps (kilobits per second). So if you'd like to share 10mbps (megabits per second) enter "10000" or if you want to share 256kbps (kilobytes per second) enter "256". You may want to run a speed test to find out how much bandwidth you have and determine how much you want to share.
  • "max share downstream bandwidth" - how much of your home network upstream bandwidth you wish to share with the mesh network - eg. "512" would share 512 kbps
  • "admin user password" - this is the password for for changing wifi settings on the node
  • "root user password" - this is the root password for the router - Make sure that your root password is strong! If you don't enter a root password, a strong one will be generated and will be logged to screen. It's generally preferable to not use the root password at all and instead add an ssh key to the device - see details below.
  • "wifi transmit power" - set this to 23 dBm (which is equivalent to 200 milliwatts)
  • "operator name" - this is the name that the network admins can associate with the node - so use a unique name like your first name or location name
  • "private wifi SSID" - this is the wireless SSID name for the private wireless network that will run on this router
  • "private wifi password" - this is the password for the private wireless network that will run on this router - it must be at least 8 characters long

Testing

After you're finished with the setup, you can do the following to test out your new home node.

Network Settings

After configuring your home node the IP address it uses will change. Reconfigure your machine to use the following network settings.

  • IP Address: 172.22.0.9
  • Netmask: 255.255.255.0
  • Gateway: 0.0.0.0

SSH into your Home Node

Your home node is now running a Secure Shell (SSH) server. You can run the following command to attempt to log into your home node.

 ssh root@172.22.0.1

After accepting the key by entering 'yes' and pressing ENTER, it will ask you for the root password.

By default the root password used after flashing the device using a SudoMesh firmware build is "meshtheplanet". If you have configured your device already using `./makenode`, you'll need to use the root password you specified.

If you'd like to add your ssh key to the router (instead of using a root password), add it to the `configs/authorized_keys` file. You'll see that there are 3 other keys there for our developers. You can remove them if you'd like, but they're currently the only way we can provide remote support. During the alpha test phase we ask that you consider whether you are able to do diagnostics/debugging yourself before you remove them.

Confirm that the Node is Running

Click on the network icon on the top right of the toolbar to see the available wireless networks (or run sudo iwlist wlan0 scan in your Linux terminal)

If configuration proceeded correctly, you should see the 'peoplesopen.net' and 'pplsopen.net-node2node' WIFI interfaces.

At this point you're setup. For more information on using your node, such as accessing the web-based management interface, see Home node info

For more technical details on the internals of the SudoMesh OpenWRT build, see Home Node Troubleshooting

Flashing Extender Antennas

This step is optional.

Download the Image File For a Extender Node

The extender nodes that we currently support are:

Name Model No. OpenWRT Doc Firmware Image
Ubiquiti Nanostation M5 NSM5 OpenWRT Docs firmware: pre 2015 or 2015-2016
Ubiquiti Nanostation M2 NSM2 OpenWRT Docs firmware image
Ubiquiti Picostation 2 OpenWRT Docs firmware image
Ubiquiti Picostation M2 OpenWRT Docs
Ubiquiti Nanobeam M2 and M5 OpenWRT Docs
Ubiquiti Bullet M2 and M5 OpenWRT Docs

Flash the Extender Node

  • Configure your wired internet settings to use Manual IPv4 settings with IP: 192.168.1.10, subnet: 255.255.255.0, gateway: 0.0.0.0
  • Plug one Ethernet cable into your laptop on one end and into the "LAN" port of the power-over-ethernet power supply on the other end.
  • Plug another Ethernet cable into your antenna on one end and into the "POE" port of the power-over-ethernet power supply on the other end.
  • Push a pin into the reset hole and hold it.
  • With the pin held down, plug in the power to the power-over-ethernet power supply.
  • Watch the lights on the antenna - they will all flash together a few times, then they will flash up and down.
  • Once the lights on the antenna are flashing up and down, you can let go of the pin.

You should be able to ping the extender at 192.168.1.20.

 $ ping 192.168.1.20
 PING 192.168.1.20 (192.168.1.20) 56(84) bytes of data.
 64 bytes from 192.168.1.20: icmp_seq=1 ttl=64 time=1.54 ms
 64 bytes from 192.168.1.20: icmp_seq=2 ttl=64 time=0.826 ms

In your Linux terminal, type:

 git clone https://github.com/sudomesh/ubi-flasher
 cd ubi-flasher
 npm install
 ./flasher.js '<path to firmware>'

The terminal will tell you "The firmware has been successfully sent to the router. In a few seconds, the router should begin flashing its four status LEDs sweeping from left to right, then right to left (or up down, down up). This means that the router is flashing itself with the new firmware. Once the router goes back to having only the power LED lit, the router has been successfully flashed."

Wait until the antenna has only the power LED lit and you're done.

Nanostation M5

If you attempt to flash the extender and receive a 'Firmware check failed' error, then you have a version of the NSM5 that is protected from being flashed via the TFTP method. You will need to obtain a serial to USB interface (USB to UART TTL Module Serial Converter, 5 pin) and use it to flash the firmware.

  $ ./flasher.js openwrt-ar71xx-generic-ubnt-nano-m-squashfs-factory.bin
  Accessing http://192.168.1.20/login.cgi
  Connection timed out
  Sending openwrt-ar71xx-generic-ubnt-nano-m-squashfs-factory.bin to 192.168.1.20 using tftp put
  [Error: (Server) Firmware check failed]