Skip to content

Sparrow Border Router Configuration and Commands

Joakim Eriksson edited this page Jun 12, 2017 · 3 revisions

Command Line Arguments for starting the Border Router

The possible command line arguments that are available in the border router is shown when you add the -h argument. They are also listed below:

 -B baudrate    9600,19200,38400,57600,115200,230400,460800,921600 (default 115200)
 -H             Hardware CTS/RTS flow control (default disabled)
 -s siodev      Serial device (default /dev/ttyUSB0)
 -S             Run in slave mode.
 -a host        Connect via TCP to server at <host>
 -p port        Connect via TCP to server at <host>:<port>
 -c port        Open UDP control at localhost:<port>
 -P port        Open TCP control at localhost:<port>
 -t tundev      Name of interface (default tun0)
 -X cmd         Run the command and then exit
 -d[basedelay]  Minimum delay between outgoing SLIP packets.
                Actual delay is basedelay*(#6LowPAN fragments) milliseconds.
                -d is equivalent to -d10.

Normally you can just start it using make connect-high to get it started but if you want to handle other configurations such as running multiple NBR:s with different radios on USB or changing the IPv6 prefix, etc, you will need to start it "manually" using the command line arguments to configure it.

Using Sparrow-Border router with SubGHZ 802.15.4g

When compiling the Sparrow Border Router for use on a sub-GHz serial radio that is built with larger packets you will need to do it with an extra Make argument:

>make MAKE_WITH_SUBGHZ=1 connect-full
>...

This will automatically configure the sparrow border router for 255 bytes packets instead of the regular 127. This work only with nodes that have support for CC1200 and GPIO2 at the moment.

Console Commands for Border Router and Serial Radio

There are a number of commands that can be typed on the console of the border router that will either read out statistics / data or configure the border router or serial radio. Commands that are queries always start with '?' and commands that are configurations always starts with a '!'.

Most important available commands:

?S - query for statistics over the serial interface This command is used for getting some statistics for the serial communication. Example:

 ?S
 2015-04-20 13:13:21.000 [nbr] INFO - ENCAP: received 216087 bytes payload, 0 errors
 2015-04-20 13:13:21.000 [nbr] INFO - SLIP: received 219819 bytes, 3328 frames, 0 overflows, 0 dropped
 2015-04-20 13:13:21.000 [nbr] INFO - SLIP: sent 135543 bytes, 1265 frames, 0 packets pending
 2015-04-20 13:13:21.000 [enc] INFO - SR: ENCAP: received 132838 bytes payload, 0 errors
 2015-04-20 13:13:21.000 [enc] INFO - SR: SERIAL: received 135559 bytes, 1266 frames
 2015-04-20 13:13:21.000 [enc] INFO - SR: SLIP: 0 overflows, 0 dropped bytes, 0 errors

?C - read channel / !C - set channel These commands are used for getting and setting the 802.15.4 radio channel. Node: set take a channel between 11 and 26.

Example:

 ?C
 2015-04-20 13:17:58.000 [br-cmd] INFO - Channel is: 26
 !C22
 2015-04-20 13:19:47.000 [enc] INFO - SR: radio: setting channel: 22
 ?C
 2015-04-20 13:19:51.000 [br-cmd] INFO - Channel is: 22

?P - read PAN ID / !P - set PAN ID These commands reads and sets the PAN ID of the 802.15.4 network. This ID is used for filtering packets and is a way of creating multiple networks on the same channel. Any device on another PAN ID than the one used by the border router will not be able to join the 6LoWPAN network.

 ?P
 2015-04-20 13:23:23.000 [br-cmd] INFO - Pan id is: 43981 (0xabcd)
 !P0xaabb
 2015-04-20 13:23:31.000 [enc] INFO - SR: radio: setting pan id: 43707 (0xaabb)
 ?P
 2015-04-20 13:23:34.000 [br-cmd] INFO - Pan id is: 43707 (0xaabb)

?m - read the radio mode / !m - set the radio mode The set/get radio mode control the mode of the serial radio. The radio can be in either normal mode (m1), sniffer mode (m2) or in RSSI scanning mode (m3).

 ?m
 2015-06-09 21:56:04.000 [br-cmd] INFO - Radio mode: 2
 !m1
 2015-06-09 21:56:29.000 [enc] INFO - SR: radio: mode set to 1

!G - perform a RPL global repair RPL has a function that start re-building the network graph. This is called global repair and is triggered using the !G command. This can be useful if the networks have entered a bad state.

 !G
 2015-06-09 21:55:09.000 [br-cmd] INFO - Performing Global Repair...
 ...

?T - read TX power / !T - set TX power The TX power can be used for making the range of the border router shorter or longer.

To set the TX power use the following:

 ?T
 2015-06-09 22:01:41.000 [br-cmd] INFO - Radio tx power is -11 dBm
 !T-5
 2015-06-09 22:02:02.000 [enc] INFO - SR: radio: setting tx power: -5 dBm

This are the most commonly used commands used for the border-router and serial radio.

Running Sparrow Border Router in slave mode

The border router can be started in slave mode where it does not set up its own network. Instead it simply provides remote access directly to the serial radio that can be used for example as a packet sniffer. In slave mode, its builtin TCP/IP control server will be globally accessible instead of only allowing access from local host.

> cd products/sparrow-border-router
> make
> ./border-router.native -B 921600 -s /dev/ttyACM0 -S

Using Sparrow Border Router in Master / Slave mode

If you want to use the serial radio as a remote serial radio and run the border router on another host machine you can do it by:

./border-router.native -a 192.168.179.129 -p 9999 fd00::1/64

(Assuming that the slave runs on 192.168.179.129)

and the border router will start at the host machine but use the serial radio at the other machine. Thus creating an very basic access point of the remote NBR and serial radio.

Using Sparrow Border Router as packet sniffer

The sniff.py script can use the border router as packet sniffer and create a PCAP file that can be imported in Wireshark. The example above will run the packet sniffer for 20 seconds and then stop.

> tools/sparrow/sniff.py -a 127.0.0.1 -p 9999 -t 20 -o outfile.pcap
Configuring radio for sniffing. (NBR will not work during capture)
Capturing outfile.pcap
[connection closed]

Instead of capturing the packets to a PCAP file, it is also possible to run Wireshark and see the packets in real time. The example below will run the packet sniffer for one hour and then stop.

> tools/sparrow/sniff.py -a 127.0.0.1 -p 9999 -t 3600 -s | wireshark -k -i -