What is netifd? The hub of OpenWrt network interfaces
Grow through practice
No need to finish reading — test nownetifd is OpenWrt's network interface configuration daemon. It turns
/etc/config/networkinto interface/device/route state and exposes it over ubus for ifup, LuCI, firewall and other services.
Where it sits
/etc/config/network (UCI)
↓
netifd
├─ interface state machine
├─ device management
├─ protocol handlers /lib/netifd/proto/*.sh
└─ ubus: network.interface.* / network.device.*
↓
ip / routing / firewall / DNS
netifd is not the firewall and not DNS. It owns “is the interface up, what address/routes did it get”, and other components consume that.
Startup
/etc/init.d/network starts /sbin/netifd through procd:
procd_set_param command /sbin/netifd
procd_set_param respawn
procd_set_param watch network.interface
Reload does not restart the process:
ubus call network reload
/etc/init.d/network reload ends up calling the same ubus method.
UCI → interface state
config interface 'wan'
option proto 'dhcp'
option device 'eth0'
config interface 'lan'
option proto 'static'
option device 'br-lan'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
netifd:
- creates
network.interface.wan/lanobjects;
- binds devices;
- invokes the protocol handler (
dhcp,static,pppoe, …);
- the handler sends addresses/routes/DNS back through
proto_*;
- netifd updates state and emits ubus events.
Protocol handlers
Handlers are shell scripts under /lib/netifd/proto/. The DHCP script uses:
proto_init_update "*" 1
proto_add_ipv4_address "$ip" "$netmask"
proto_add_ipv4_route 0.0.0.0 0 "$gateway" "$ip"
proto_send_update "$interface"
These functions come from /lib/netifd/netifd-proto.sh. A custom protocol should implement this interface instead of editing /etc/config/network directly.
Common commands
# all interfaces
ubus call network.interface dump
# one interface
ubus call network.interface.wan status
ifstatus wan
# device
ubus call network.device status '{"name":"eth0"}'
devstatus eth0
# reload configuration
ubus call network reload
/etc/init.d/network reload
# one interface
ifup wan
ifdown wan
ifup is not just an “up” event: the OpenWrt script first calls ubus call network reload, then performs down/up for that interface.
commit vs reload vs ifup
| Operation | Effect |
|---|---|
uci commit network | writes /etc/config/network only |
ubus call network reload | netifd rereads config and reconciles interfaces |
ifup wan | reload + down/up for that interface |
ifdown wan | brings the interface down |
Without commit, netifd cannot see the change; with commit but without reload, netifd does not apply it automatically.
Troubleshooting
- Interface exists but has no address
Check up, pending, available in ifstatus and the protocol handler log.
network.interface.wan statussays not found
netifd did not create the interface; check UCI and network reload.
- Address but no default route
Check ip route and the route field in ifstatus; DHCP routes come from the protocol script.
- Config change has no effect
Ensure uci commit + network reload; manual file edits do not apply by themselves.
- Missing protocol handler
/lib/netifd/proto/<proto>.sh missing or not executable leaves the interface in an error state.
- Logs
logread -e netifd, plus ubus monitor for interface events.
Boundary with prplOS/AMX
- prplOS remains OpenWrt-based; netifd still manages Linux network interfaces.
- AMX/TR-181 is the management-plane object model; a UCI backend can translate objects into
/etc/config/network. - AMX does not replace netifd and does not turn its object tree into interfaces automatically.
- The chain remains: object model → UCI backend → UCI → netifd → kernel.
Verification
- ✅ Source/scripts: prplOS
netifdpackage (7901e66, 2025-05-23),/etc/init.d/network,ifup,ifstatus,dhcp.script. - ✅ Command semantics:
network reload,ifup, ubus objects. - ⚠️ Not tested on physical hardware; state/protocol behavior varies by firmware and handler.
- ❓ Not covered: netifd internal state-machine source and every protocol handler difference.
Series: OpenWrt Related: UCI guide · From UCI to a data model · prplOS UCI backend
Comments 0
No comments yet — be the first!