How to permanently modify the MTU setting of OpenWrt

I tried the common path of LINUX, but I couldn't find the relevant settings
CentOS / RHEL / Fedora Linux
vi /etc/sysconfig/network-scripts/ifcfg-eth0

Debian / Ubuntu Linux
vi /etc/network/interfaces

Does anyone know where to set it?

THANKS~

1 Like

You can either modify it in the web gui or by editing /etc/config/network

image

If you wish to edit the file manually, it would be in the relevant section for the interface

config interface 'wan'
	option mtu '1420'

You could alo use uci commands to add from the commandline, although it's probably quicker to edit the file than to spend time learning the syntax of the uci command

5 Likes

Thank you for your reply.
I have tested this method, but I don’t know why my Interface ETH0 is still MTU 1500. I have to use ifconfig eth0 MTU 9000 to completely change it. However, as long as the host is restarted, the setting will change back to MTU 1500. This method seems to be unable to directly change to the entity ETH0 at the same time

Hi
I have the same exact query. Did anything work for you?

Haven't found a solution yet🥲

What hardware do you use?
Most small plastic wireless access points with their integrated chips are not able to use an MTU of 9000.
My archer c7 for example has a maximum of 2304 or something other odd value.

If your device uses swconfig, it can give you the max. supported MTU. On dsa platform, I'm not quiet sure. Best option is still to check the data sheet of the vendor.

Besides that: etc config network is the place to make this persistent.

MTU 9000???? Huh??

Intel J4125
NIC Realtek RT8125B
I have tested that it can run MTU 9000,
I just want to know how to set the value permanently without reverting to MTU 1500 by restarting the host

Well, if you manually adjust behind UCIs back it is not all that surprising that during the start-up UCI changes that back... you could try adding your ifconfig line into /etc/rc.local so it gets re-applied during start-up. However I would guess that if hotplug ever triggers you are back to MTU 1500...

Did you have set the MTU for each interface in /etc/config/network or not?

Tried in sysctl ?

9000 is very common in enterprise and data center networks especially for storage or other bulk transfer.

1 Like

Yes, but you still need to insure that all upstream Ethernet switches, are also jumbo frame capable.

Yes and no. Within your layer 2 of course you have to ensure.
But everything else on layer 3 must not.