How to change mtu size?

  • Is there a way to permanently change mtu? ifconfig and ip commands won't survive reboot.

    Connman maybe? although I didn't find any mtu parameter under the connman interfaces.

    My 10gbe network run much better on 9000 mtu. I just need it to live after reboot....

  • Create /storage/.config/system.d/mtuchange.service with ^ then "systemctl enable /storage/.confg/mtuchange.service" and "systemctl start mtuchange.service" .. it's a guess (not tested) but should run after connman starts and before the network goes online.

  • Create /storage/.config/system.d/mtuchange.service with ^ then "systemctl enable /storage/.confg/mtuchange.service" and "systemctl start mtuchange.service" .. it's a guess (not tested) but should run after connman starts and before the network goes online.

    thanks. working!!

    Tried for days to achieve this. mostly with Autostart and always failed with connection to sql database

  • autostart.sh runs at the start of userspace boot long before networking is up, so the only way to sequence things is backgrounding with a sleep delay and then hoping the timing remains consistent over time. Using a systemd service allows proper sequencing to remove all the guesswork on timing.

  • Create /storage/.config/system.d/mtuchange.service with ^ then "systemctl enable /storage/.confg/mtuchange.service" and "systemctl start mtuchange.service"

    Just to be sure: I guess, that should be

    Create /storage/.config/system.d/mtu.change.service

    and then copy & paste your code lines and save it

    and then

    systemctl enable /storage/.config/system.d/mtu.change.service

    followed by

    systemctl start mtu.change.service

  • Unfortunately, my Rasperry Pi tells me at the boot process and executing the above

    /usr/sbin/ifconfig eth0 mtu 9000 up

    ifconfig: SIOCSIFMTU: Invalid argument

    How should the syntax be set to get the MTU working with a value 9000 ?

  • The maximum MTU size supported on RPi boards is 1500, hence the "Invalid argument" error.

    See https://github.com/raspberrypi/linux/issues/5561 and https://github.com/raspberrypi/linux/pull/5534 and an earlier refused PR trying to add the same (not something I'd recommend trying) https://github.com/raspberrypi/linux/pull/5419.

    It might be possible to get Jumbo frames with an external USB-C NIC, but I couldn't recommend one, and IMHO there's no real need for Jumbo frames on RPi hardware. RPi 0/1/2/3 are too slow to really benefit and RPi4/5 are already fast enough that the benefit will be negligible under real-world usage (the only real difference will be under un-real lab tests).