# how to set MTU on bridged network?

## elkhunter

I recently switched to using KVM for virtualization and set up a bridged network but now my MTU is back to the default 1500 bytes.  How can I configure a larger MTU size to support jumbo frames?  I tried adding 'mtu_br0="9000"' but that didn't work.

----------

## elkhunter

I was able to set the mtu in /etc/conf.d/net by adding a "net_tap#="9000" line for each tap interface.  However to set the mtu for eth0 and br0 I had to add the following script:

cat /etc/local.d/fixmtu.start

ifconfig eth0 mtu 9000

ifconfig br0 mtu 9000

I then updated the VMs and verified I could send 9K pings.

----------

## khayyam

elkhunter ...

rather than use local.d you could use a postup() function ...

/etc/conf.d/net

```
postup() {

# test condition of some sort ... 

if [ ${IFACE} = "eth0" ] ; then

  ifconfig eth0 mtu 9000

  ifconfig br0 mtu 9000

fi

return 0

}
```

best ... khay

----------

## Cyker

IIRC, last time I did this I set the mtu for all the component NIC's (e.g.  mtu_eth0="9000" mtu_randomudevnamep1s2="9000" etc.) rather than the br0 and it picked up the MTU from the components?

The bridge device seems to take most of its config from the NIC with the lowest MAC address.

----------

## elkhunter

I tried adding the postup() but it didn't work.  Both eth0 and br0 still showed a mtu of 1500.  The only way I've been able to set them every boot is via the local.d/ script.

----------

## khayyam

 *elkhunter wrote:*   

> I tried adding the postup() but it didn't work.  Both eth0 and br0 still showed a mtu of 1500.  The only way I've been able to set them every boot is via the local.d/ script.

 

elkhunter ... hmmm, what interface is actually brought up via /etc/init.d/net.*, br0? If this is the case then change the test condition as it will need to match the ${IFACE}  ...

```
postup() {

# test condition of some sort ...

if [ ${IFACE} = "br0" ] ; then

  ifconfig eth0 mtu 9000

  ifconfig br0 mtu 9000

fi

return 0

}
```

best ... khay

----------

## szatox

I noticed it's impossible to do that on a bridge that doesn't enslave interfaces with jumbo already enabled.

it will work on a bridge with a device that has jumbo enabled

It won't work on empty bridge

It won't work on a bridge with a device that has jumbo disabled

not tested: bridge with interfaces that have different settings.

Kind of a pitfall  :Rolling Eyes: 

----------

