How NethServer decides if an interface is UP or DOWN?

NethServer Version: NethServer release 6.7 (final)
Module: unknown (maybe nethserver-lsm?)

Hello,

I’m quite new to NethServer. I would like to know how NethServer puts an interface UP or DOWN, as seen in the dashboard. In /var/log/messages I often found lines like these:

Apr 21 12:12:20 localhost esmith::event[42977]: Event: wan-uplink-update down wan1 NA NA root 0 0 0 0 0 0 0 0 NA up 1492769540
Apr 21 12:12:20 localhost Shorewall[42985]: Disabling device eth0
Apr 21 12:12:20 localhost esmith::event[42977]:    Provider wan1 (2) stopped
Apr 21 12:12:20 localhost esmith::event[42977]: Action: /etc/e-smith/events/wan-uplink-update/S50nethserver-shorewall-wan-update SUCCESS [0.211114]
Apr 21 12:12:20 localhost esmith::event[42977]: Event: wan-uplink-update SUCCESS

(or the equivalent ones to put it UP) but I’m not sure what is triggering the “wan-uplink-update” event.

I’m using the “Multi WAN” feature with 2 interfaces.

Thanks a lot. Best regards.

Nèstor

Well, after reading some docs, I answer to myself:

NethServer firewall can handle 15 red (WAN) interfaces. Implementation uses Shorewall with LSM (Link Status Monitor). The LSM daemon takes care of monitoring WAN connections (interface) using ICMP traffic and it informs Shorewall about interface up/down events. Each interface can be checked using multiple IPs (see checkip property below). At least one IP must be reachable to mark the WAN connection as usable. If no IP is specified (recommended option), the system will uses well-known default IPs (Google DNS and OpenDNS).

(from http://docs.nethserver.org/projects/nethserver-devel/en/v6.8/gateway.html#multi-wan)

Now, it would be great for me to examine the insides of the LSM daemon. Where is this script located?

Thanks a lot!

Nèstor

You can list all files using this command:

rpm -ql lsm

And this is the official site: https://lsm.foobar.fi/

Open /etc/lsm/lsm.conf and set debug=9 at top (you’ll find debug=0).
Then type restart lsm.

BTW, it lost the configured number of pings you set in Multi WAN.

Thanks a lot for your quick responses!

I’ve set debug=9 and now I see a lot more info in the log, thanks!

What do you mean “it lost the configured number of pings you set in Multi WAN”?

Regarding this, I would like also to question: both parameters “Disable provider after # lost pings (2-99)” and “Disable provider over % lost pings (1-100)” are mutually exclusive or not? How does LSM act if both are set?

Thanks again. Best regards.

Nèstor

Both values are evaluated. Examples:

  1. you are losing one packet out of two (50%), set the threshold to 60% and 5 consecutive packets: line is up
  2. you are losing one packet out of two (50%), set the threshold to 40% and 5 consecutive packets: line is down
  3. you are losing 5 packet out of 10 (50%), set the threshold to 60% and 5 consecutive packets: line is down

Ok, thanks a lot for the examples!