IfState: Difference between revisions
Appearance
m ifstate: switch to non eui64 ipv6 example address from documentation prefix to improve readability, fix identify by mac address |
m ifstate/routing: remove dev to simplify config |
||
Line 23: | Line 23: | ||
{ | { | ||
to = "0.0.0.0/0"; | to = "0.0.0.0/0"; | ||
via = "192.0.2.1"; | via = "192.0.2.1"; | ||
} | } | ||
{ | { | ||
to = "::/0"; | to = "::/0"; | ||
via = "fe80::1"; | via = "fe80::1"; | ||
} | } |
Revision as of 19:42, 12 August 2025
IfState is a python 3 utility designed for declarative management of Linux network interfaces. It acts as a frontend to the kernel's Netlink interface, using the pyroute2
library to configure network settings such as IP addresses, bridges, traffic control, and WireGuard in an idempotent manner—much like an iproute2
/ethtool
/tc
/wg
wrapper.
It will be probably be available with NixOS 25.11 (see https://github.com/NixOS/nixpkgs/pull/431047).
Examples
You can find several examples on the IfState website. Due to the fact that these are yaml examples, I decided to provide some nix examples here too:
{
networking.ifstate = {
enable = true;
settings = {
interfaces.enp3s0 = {
addresses = [
"192.0.2.10/24"
"2001:db8:dead:c0de::10/64"
];
link = {
state = "up";
kind = "physical";
};
identify.perm_address = "00:00:5e:00:53:00";
};
routing.routes = [
{
to = "0.0.0.0/0";
via = "192.0.2.1";
}
{
to = "::/0";
via = "fe80::1";
}
];
};
};
}