Declarative network stack configuration

IfState will (re)configure the hosts network stack configuration to match the desired configuration. As a result unspecified interfaces or ip addresses are automatically shutdown or removed. IfState reaches the desired network configuration from any previous state. Simular to ansible only those parts of the network stack that are referenced in the configuration file are taken into account.


On Alpine Linux IfState can be installed via apk and is packaged with a init script. IfState provides the CLI command ifstatecli as an interface.

Configuration file

IfState uses a YaML configuration file which needs to comply with the IfState Configuration Schema. The default filename of the config file is /etc/ifstate/config.yml.

This is a basic example configuration for a single interface and a default route:

# yaml-language-server: $schema=

## default/implicit interface settings (optional)
# defaults: …

## global sysctl options (optional)
# options: …

## ignore settings to ignore existing interface, ip addresses, … (optional)
# ignore: …

## load and pin bpf programs (optional)
# bpf: …

## "cake shaper" templates (optional)
# cshaper: …

## interface configuration block (required)
- name: eno1
    state: up
    kind: physical
    businfo: 0000:00:1f.6

## routing settings (optional)
  - to:
  rules: []

## configuration for netns namespaces (optional)
# namespaces: …

Top-level setttings of the configuration file:

The JSON schema of the configuration file is available in the JSON Schema Store (as ifstate.conf). Most modern editors and IDEs have native support for JSON Schema Store.

Adding the following line to the configuration file instructs editors and IDEs using the YAML Language Server to load the IfState schema automatically:

# yaml-language-server: $schema=

VRRP actions & Keepalived

IfState can be combined with Keepalived as a notify script. The vrrp option for interface and routing settings allows to reconfigure parts of the network stack depending on the state of a VRRP instance or group. This allows to move complex network configuration out of Keepalived while still using it for VRRP.