How to Set MTU on "Bare" Wireless Interface Using config/UCI?

When using a wireless link for point-to-point or mesh applications, especially with tunnels or L2 protocols (B.A.T.M.A.N., for example), being able to use more than the "standard" MTU of 1500 has great value.

Even if bridged (and there is no reason for a bridge in these applications), the underlying MTU of the wireless link itself will put an upper bound on the bridge MTU.

However, I don't seem to be able to set the MTU using /etc/config/network directly. I've tried

/etc/config/wireless stanza:

config wifi-iface 'mesh1'
        option device 'radio5'
        option ifname 'mesh1' 
        option mode 'mesh'       
        option mesh_id '<redacted>'   
        option mesh_fwding '0'       
        option encryption 'psk2+ccmp'
        option key '<redacted>'  

/etc/config/network stanza:

config interface 'mesh1'
        option ifname 'mesh1'
        option mtu '2304'
        option proto 'static'

but the MTU doesn't show as 2304
(There is no need for an address on this interface, and configuration of routes is easier if there is not.)

21: mesh1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000
    link/ether <redacted> brd ff:ff:ff:ff:ff:ff

In the past I've "hooked" the netifd scripts to manage this directly

if [ "$ifname" = "mesh0" ] ; then
	ip link set dev mesh0 mtu 2304
fi

Is there a way that I can simplify my configuration and build by managing the MTU directly through /etc/config/network?

Use proto "none" for an interface with no IP address.

Don't know if that will change the MTU situation though.

No change in the MTU seen using

config interface 'mesh1'
        option ifname 'mesh1'
        option proto 'none'
        option auto '1'
        option mtu '2304'

Edit: With or without option auto '1', or with an explicit option auto '0'

cross referencing bug tracker https://bugs.openwrt.org/index.php?do=details&task_id=1998

From referenced ticket:

Use config device sections to set per-interface MTU.

The following snippets work for me [jow]:

config device
	option name wlan0
	option mtu 1511

config device                    
        option name wlan1
        option mtu 1512

Results in:

# ip link show wlan0 ; ip link show wlan1
166: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1511 qdisc noqueue > master br-lan state UP mode DEFAULT group default qlen 1000
    link/ether 04:f0:21:0f:78:bd brd ff:ff:ff:ff:ff:ff
175: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1512 qdisc noqueue master br-lan state UP mode DEFAULT group default qlen 1000
    link/ether 04:f0:21:0f:77:6e brd ff:ff:ff:ff:ff:ff
2 Likes

skipped option proto 'none'?

I haven't tried it yet, as I'm remote from my OpenWrt boxes right now, but note that it is a config device stanza, not a config interface stanza, that jow has shown.

1 Like

Missed that one but certainly makes totally sense in the layer model.

And it works, to the extent of max MTU 2304