Bug #4397
closed
MTU must be set in same ifconfig command as IP
Added by Chris Buechler almost 10 years ago.
Updated about 9 years ago.
Description
Where MTU on an interface is user-defined, the ifconfig command that assigns the IP and IPv6 addresses must include the MTU. For instance, this:
ifconfig vmx1 mtu 9000
ifconfig vmx1 inet 192.168.1.1 netmask 255.255.255.0
You'll end up with the NIC at MTU 9000, but the link route for 192.168.1.0/24 will be 1500. Doesn't matter if the MTU is set before or after the IP, this is the case.
If you instead run:
ifconfig vmx1 inet 192.168.1.1 netmask 255.255.255.0 mtu 9000
Then both the interface and the link route have the correct MTU. This affects IPv6 the same way, with the same resolution.
- Status changed from Confirmed to Feedback
I pushed a fix which make it work for me.
Can you please confirm?
Normally it is not necessary to have the mtu on the same line just the interface needs to be up from my testing.
- % Done changed from 0 to 100
- Status changed from Feedback to Confirmed
setting the MTU before setting the IP doesn't behave any differently. The MTU must be appended to the ifconfig command that sets the inet and inet6 addresses for this to work.
This should work as is on 2.2 in FreeBSD head it has been fixed with:
Finish r274175: do control plane MTU tracking.
Update route MTU in case of ifnet MTU change.
Add new RTF_FIXEDMTU to track explicitly specified MTU.
Old behavior:
ifconfig em0 mtu 1500->9000 -> all routes traversing em0 do not change MTU.
User has to manually update all routes.
ifconfig em0 mtu 9000->1500 -> all routes traversing em0 do not change MTU.
However, if ip[6]_output finds route with rt_mtu > interface mtu, rt_mtu
gets updated.
New behavior:
ifconfig em0 mtu 1500->9000 -> all interface routes in all fibs gets updated
with new MTU unless RTF_FIXEDMTU flag set on them.
ifconfig em0 mtu 9000->1500 -> all routes in all fibs gets updated with new
MTU unless RTF_FIXEDMTU flag set on them AND rt_mtu is less than ifp mtu.
route add ... -mtu XXX automatically sets RTF_FIXEDMTU flag.
route change .. -mtu 0 automatically removes RTF_FIXEDMTU flag.
PR: 194238
MFC after: 1 month
CR: D1125
- Target version changed from 2.2.1 to 2.2.2
- Target version changed from 2.2.2 to 2.2.3
- Status changed from Confirmed to Feedback
This should work as expected on newer versions.
- Target version changed from 2.2.3 to 2.3
- Assignee changed from Ermal Luçi to Chris Buechler
- Status changed from Feedback to Resolved
The fix above noted in "do control plane MTU tracking" is in 2.3/10-STABLE and works, which fixes this.
Also available in: Atom
PDF