Configuration
Introduction to the configuration
LibreMesh has a configuration system based on the following principles:
-
Be simple to configure and understand what configurations are in use in each node
-
Based on the idea of shared configurations at Community level with possible customizations per Node
-
Maintainable over time, by firmware updates, adding new nodes in the community, etc.
-
To be able to make complex configurations.
The configuration system is fundamental to understand the internal functioning of LibreMesh,
however it is not necessary to understand it before starting a LibreMesh network!
Geek free configuration using the FirstBootWizard
If your community wants to deploy a free geek network it is advisable to do so using the lime-app
using the FirstBootWizard. This application simplifies the initial configuration of the nodes and
allows new nodes to join an existing network, all through a user-friendly interface
which does not require prior knowledge of networks.
To use the FirstBootWizard simply follow the steps on the screen when
enter http://thisnode.info
However, if your community is a geek community, then you may not want to use the FirstBootWizard.
Once the network is started using the FBW, the participants can perform some
configuration changes through the lime-app.
As needs arise in the community that are not currently met by the
lime-app network participants will be able to learn how to make these changes through ssh
or other tools and following the documentation below.
Configuration for network administrators
LibreMesh uses UCI as its configuration, so does OpenWrt.
UCI is a database that is easily modified both from the command line and by editing the configuration files directly.
All UCI configuration files are located in the /etc/config/
directory.
The LibreMesh configuration files that can be edited for are: /etc/config/lime-node
and /etc/config/lime-community
All other configuration files should not be modified.
Configuration levels Community and Node
To help the community maintain its configs, the configuration of the network nodes
is structured hierarchically on 3 levels:
-
Node,
/etc/config/lime-node
file -
Community,
/etc/config/lime-community
file -
Default,
/etc/config/lime-defaults
file
Where the configuration made at the Node level takes priority over the Community and the latter has
priority over the Default.
This way, when most of the nodes share a certain characteristic, it is convenient
be configured at the community level and only modified at the Node level in the nodes where that configuration differs.
The Default level contains all configuration values at their default value.
Example
Let’s suppose that we want to set the maximum wireless distance from the 2.4GHz nodes in the community
in 300 meters but in two of the nodes A and B configure it in 1000m. We could do it in the following way:
In the lime-community
of all the nodes we would have
config lime 'wifi'
# other options
option distance_2ghz '300'
And in the lime-node
files of nodes A and B:
config lime 'wifi'
option distance_2ghz '1000'
Operation
When running the lime-config
command the first thing that happens is that the Node levels are processed, Community and Default and the /etc/config/lime-autogen
file is generated.
This file is the one that contains the configuration that is really going to be used by libremesh to configure the system.
The resulting configuration files are then written for each package based on /etc/config/lime-autogen
.
For the settings to be applied, it is recommended to run reboot
after lime-config
. While there are faster ways of applying the modifications in certain cases, running reboot
is the only way to ensure that all changes were applied.
List of sections and options
The configuration is divided into three main sections: system
, network
and wifi
.
For detailed and updated information on all options see the updated reference
in /docs/lime-example.
The following options in the system
section are the most relevant:
config lime system option hostname 'LiMe-%M4%M5%M6' option domain 'thisnode.info'
We suggest you change the domain thisnode.info to a new subdomain of your community site, for example option domain 'mesh.altermundi.net'. This domain ('mesh.altermundi.net') should be a domain that does not already exist outside the network (i.e. it is a bad idea to use 'altermundi.net'). All clients that get an IP address by DHCP and all network nodes will be assigned a fully qualified domain (e.g. 'lime-ddeeff.mesh.altermundi.net')
General network configurations
Of all the network options, the following are the most relevant
config lime network option primary_interface 'eth0' option main_ipv4_address '10.%N1.0.0/16' option main_ipv6_address '2a00:1508:0a%N1:%N200::/64' list protocols ieee80211s list protocols lan list protocols anygw list protocols batadv:%N1
IPv4 configuration:
main_ipv4_address There are four possibilities: |
IPv6 configuration:
main_ipv6_address The configuration is similar to the |
List of protocols
List of protocols configured by LibreMesh. Some of these require the installation of your related package |
Of all the network options, the following are the most relevant
config lime wifi option channel_2ghz '11' list channel_5ghz '48' list channel_5ghz '157' option distance_2ghz '100' option distance_5ghz '1000' list modes 'ap' list modes 'apname' list modes 'ieee80211s' option ap_ssid 'LibreMesh.org' option apname_ssid 'LibreMesh.org/%H' option country 'ES'
Country setting:
country code The default country code is not specified (so the default is usually |
distance
The |
wifi options
Any options in the form |
wifi Access point password
To secure the AP and APname interfaces with WPA2-PSK, add the |
Specific interface configurations
Changing the above options allows us to have a configuration of the whole system.
In cases where different network interfaces must have different configurations, see /docs/lime-example.
Parameterisable options
Some options are parameterizable using a set of special characters that will be
replaced by node-specific information.
-
MAC bytes
%Mn
refers to then
byte of the MAC address of the main interface.
For example from the MACCA:FF:EE:BA:BB:EE
%M1
will be replaced byCA
(the first byte of the MAC)
and%M4
byBA
(the fourth byte of the MAC). -
Network Identifier
%Nn
refers to then
byte of the cloud identifier which is a hash that is calculated
from the SSID of the AP (taken from the content ofoption ap_ssid …
). -
Hostname
%H
refers to the hostname of the node.
Setting up things not foreseen in LibreMesh
If you want to make a configuration for which LibreMesh does not have an option then
it is necessary to use generic configs and _lime-assets.
generic_uci_config
Other files can be configured in /etc/config/
from the lime configuration files using
generic configurations.
Example to configure the location of /etc/config/libremap
from /etc/config/lime-community
:
config generic_uci_config libremap
list uci_set "libremap.settings=libremap"
list uci_set "libremap.settings.community=our.libre.org"
list uci_set "libremap.settings.community_lat=-200.123"
list uci_set "libremap.settings.community_lon=500.9"
lime-assets
The lime-assets are files that allow you to make special configurations. These files
are divided into two groups, those of the node and those of the community. The idea is that the assets of the community
are shared by all the nodes and allow configurations that are necessary in all the nodes.
On the other hand, the files (assets) of the node are designed to make specific configurations in the node.
copy_asset
If a file is required to be present on the file system you can use the copy_asset
directive.
copy_asset
copies a file from the assets directory to a path defined by the dst
option.
For example to configure the collectd program for your community you can create a collectd.conf
file.
in /etc/lime-assets/community/collectd.conf
and use it by defining the following settings in the file
lime-community
in the following way:
config copy_asset collectd
option asset 'community/collectd.conf'
option dst '/etc/collectd.conf'
run_asset
To configure LibreMesh to run a script you should use the run_asset
option.
Use this configuration method as a last resort if the other methods are not sufficient.
Run_asset` runs a script from the assets directory. The execution can be in the first boot
(that is, when it starts after a firmware upgrade) using ATFIRSTBOOT
or in every
once you reconfigure LibreMesh (when you run lime-config
) using ATCONFIG
.
For example to run the script myscript.sh
saved in /etc/lime-assets/community/myscript.sh
on the first boot:
config run_asset a_test_script
option asset 'community/myscript.sh'
option when 'ATFIRSTBOOT'
This configuration method replaces the functionality of the |