Addressing hooks

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

Hook locations:

  • /etc/bonding/addressing.d/all: hooks to be run for all addressings

  • /etc/bonding/addressing.d/<addressing ID>: hooks for individual addressings

  • /etc/bonding/addressing.d/default: hooks for legs with no individual hook folder

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

Environment variables

Addressing hooks are run with the following environment variables:

  • ID: addressing ID

  • IP: The local IP for this addressing

  • PREFIX_LENGTH: The size of the local network

  • GATEWAY: The next router

  • IFNAME: Name of the interface this addressing is associated with

  • LEG_ID: ID of the leg that this addressing is for