SNMP agent
An integrated SNMP agent is available to monitor the gateway on the network.
This SNMP agent service is provided by the Net-SNMP suite.
The SNMP agent service is only supported through CLI at the moment.
Basic installation
Configure the firewall
Since the agent is reached from the outside (and acts as a server), the first step to do is to open the right port for inbound connections. By default the SNMP agent accepts UDP connections on port 161.
If you have disabled the firewall service, you don't need to configure anything. You can move to the next section.
The following procedure applies for IPv4. If you use IPv6, you need to adapt the command. More information on the firewall on the dedicated page.
Firewall modification can lead to unreachable system in case of mistake. Modify the firewall remotely only if you are sure what you are doing.
Insert a new rule in the firewall
The firewall of the LORIX OS has an ACCEPT policy by default for the inbound connections with the last rule defined to DROP. The final behavior is "deny by default" which is the most secured behavior.
It could also be done with a DROP policy but is more difficult to maintain.
For this reason, we need to INSERT the new rule before the last DROP rule.
We need to know the index where to insert the new rule and for that, we need to display all the rules:
By default, the system will return the following result or similar:
We want to insert the new rule before the "DROP all" one (the last line) and then insert this rule at the index 14.
Please be aware this index can have a different value, you need to check carefully the result.
Based on the previous result, we can insert the new rule:
The final result is now:
We can insert the new rule elsewhere in the chain but a good general strategy is to start with generic rules followed by more specific ones. The idea behind that is to reduce the rules iterated for any given packet.
Save the rules to make it persistent
The rule you have just added is only present in volatile memory for the moment until a restart. If you want to make it persistent over a reboot, you need to save the current rules into non volatile memory.
Save the rules
Result
Configure Net-SNMP agent
The Net-SNMP agent configuration file is located in the file /etc/snmp/snmpd.conf
.
You can edit it with your favorite text editor using sudo:
You can check the many possibilities of the SNMP configuration in the official references or with the many tutorials on the internet.
If the service is already started, you need to reload the configuration after the edition to take your modification into account.
Start the service
The service can be started easily thanks to the OpenRC service manager:
Make it persistent over a reboot
The previous command only starts the service for the current session but it will not be started at system boot. To make it persistent, you need to use the following command:
Additional setup
Stop the service
The service can be stopped easily thanks to the OpenRC service manager:
Make it persistent over a reboot
The previous command only stops the service for the current session but it will start on next reboot if you made it persistent. To disable the auto start at boot, you need to use the following command:
Reload the configuration
When you have modified the SNMP configuration file with the service running, you can reload the new config without restarting the service. This can be done as follow:
Restart the service
If needed, you can restart the service as follow: