How to set maximum maximum TCP segment size on Linux?

On Linux, how do you set the maximum segment size that is allowed for a TCP connection? I need to install this for an application that I have not written (therefore I cannot use setsockoptfor this). I need to install this ABOVE mtu on the network stack.

I have two streams that use the same network connection. Small packets are sent periodically for which an absolute minimum delay is required. Another sends tons of data - I use SCP to simulate this link.

I have a traffic control (tc) setting to ensure that the minimum traffic is high priority. The problem I encountered is that the TCP packets that converge with SCP end up in size up to 64 Kbytes. Yes, they are broken down into smaller mtu-based packages, but this, unfortunately, happens after tc prioritizes the packages. So my low latency packet gets stuck behind up to 64 Kbytes of SCP traffic.

This article states that on Windows you can set this value.

Is there anything on Linux that I can install? I tried the ip route and iptables, but they are too low on the network stack. I need to limit the TCP packet size to tc so that it can correctly assign high priority packets.

+5
source share
4 answers

Do you use tcp segmentation offload in nic? (You can use "ethtool -k $ your_network_device" to see the offload settings.) This is the only way, as far as I know, that you will see 64k tcp packets from the MTU of device 1500. Not that this answers the question, but it can help avoid an erroneous diagnosis.

+5
source

The upper bound of the advertised TCP MSS is the MTU of the first hop route. If you see 64k segments, this indicates that the MTU with the first move is too large - are you using loopback or something for testing?

+2
source

; - , tc TCP-, IP-, .

You are probably just worrying about bufferbloat : you are overloading your outgoing queue on a completely separate device (maybe a DSL modem or cable modem). The only fix is ​​to tell tc to limit the outgoing bandwidth to less than the modem bandwidth, for example. using TBF.

0
source

ip routea command with an option advmsshelps to set the value MSS.

ip route add 192.168.1.0/24 dev eth0 advmss 1500
0
source

All Articles