9

In Linux, how do you set the maximum segment size that is allowed on a TCP connection? I need to set this for an application I did not write (so I cannot use setsockopt to do it). I need to set this ABOVE the mtu in the network stack.

I have two streams sharing the same network connection. One sends small packets periodically, which need absolute minimum latency. The other sends tons of data--I am using SCP to simulate that link.

I have setup traffic control (tc) to give the minimum latency traffic high priority. The problem I am running into, though, is that the TCP packets that are coming down from SCP end up with sizes up to 64K bytes. Yes, these are broken into smaller packets based on mtu, but this unfortunately occurs AFTER tc prioritizes the packets. Thus, my low latency packet gets stuck behind up to 64K bytes of SCP traffic.

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

Is there something on Linux I can set? I've tried ip route and iptables, but these are applied too low in the network stack. I need to limit the TCP packet size before tc, so it can prioritize the high priority packets appropriately.

4

5 回答 5

9

您是否使用 tcp 分段卸载到网卡?(您可以使用“ethtool -k $your_network_device”查看卸载设置。)据我所知,这是唯一可以看到设备 MTU 为 1500 的 64k tcp 数据包的方法。这不是回答问题,而是它可能有助于避免误诊。

于 2012-10-31T18:42:07.753 回答
6

ip route带有选项的命令advmss有助于设置MSS值。

ip route add 192.168.1.0/24 dev eth0 advmss 1500
于 2018-03-19T18:32:06.560 回答
3

通告的 TCP MSS 的上限是第一跳路由的 MTU。如果您看到 64k 段,这往往表明第一跳路由 MTU 过大 - 您是否使用环回或其他东西进行测试?

于 2010-10-05T01:46:01.523 回答
1

MSS = MTU – 40 字节(标准 TCP/IP 开销为 40 字节 [20+20])

如果 MTU 为 1500 字节,则 MSS 将为 1460 字节。

于 2018-06-20T07:48:16.013 回答
-1

您肯定误诊了问题;正如其他人指出的那样,tc 没有看到 TCP 数据包,它看到了 IP 数据包,并且它们在那时已经成块了。

您可能只是遇到了缓冲区膨胀:您在一个完全独立的设备(可能是 DSL 调制解调器或电缆调制解调器)中超载了出站队列。唯一的解决方法是告诉 tc 将您的出站带宽限制为小于调制解调器的带宽,例如。使用 TBF。

于 2011-02-08T04:38:35.510 回答