Skip to content

Instantly share code, notes, and snippets.

@nfhipona
Last active May 25, 2022 14:04
Show Gist options
  • Save nfhipona/fb8c6d794ec2e5576f3cfeb25cf024ed to your computer and use it in GitHub Desktop.
Save nfhipona/fb8c6d794ec2e5576f3cfeb25cf024ed to your computer and use it in GitHub Desktop.
TCP Upload Speed - Congested network

sysctl net | grep net.inet.tcp | egrep -i "cubic|reno"

net.inet.tcp.cubic_sockets: 36 net.inet.tcp.newreno_sockets: 0 net.inet.tcp.use_newreno: 0 net.inet.tcp.cubic_fast_convergence: 0 net.inet.tcp.cubic_minor_fixes: 1 net.inet.tcp.cubic_rfc_compliant: 1 net.inet.tcp.cubic_tcp_friendliness: 0 net.inet.tcp.cubic_use_minrtt: 0

Reddit Question: https://www.reddit.com/r/ProtonVPN/comments/uxe4kx/general_question_upload_speed/?utm_source=share&utm_medium=web2x&context=3

StackOverflow: https://apple.stackexchange.com/questions/12062/how-do-you-set-the-tcp-congestion-control-algorithm-on-os-x

The command is sysctl -w net.inet.tcp.newreno=1 which you could reverse with sysctl -w net.inet.tcp.newreno=0 if you had issues with it.

Windows:

https://docs.microsoft.com/en-us/windows-server/networking/technologies/netsh/netsh-contexts

Command: netsh interface tcp show global

Guides:

https://homepages.rpi.edu/~wangy52/PersonalWebsite/build/html/Network/NetworkProgramming/CheckTCPCCVariation.html

Which TCP Congestion Control Variation Your System is Using?

Linux

# get the current CC algorithm
sysctl net.ipv4.tcp_congestion_control

# get available CC algorithms
sysctl net.ipv4.tcp_available_congestion_control

MacOS

# list all network related configurations
sysctl -a | grep net.inet.tcp

# search for cubic
sysctl -a | grep net.inet.tcp.cubic

# search for new reno
sysctl -a | grep net.inet.tcp.newreno

Windows

Client version (win vista/7/10) default NewReno, can be manually switched to Component TCP (CTCP). Server version (server 2008/2019 etc) default DCTCP (Data Center TCP), can be switched to CTCP as well.
# configure to ctcp
netsh interface tcp set global congestionprovider=ctcp

# configure back to it's default
netsh interface tcp set global congestionprovider=none

# check current configurations
# Parameter "Add-On Congestion Control Provider" "none" : not CTCP, "ctcp": is CTCP.

netsh interface tcp show global

PowerShell Get-Help Get-NetTCPSetting -detailed


Step 1: Open Command Prompt as administrator. If you don't know how to find this, just hit the Windows key on your keyboard, type "CMD" in the search bar, and it's right there. Right click -> run as administrator. If you did this right, the start of the line you're prompted to type on should read C:\WINDOWS\system32>.

Step 2: In command prompt, type the following two commands exactly:

  1. netsh int tcp set supplemental internet congestionprovider=ctcp
  2. netsh int tcp set global ecncapability=enabled

After both of these, you should see the output message "Ok." This is good.

Next, we're going to confirm that both of these worked. Open Windows Powershell as administrator (again, Windows key -> search "powershell" -> right click -> run as administrator). The line you're about to type on should read PS C:\WINDOWS\system32>.

You're going to enter the following three commands:

  1. get-NetTCPSetting. This is gonna drop a whole list of stuff you don't have to understand. If you do, great. This is a few separate lists of settings. Find the one that starts with SettingName: Internet (it should be the last one). Three lines below it you should see CongestionProvider: CTCP.
  2. netsh interface tcp show supplemental. The third line of settings that output should read Congestion Control Provider: ctcp.
  3. netsh interface tcp show global. On the fourth line of the list of settings that output, you should see ECN Capability: enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment