====== Multi Packet Forwarder ======
**This functionnality is only available for Keros version 5.5.1 and above**
===== lorafwd_instance_manager =====
This tool allows the create and manage multiple instances of packet forwarder to connect a gateway to multiple LNS.
Following features are available in ''lorafwd_instance_manager'' tool:
* Add a new instance of lorafwd (''add '')
* Delete an instance of lorafwd (''delete '')
* Check if an instance exists (''check '')
* List all added instances (''list'')
Only UDP/GWMP packet forwarder instances can be created but they can be used at the same time as a [[basic_station_forwarder|Kerlink Basic Station Packet forwarder]].
When using the multi-packet forwarder feature, usage of netid filtering is highly recommended to avoid downlink collision.
**Note also that the last instance of lorafwd will define the radio parameters of your gateway**
===== How to create and configure multiple instances =====
==== Creation of the instance ====
If you want to connect your gateway to a second LNS, you will need to create a new instance of lorafwd. To do this, use the following command:
lorafwd_instance_manager add second_instance
In the example the instance is named "second_instance" but you can name it as you like.
It will create all the files needed for its configuration.
**List of generated files:**
/
|-- etc
| |-- lorafwd_second_instance.toml
| |-- default
| | `-- lorafwd_second_instance
| |-- init.d
| | `-- lorafwd_second_instance
| |-- monit.d
| | `-- lorafwd_second_instance
| |-- rcK.d
| | `-- K52lorafwd_second_instance -> /etc/init.d/lorafwd_second_instance
| |-- rcU.d
| | `-- S51lorafwd_second_instance -> /etc/init.d/lorafwd_second_instance
| |-- rsyslog.d
| | `-- lorafwd_second_instance
| `-- sysupgrade.d
| `-- lorafwd_second_instance.conf
|-- run
| `-- lora
| `-- lorafwd_second_instance.pid # Created each time it is started
|-- tmp
| `-- lorafwd_second_instance_version # Created each time it is started
|-- usr
| `-- sbin
| `-- lorafwd_second_instance -> /usr/sbin/lorafwd
`-- var
`-- lib
`-- lorafwd_second_instance
`-- database.sqlite # Created at first start
==== Configuration of the instance ====
Then, to configure the new instance, you will need to use the [[wiki:keros_custo:keros_applications_configuration|klk_apps_config]] as follow:
klk_apps_config --activate-lorafwd -i second_instance --lns-server second_instance.url --lns-dport 1700 --lns-uport 1700
After //--lns-server --lns-dport --lns-uport// enter your own informations according to [[wiki:keros_custo:keros_applications_configuration|klk_apps_config]] parameters
===== Logs =====
All lorafwd instances will write into the same log file ''/var/log/lora.log'', and are distinguished by their names, for example:
2021-05-20T14:17:11.588309+00:00 klk-wifc-03001D lorad[10784]: <6> Sent 1 uplink message
2021-05-20T14:17:11.631126+00:00 klk-wifc-03001D lorafwd_foo[11880]: <6> Heartbeat (F938) sent
2021-05-20T14:17:11.633762+00:00 klk-wifc-03001D lorafwd_foo[11880]: <6> Heartbeat (F938) acknowledged in 2.6289 ms
2021-05-20T14:17:13.446644+00:00 klk-wifc-03001D lorafwd[11552]: <6> Heartbeat (9FC3) sent
2021-05-20T14:17:13.449302+00:00 klk-wifc-03001D lorafwd[11552]: <6> Heartbeat (9FC3) acknowledged in 2.6239 ms
2021-05-20T14:17:14.179913+00:00 klk-wifc-03001D lorafwd[11552]: <6> Received uplink message:
2021-05-20T14:17:14.180028+00:00 klk-wifc-03001D lorafwd[11552]: <6> | lora uplink (1F70167D), payload 25 B, channel 868.1 MHz, crc ok, bw 125 kHz, sf 7, cr 4/5
2021-05-20T14:17:14.180093+00:00 klk-wifc-03001D lorafwd[11552]: <6> | Unconfirmed Data Up, DevAddr 00430024, FCnt 467, FPort 25
2021-05-20T14:17:14.180139+00:00 klk-wifc-03001D lorafwd[11552]: <6> | - radio (00000105)
2021-05-20T14:17:14.180233+00:00 klk-wifc-03001D lorafwd[11552]: <6> | - demodulator counter 3502620444, UTC time 2021-05-20T14:17:14.173866Z, rssi -64 dB, snr 7.5< 10 <12.5 dB
2021-05-20T14:17:14.181910+00:00 klk-wifc-03001D lorafwd[11552]: <6> Uplink message (ABD8) sent
2021-05-20T14:17:14.183471+00:00 klk-wifc-03001D lorafwd_second_instance[11880]: <6> Received uplink message:
2021-05-20T14:17:14.183584+00:00 klk-wifc-03001D lorafwd_second_instance[11880]: <6> | lora uplink (1F70167D), payload 25 B, channel 868.1 MHz, crc ok, bw 125 kHz, sf 7, cr 4/5
2021-05-20T14:17:14.183651+00:00 klk-wifc-03001D lorafwd_second_instance[11880]: <6> | Unconfirmed Data Up, DevAddr 00430024, FCnt 467, FPort 25
2021-05-20T14:17:14.183695+00:00 klk-wifc-03001D lorafwd_second_instance[11880]: <6> | - radio (00000105)
2021-05-20T14:17:14.183786+00:00 klk-wifc-03001D lorafwd_second_instance[11880]: <6> | - demodulator counter 3502620444, UTC time 2021-05-20T14:17:14.173866Z, rssi -64 dB, snr 7.5< 10 <12.5 dB
2021-05-20T14:17:14.185793+00:00 klk-wifc-03001D lorafwd[11552]: <6> Uplink message (ABD8) acknowledged in 3.85701 ms
2021-05-20T14:17:14.186798+00:00 klk-wifc-03001D lorafwd_second_instance[11880]: <6> Uplink message (FB49) sent
2021-05-20T14:17:14.187286+00:00 klk-wifc-03001D lorad[10784]: <6> Sent 1 uplink message
2021-05-20T14:17:14.189619+00:00 klk-wifc-03001D lorafwd_second_instance[11880]: <6> Uplink message (FB49) acknowledged in 2.80792 ms