/etc/config/network: config device section

In my /etc/config/network I have a config device section, but I didn't find anything in the docs about this type of section.

What is the meaning and purpose of this section? Where is it documented?

Can you show it to us?

I have that section on one router, it's used to define a MAC address.

config device 'wan_dev'
	option name 'eth0.2'
	option macaddr 'xx:xx:xx:xx:xx:xx'
1 Like

Documentation is scarce


That is one purpose but it can be used to manipulate a few more netdev (PHY) parameters:

  • option mtu

perhaps also

  • option enable_eee

There might be more but documentation is scarce and grepping UCI source with @device did not produce anything tangible either.

2 Likes

Thanks to everybody, who answered.

@lleachii The config device section you cited is the same I found in my /etc/config/network, only device name and macaddr differ.

I guess (and yes I really guess) the macaddr is bound to eth0.2. If eth0.2 is brigded with another device (e.g. wireless), the bridge inherits this macaddr.

On the other side you can have an option macaddr 'xx:xx:xx:xx:xx:xx' within a config interface section. In case the interface is a bridge, the bridge gets the macaddr (the eth0.2 macaddr is untouched). In case the interface is not a bridge, then eth0.2 inherits this macaddr.

Can anybody falsify or verify my guessing?

Does not relate to bridge operation/management but just spoofs a MAC, commonly on the WAN side when the ISP restricts access via MAC filtering.

Since being a logical interface (eth0.2), as opposed to a physical port, is seems curious that this is being entered into the config device section since it should be working all the same this way

config interface 'wan'
	option ifname 'eth0.2'
	option macaddr

eth0.2 is already a virtual (VLAN) bridge in itself

Some documentation about config device:
https://openwrt.org/docs/guide-user/network/vlan/switch_configuration#creating_driver-level_vlans

From @lleachii's example, I understand that the config device section can also be used for types of devices other than VLAN interfaces, and option vid does not seem to be required for those other types.

option enable_eee belongs in config switch_port.

eth0.2 is not a bridge itself, but it can become a bridge member.

1 Like

technically it is - same as the bridge Layer 2 linking principle - it bridges the netdev (PHY) ethX with the virtual ethX.N interface, or else there would be no connectivity between the two.

Maybe it is more apparent from the command (linking on Layer 2)

ip l a l ethX name ethX.N ty vlan id N


Which is pertinent to the legacy swconf driver handling VLAN config but there is no documentation


  • option macaddr
  • option mtu

are known to work for manipulating netdev (PHY) parameters and on devices with a build-in switch lanX ports are also netdev and thus option enable_eee should work to, least with the swconf driver but may not with the DSA driver.

There might be further options available for the config device section but that is where the documentation is scarce and the source code difficult to wade through.

The URL that I posted refers to the section "Creating driver-level VLANs".
This section does not apply to the swconf driver.