====== Multi-gateways ======
If the IP address of a slave changes, it must be deleted, then redeclared to work again.
===== Introduction =====
Sometimes using only one gateway is not enough to cover an area, therefore a second gateway (or more) needs to be used. However, by doing so when using Wanesy SPN, data are split between multiple gateways.
Furthermore, sometimes it can be interesting to combine an iFemtoCell (indoor gateway) with an outdoor gateway (Wirnet iStation, Wirnet iBTS). The classical solution to achieve that is to use an external LNS (LoRa Network Server), however, it can be complex and often requires an access to the internet.
To solve these problems the multiple-gateways feature can be used. This feature allows the use of slave gateways (Wanesy SPN gateway, Wirnet iBTS, Wirnet Station) with a master SPN gateway. The slave gateways are in charge of forwarding every LoRa packets they received. The master gateway gathers the LoRa packets it received (from end-devices and gateways) within a single interface.
===== Behaviour =====
* An end-device sends a frame.
* One or more gateways receive the frame (the master gateway can also receive frames).
* The slave gateways forward the received frame to the master (through Ethernet, WiFi or GSM).
* The slave gateways do not save the frame.
* The master gateway chooses which gateway received the frame the best.
* The master gateway saves the frame from the best gateway (the duplicated frames are discarded).
===== Licence =====
The multi-gateways feature requires a "master" license. The license type can be checked in the Overview menu under the //License// section.
* A master gateway will display: ''Gateways x / 50''
* A slave gateway will display: ''Gateways 1 / 1''
{{.:..:master_license.png?300|Master license}}
===== Slave configuration =====
\\
==== GSM configuration ====
**No public IP address assignment** is required for slave gateways. You can use any SIM card that is using **fixed/static IP addressing**. \\
In case of using standard SIM cards without the fixed/static IP addrressing, you have to set a secure channel between the slave gateway and the master gateway.
See the OpenVPN section to achieve this.
\\
\\
==== Wanesy SPN gateway ====
In ''Configuration => Multi-gateways => Packets forwarding'' menu, check the ''Enable packets forwarding'' option and fill the ''Host'' field.
The ''Host'' field must contain the IP address or the domain name (e.g. ''klk-wifc-03002e'') of the master gateway. It can be found in the ''Overview'' menu of the master gateway.
The configuration of the master is __not__ applied to the slaves. Make sure to configure for each slave the regional parameters, the Rx/Tx parameters, the network parameters, and so on, accordingly to your needs. Any interface (USB key, web user interface, etc.) can be used to configure the slave.
==== Wirnet iBTS ====
- Install a CPF on the gateway. The instructions are detailed in the [[https://wikikerlink.fr/wirnet-productline/doku.php?id=wiki:lora:cpf|Kerlink CPF installation]]
- Once CPF installed, LNS server must be configured in lorafwd. Edit ''/user/etc/lorafwd/lorafwd.toml'', this configuration file is formatted using the TOML v0.5.0 language:
* ''gwmp.node'' must contain the IP address or the domain name (e.g. ''klk-wifc-03002e'') of the master gateway. It can be found in the ''Overview'' menu of the master gateway.
* ''gwmp.service.uplink'' must be ''1700''
* ''gwmp.service.downlink'' must be ''1700''
- Restart lorafwd to take into account the new configuration:
* ''/etc/init.d/lorafwd restart''
The configuration of the master is __not__ applied to the slaves. Make sure to configure for each slave the regional parameters, the Rx/Tx parameters, the network parameters, the LBT, and so on, accordingly to your needs.
Consult [[https://wikikerlink.fr/wirnet-productline/doku.php?id=wiki:lora:cpf|CPF installation and configuration]] for more details.
==== Wirnet Station ====
- Install a CPF on the gateway. The instructions are detailed in the [[https://wikikerlink.fr/lora-station/doku.php?id=wiki:cpf#how_to_install_the_common_packet_forwarder|Kerlink CPF installation]]
- Once CPF installed, LNS server must be configured in lorafwd. Edit ''/mnt/fsuser-1/lorafwd/etc/lorafwd.toml'', this configuration file is formatted using the TOML v0.5.0 language:
* ''gwmp.node'' must contain the IP address or the domain name (e.g. ''klk-wifc-03002e'') of the master gateway. It can be found in the ''Overview'' menu of the master gateway.
* ''gwmp.service.uplink'' must be ''1700''
* ''gwmp.service.downlink'' must be ''1700''
- Restart lorafwd to take into account the new configuration, according to this procedure [[https://wikikerlink.fr/lora-station/doku.php?id=wiki:cpf#starting_and_stopping_the_packet_forwarder|Stop and start packet forwarder]]
The configuration of the master is __not__ applied to the slaves. Make sure to configure for each slave the regional parameters, the Rx/Tx parameters, the network parameters, the LBT, and so on, accordingly to your needs.
Consult [[https://wikikerlink.fr/lora-station/doku.php?id=wiki:cpf|CPF installation and configuration]] for more details.
===== Master configuration =====
The master gateway can also be used to receive LoRa frames. Make sure to configure it's regional parameters, the Rx/Tx parameters, the network parameters, and so on, accordingly to your needs.
If the ''packets forwarding'' feature is enabled then the gateway will act as a slave (even though other gateways are registered). Make sure to disable it.
==== GSM configuration ====
It is mandatory to use a **fixed/static IP SIM card with public IP address assignment** to enable the slaves to forward correctly the LoRa packets to the Master gateway.
==== Adding a gateway ====
In ''Configuration => Multi-gateways => Manage gateways'' menu, slave gateways can be added. Two methods are available from the web user interface.
* Adding a single gateway: fill the gateway IDs and click the ''add'' button.
* Adding multiple gateways with a file:
* It must have a **.csv** extension.
* It must contain the gateway IDs, one by line (16 digits hexadecimal value in upper case).
* Once it has been uploaded, it is parsed: the unregistered gateways are added.
* If a gateway ID is wrong or a something else happens, it is logged.
{{.:..:manage_gateways.png|}}
==== Managing the gateways ====
In ''Configuration => Multi-gateways => Gateways'' menu, all the currently registered gateways are displayed along with their statistics.\\
The statistics can be downloaded in **.csv** format. The ''status'' field indicates if a gateway has been seen at least once. If the connection to a gateway is lost its ''status'' field is not updated.\\
The master gateway will always have the IP ''127.0.0.1''.\\
The gateways can be removed from this section.
{{.:..:gateways.png|}}