Route hooks

Route hooks are run with the “start” argument after a route is added and with the “stop” argument before it is removed.

After a route hook has been added, you must restart the bond from the management server or from the host command line to execute the hook the first time.

Hook locations:

  • /etc/bonding/route.d/all: hooks to be run for all routes
  • /etc/bonding/route.d/<route ID>: hooks for individual routes
  • /etc/bonding/route.d/default: hooks for routes with no individual hook folder

An example route hook is available at /usr/share/doc/bonding/examples/route-hook.

Environment variables

Route hooks are run with the following environment variables:

  • ID: the route ID
  • BOND_ID: the ID of the route’s bond
  • NETWORK: the network address of the route
  • NETMASK: the netmask of the subnet
  • VIA: the next hop for packets destined for the subnet
  • AGG_ROUTING: string describing aggregator routing mode: one of “auto”, “always”, or “never”.