Search This Blog

2015-06-26

Changing MTU on Linux Bridges Dynamically

In order to change the MTU on linux bridges dynamically all portions of the connection must be changed to MTU 9000 prior to changing the bridge itself to MTU 9000.

To display existing MTU:

ip link show $interface_name


To change mtu on interface

ip link set $interface_name mtu $mtu_value


If you do not set all of the interfaces attached to the bridge to MTU 9000 first you will see the following error message if you try to set the MTU higher using either ifconfig or ip commands

ip command error

RTNETLINK answers: Invalid argument


ifconfig command error

SIOCSIFMTU: Numerical result out of range


Change all vnets on host:

for i in `ip link show | grep vnet | awk '{print$2}' | awk -F ':' '{print$1}'`; do ip link set $i mtu 9000; done


Change all vlan subif:

for i in `ip link show | grep "em1\.[0-9]" | awk -F '@' '{print$1}' | awk '{print$2}'`; do ip link set $i mtu 9000; done


Change all bridges:

for i in `ip link show | grep -E "em[0-9]-[0-9]-[0-9]{3}\:" | awk -F ':' '{print$2}'`; do ip link set $i mtu 9000; done



Referemces:
https://joshua.hoblitt.com/rtfm/2014/05/dynamically_changing_the_mtu_of_a_linux_bridge_interface/

No comments:

Post a Comment