Skip to content

Instantly share code, notes, and snippets.

@rany2
Last active January 9, 2024 14:25
Show Gist options
  • Save rany2/3b0a4c225977813a8847a89358e2f4de to your computer and use it in GitHub Desktop.
Save rany2/3b0a4c225977813a8847a89358e2f4de to your computer and use it in GitHub Desktop.
OpenWRT workaround for inability to set MTU for WLAN interfaces
#!/bin/sh
# Ensure that WLAN interface MTU is set to the maximum
# permitted value to prevent issues when attached to a
# bridge with jumbo MTU.
#
# Do not attempt to use standard UCI configuration
# in /etc/config/network and set the MTU with a config
# of type interface. It does not work consistently
# and in the best case works for the first WLAN
# interface in each respective radio that starts up
# only.
#
# NOTE: if you set the MTU via Luci it will work immediately
# after config is set, but after that it will not work.
# Do not let this deceive you, make sure to test that
# it works properly after WiFi restart and system reboot
# before getting rid of this hotplug script.
#
# To quickly install this do:
# wget -O /etc/hotplug.d/net/01-maxwlanmtu https://gist.github.com/rany2/3b0a4c225977813a8847a89358e2f4de/raw/01-maxwlanmtu
# echo /etc/hotplug.d/net/01-maxwlanmtu >> /etc/sysupgrade.conf
if [ "$DEVTYPE" = wlan ] && [ "$ACTION" = add ]
then
ip link set $INTERFACE mtu 2304
fi
@rany2
Copy link
Author

rany2 commented Apr 14, 2023

wget -O /etc/hotplug.d/net/01-maxwlanmtu https://gist.github.com/rany2/3b0a4c225977813a8847a89358e2f4de/raw/01-maxwlanmtu
echo /etc/hotplug.d/net/01-maxwlanmtu >> /etc/sysupgrade.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment