Summary
Add support for setting DHCP option 28 (MTU) in DHCP server configuration
Use case
When using VPNs or other types of tunneling (e.g. PPPoE) it is typically required to set an MTU lower than the physical interface MTU, to avoid issues with fragmentation
A common configuration:
- eth0 WAN mtu 1500
- wg0 mtu 1420
To avoid fragmentation as a result of *clients* using their default physical interface MTU, a common workaround is to use MSS clamp, which injects a TCP option into connections originating from the client, so that their tcp/ip stack effectively respects the MTU of the tunnel without any specific setting of the MTU on the interface
This is a widely used “solution” but it has problems, primarily that, as a TCP option, it can’t be used for UDP datagrams. If a client sends a UDP datagram larger than the tunnel MTU, bad things happen and I get sad
The proper solutions are either:
- Explicitly set the MTU on each client
- Provide the MTU dynamically to the client via DHCP option 28
Using option 28 is simpler, especially if you have multiple clients and/or need to change the MTU on the tunnel on the router and don’t want to update each clients interface
Additional information
- Option 28 is very simple and well documented. I don’t expect it to be problematic to add
- I’ve read not all DHCP clients honor this option, but my DHCP client on Linux does
- I previously used this option on an EdgeRouter (old Vyatta-based) and it worked very well for me