Skip to content

Connectivity Type

jbaumann edited this page Jan 6, 2022 · 2 revisions

Mandatory Options

The network type is used by setting the type accordingly:

[my new connectivity check]
type = connectivity
connectivity = a dummy IP address
repair = repair command

The connectivity type needs the following options to be set:

Option Explanation
connectivity a dummy IP address which is used as the UDP target, but in fact is never actually used.
repair This command is executed when the check was unsuccessful for longer than the set timeout.

The connectivity check is Linux-specific. We define a UDP socket with the given target address. The respective system call is only successful, if connectivity exists i.e., a network interface is up and running that allows to forward packets. This gives us the information whether our system is isolated or can communicate.

When creating this channel no packet is actually sent, we simply create the socket and check whether our own IP address is something other than 0.0.0.0.

This leads us to the following definition for the command option:

connectivity = 1.2.3.4

The next step is the repair action. We simply restart our networking with a systemctl command:

repair = sudo systemctl restart networking

Example

[my new connectivity check]
type = connectivity
connectivity = 1.2.3.4
repair = sudo systemctl restart networking

Options overwriting defaults

The following options overwrite default values from the [general] section, if need be:

Option Explanation
fallback This is the fallback action that is executed if repairing was unsuccessful
sleep time The daemon sleeps between checks of the current configuration for this time in seconds.
timeout The timeout defines the maximum allowed time between successful checks. If this is exceeded, then a repair action or a fallback action is executed
Clone this wiki locally