Ubuntu – Changing TCP window size on an Ubuntu server

tcpUbuntu

Is there any way to start with a larger than default TCP window size on an ubuntu server?

I see there are some parameters in /proc/sys/net/ipv4/ e.g:

/proc/sys/net/ipv4/tcp_window_scaling (which is 1)

/proc/sys/net/ipv4/tcp_adv_win_scale (2)

/proc/sys/net/ipv4/tcp_slow_start_after_idle (1)

/proc/sys/net/ipv4/tcp_window_scaling (1)

Best Answer

Since TCP is full duplex, there are two initial congestion windows (IW), one for sending and one for receiving. They can be set with the route command, however I found in 2.6.32 that it didn't work after looking at the packet captures. On my Desktop (3.0.0) the IW is higher (10 packets) as default, so I haven't tested this in the later version since that is what I wanted the increase to be.

In theory though, these can be set with ip route with something like:

sudo ip route add <DEST IP> via <GATEWAY IP> proto static initcwnd 10

For the sending IW. For the recieve IW change initcwnd to initrwnd.

If this is working, I believe you should the new window size reflected in the SYN or the SYN/ACK packet (depending on the send/receive window) of the TCP handshake.. Since the congestion window is internal and different from the window in the TCP header, the only way to tell it is working is to test on a higher latency connection and see if more initial packets get send. I have just been looking at this myself recently, so as a disclaimer I am 100% positive about all of this.

After this the window size should scale with default Linux parameters without causing any issues in terms of being Window bound. You probably don't want to mess with this unless you have capture showing that you frequently are running into situations where you are window bound (The receiver will send a large amount of packets with Win 0 if this is the case.)