**This is an old revision of the document!** ----

A PCRE internal error occured. This might be caused by a faulty plugin

====== Serval Mesh Observer ====== {{ :content:meshobserver:observersetuphighlighted.jpg?300|Mesh Observer components outlined in red}} The Mesh Observer is a monitoring device that attaches to a [[content:meshextender:2ng|Mesh Extender]] and sniffs Wi-Fi and UHF packets, forwarding them to another machine for analysis. It is useful for mapping out traffic through a Serval mesh network and diagnosing issues with [[content:tech:rhizome_bundle|bundle]] movements. The analysed packets are drawn into a [[https://en.wikipedia.org/wiki/Sequence_diagram|UML Sequence Diagram]]. The current device is based on a [[https://www.gl-inet.com/products/gl-ar150/|GL-iNet GL-AR150]] router flashed with custom firmware available in the MeshExtender2.0 branch of the [[https://github.com/servalproject/openwrt-packages/tree/MeshExtender2.0|Serval Mesh Extender firmware repository]]. Similar devices such as [[http://www.dragino.com/products/mother-board/item/113-ms14n-p.html|Second-Generation Dragino boards]] are being investigated for use in place of a [[https://www.gl-inet.com/products/gl-ar150/|GL-AR150]]. So far it seems that most devices supported by [[https://openwrt.org|OpenWRT]] with one or more USB ports are suitable candidates. ====== Building a Mesh Observer ====== The following sections will outline how to construct a GL-AR150-based Mesh Observer and compile, and flash firmware onto it. Note that these steps are based on the the [[http://developer.servalproject.org/dokuwiki/doku.php?id=content:meshextender:me2.0_quality_assurance#provisioning_procedure|Second-Generation Mesh Extender firmware compilation process]]. It is advised that you follow those steps first, as they will set up the development environment you will be using here. **NOTE:** These steps were made and tested for Ubuntu Linux 18.04. The packages and commands listed here may not work with other Linux distributions, so your mileage may vary. ==== Building the OpenWRT-based Firmware ===== === Prerequisites ==== See the [[content:meshextender:me2.0_quality_assurance#prerequisites|Mesh Extender firmware prerequisites]]. === Build process ==== - Follow the [[content:meshextender:me2.0_quality_assurance#build_process|build instructions for the Mesh Extender firmware]] to set up the environment - Run 'make menuconfig' to open the build configuration menu - Use the up and down arrow keys to move the cursor down to 'Network', press Enter - Move to 'Mesh networking', press Enter - Move to 'serval-mesh-extender' and disable it (shown as ''< >'') by pressing Space (you may need to press Space multiple times to deselect it) - Move to 'serval-mesh-observer' and enable it (shown as ''<*>'') by pressing Space (you may need to press Space multiple times to select it properly) - Use the left and right arrow keys to select 'Exit' along the bottom bar, press Enter - Repeat step 7 until you have exited the build configuration menu (if prompted to save, choose Yes) - Run './update' to collect and build the firmware The firmware file should be found under ''%%bin/ar71xx/openwrt-ar71xx-generic-gl-ar150-jffs2-64k-sysupgrade.bin%%'' ==== Flashing the Firmware ===== The GL-AR150 features a web-based firmware update tool that we will be using for simplicity. If this method fails, there are {{:content:meshobserver:ar150_pcb.jpg?linkonly|serial pins}} on the board you can use with the [[content:meshextender:me2.0_quality_assurance#flashing_the_firmware|Mesh Extender flashing process]] to flash the firmware the hard way, however the former method is preferred as it does not immediately void your warranty. - Connect an Ethernet cable between you computer and the WAN port of the GL-AR150 - Configure the Ethernet interface on your computer to use the IP address '''' - Hold down the 'Reset' button on the device - While still holding the reset button, connect power to the device - Let go of the reset button **on the 6th blink** of the red LED (the centre green LED should illuminate as the red one does) After releasing the reset button, the red light should blink rapidly for about a second. If not, and instead both green LEDs are lit, then you must have released the reset button too early or too late. - Open [[]] in your browser - Click 'Choose file' and select the firmware file you built earlier - Click 'Update firmware' - Wait for the upload to complete, the device should reboot automatically When the device finishes rebooting, it will boot the Mesh Observer firmware and should be available via SSH at '''' with the username and password set to ''root''. ==== Making the UHF breakout ==== To get the UHF packets from the Mesh Extender, the Mesh Observer uses a pass-through DB-25 breakout board, so that it can tap into the TX and RX lines of the radio without having to replace the standard power cable. {{:content:meshobserver:breakouttopdown.jpg?300|Top-down view of the breakout}} {{:content:meshobserver:breakoutfemale.jpg?300|Female side of the breakout}} === Making Wires === The breakout is connected to several USB-UART adaptors through some custom-made wires to connect a single line to two adaptors so that they can be monitored at two different serial speeds. The wires have a 2-pin DuPont connector on the breakout-end and two single-pin DuPont connectors on the USB-end. Between them is a single wire that connects each of the pins together. - Cut four short lengths of wire (around 5-10cm) - Cut one long length of wire (arbitrary length, it's just to give space between the USB adaptors and the breakout) - Strip both ends of each wire - Solder one end of two short wires to form a pair - Repeat for the other two short wires - Crimp two single-pin female DuPont connectors onto the ends of one short pair - Crimp one 2-pin female DuPont connector onto the end of the other short pair - Slide two short lengths of heatshrink onto the long wire (~3cm, long enough to cover the solder joint) - Solder one pair of short wires onto one end of the long wire - Repeat for the other end with the other pair - Shrink the heatshrink with a heat gun (or a lighter if you don't have a heat gun, just be careful of burning yourself or the wire) - Repeat steps 1-11 an additional 3 times for a full set of wires The final result should look similar to the pictures below: {{:content:meshobserver:wiresjoined.jpg?150|Breakout end}} {{:content:meshobserver:wireset.jpg?300|Full set of wires}} {{:content:meshobserver:wiressplit.jpg?150|USB adaptor end}} === Connecting the Wires, USBs, and Breakout === - Connect the 2-pin connector end of one wire to pin 1 of the breakout - Connect both of the single-pin ends of the same wire to the ground pins of two USB adaptors - Repeat steps 1 and 2 with another wire connected between pin 4 of the breakout and ground of two more USB adaptors - Connect the 2-pin connector end of one wire to pin 5 of the breakout - Connect both of the single-pin ends of the same wire to the 'RX' pins of two USB adaptors - Repeat steps 4 and 5 with another wire connected between pin 6 of the breakout and 'RX' of the other two USB adaptors - Insert all four USB adaptors into a USB hub The final product should look like the images below: {{:content:meshobserver:observerjig.jpg?200|}} {{:content:meshobserver:jigbreakoutcloseupangled.jpg?280|}} {{:content:meshobserver:jigusbcloseup.jpg?290|}} ====== Deploying a Mesh Observer ====== Mesh Observer deployment is fairly straightforward: - Insert the breakout in-between a Mesh Extender and the power cable - Plug the USB hub into the Mesh Observer - Connect an Ethernet cable between your computer and the WAN port of the Mesh Observer - Connect a micro-USB cable between a power supply and the Mesh Observer The Mesh Observer should boot and power up the USB hub. Once it is done booting, it will be accessible via SSH at ''''. The final setup should look similar to the below image: {{:content:meshobserver:observersetup.jpg?500|}} ====== Using the Capture Programs ====== {{ :content:meshobserver:timingdiagram_fri_sep_27_15_56_31_2019.png?300|}} The Mesh Observer firmware comes with a [[https://github.com/thomotron/serval-mesh-observer-packet-capture|capture program]] ready to use. The capture client program (''capture'') will capture packets from the Mesh Observer's Wi-Fi interface and the Mesh Extender's radio via the UHF breakout. The captured packets are sent to the capture server program (''svrCap'') which will dissect each packet, classify them by type and/or payload, and draw them on a [[https://en.wikipedia.org/wiki/Sequence_diagram|UML Sequence Diagram]] for analysis (shown to the right). === Setting Up a Capture Server === To start capturing with the capture server program: - Run ''svrCap'' - Press ''Ctrl+C'' to stop capturing and generate a sequence diagram like the one shown to the right The capture server should start listening to port 3940 on all interfaces and begin processing incoming packets captured by clients. To stop the capture server, press ''Ctrl+C'' and the program should briefly generate a diagram of the captured output and halt. === Setting Up a Capture Client === Capturing packets on a Mesh Observer is quite simple, however due to SSH limitations, it does require that you are connected to the device for the duration of the capture. This can be avoided by using the ''start-stop-daemon'' program packaged with the Mesh Observer firmware: ''start-stop-daemon -Sbx capture <args...>''. - Log in to the Mesh Observer via SSH - Run ''iw phy phy0 set channel 11'' to listen on Wi-Fi channel 11 - Run ''capture <sid> <server_ip> -f 'ether host <mac>''', where ''<sid>'' is the [[content:tech:sid|Serval ID]] of the attached Mesh Extender, ''<server_ip>'' is the [[https://en.wikipedia.org/wiki/IP_address|IP address]] of the capture server, and ''<mac>'' is the [[https://en.wikipedia.org/wiki/MAC_address|MAC address]] of the attached Mesh Extender's Wi-Fi interface. The Mesh Observer should start capturing packets and sending them to the capture server at the specified IP address. To stop capturing, press ''Ctrl+C'' and the program should halt. **NOTE:** There are several other optional available for the capture client program. Running ''%%capture --help%%'' will list each of them with a description of the effect they have.