babeld-cli.sh

babeld has an interface for dumping information, which by default listens on TCP port 33123. This is also used by babelweb, for example, to create the graph. Unfortunately, babeld does not provide a tool to use this interface. However, simple tools such as bash, netcat, grep and awk are sufficient to receive and interpret the results.

A ready-made script for this is available on Codeberg available.

Installation

The installation can be done by cloning the repository with git:

$ git clone https://codeberg.org/mark22k/babeld_helper.git

Alternatively, you can just download the script and make it executable:

$ wget https://codeberg.org/mark22k/babeld_helper/raw/branch/main/babeld-cli.sh
$ chmod +x ./babeld-cli.sh

or

$ curl --output babeld-cli.sh https://codeberg.org/mark22k/babeld_helper/raw/branch/main/babeld-cli.sh
$ chmod +x ./babeld-cli.sh

Usage

Once the script is executable, it can be called with ./babeld-cli.sh [options]. [options] can take the following values interfaces, neighbors, routes, xroutes or version. Interfaces returns the configured interfaces, Neighbors returns the actually active neighbors, Routes returns all (not only installed) routes, xroutes returns the own routes that are propagated and version returns the version number of the running babeld.

Interfaces

Interfaces returns three columns Interface, State and Next hop.

Neighbors

Neighbors returns nine columns Neighbor ID, IP address, Interface, Reach, RX cost, TX cost, RTT, RTT cost and Cost. 'Neighbor ID' indicates the ID of the neighbor, 'IP address' the IP address of the neighbor, 'Interface' indicates the interface on which the neighbor is located, 'RX cost' the configured RX costs, 'TX cost' the RX cost configured by the peer, 'RTT' the current round trip time in MS, 'RTT cost' the additional RX costs based on the RTT and 'Cost' the addition of the configured RX costs and the RTT RX costs - i.e. the real actual costs. RX costs are the costs that the neighbor needs to reach us.

Routes

Note: The output can be very long.

Routes returns eight columns Route ID, Prefix, Installed, ID, Metric, Refmetric, Next hop and Interface. Prefix specifies the actual prefix, Installed specifies whether the route is installed in the kernel or the forwarding plane and thus effectively whether it is the preferred route, Metric specifies the cost of this route to the destination, Refmetric specifies the cost of this route to the destination, but without this node or the cost of the neighbor to the destination, Next hop specifies the next hop and Interface specifies the interface on which the next hop is located.

XRoutes

XRoutes returns two columns. Prefix indicates the prefix which is to be propagated and Metric the costs for this prefix (normally 0).

Version

Version returns three values. Firstly, the current babeld version that is currently running, the name of the host on which it is running and the configured router ID.