← All posts

What is netifd? The hub of OpenWrt network interfaces

Grow through practice

No need to finish reading — test now

netifd is OpenWrt's network interface configuration daemon. It turns /etc/config/network into 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:

  1. creates network.interface.wan/lan objects;
  1. binds devices;
  1. invokes the protocol handler (dhcp, static, pppoe, …);
  1. the handler sends addresses/routes/DNS back through proto_*;
  1. 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

OperationEffect
uci commit networkwrites /etc/config/network only
ubus call network reloadnetifd rereads config and reconciles interfaces
ifup wanreload + down/up for that interface
ifdown wanbrings the interface down

Without commit, netifd cannot see the change; with commit but without reload, netifd does not apply it automatically.

Troubleshooting

  1. Interface exists but has no address

Check up, pending, available in ifstatus and the protocol handler log.

  1. network.interface.wan status says not found

netifd did not create the interface; check UCI and network reload.

  1. Address but no default route

Check ip route and the route field in ifstatus; DHCP routes come from the protocol script.

  1. Config change has no effect

Ensure uci commit + network reload; manual file edits do not apply by themselves.

  1. Missing protocol handler

/lib/netifd/proto/<proto>.sh missing or not executable leaves the interface in an error state.

  1. 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 netifd package (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

Practice

Found this useful?

I write about AI agents × embedded / edge AI. Subscribe, or email me a concrete problem.

Guestbook →Subscribe (RSS)Support

Comments 0

No comments yet — be the first!

No login required; name is optional.