sysctl to clamp mtu on all application-initiatedsockets?
From: <hidden>
Date: 2014-11-16 00:37:07
Hi! I'm trying to setup routers that should be able to forward jumbo-packets, but applications should not get jumbo-capable sockets. The major brands of routers support something like this. You set mtu for forwarding to something big (8192, 9000) but don't touch the system mtu of 1500. Management-traffic, routing protocols and such communicate with <=1500byte packets, but the router can forward frames up to <big> mtu size if other machines feel like using them. The only ways I've found to do this is either through mss-clamping in iptables (+ some iptables rule that drop other packets and return ICMP Packet too big), or update each route on the router with an MTU argument, but it feels clunky and i believe this will cause quite some overhead which would impact forwarding-performance of the router negatively, It's also not nice to change tcp packet values on the fly. (The MTU on routes-path is quite a lot of work when running IPv4 DHCP client + IPv6 RA-learned routes + full BGP table on multiple boxes, it's easy to miss something) So, is it possible to create something like /proc/sys/net/ipv*/max_socket_mtu that would clamp the MTU of all created sockets to some nice value? It should also be possible to override this clamping on a per-socket basis (and use up to link-layer MTU size) by setting a flag or such on the socket, for example tunnels. I need to solve this some how for forwarding + VXLAN, but I believe this would also apply to and simplify management of other tunnel techniques. The tunnel interface should be able to transmit encapsulated packets using up to link-layer MTU size inside my datacenter/network, but applications on the same machine shouldn't when sending data somewhere since it would cause extra roundtrips / broken sessions when oversize packets are being dropped somewhere else in the network / on the Internet. Best regards Oskar Stenman