2

This is how I establish an SSH tunnel (dynamic port forwarding using SOCKS) from a local computer to a remote computer:

ssh -C -N -D 12345 [email protected] 

I use compression (-C) because my bandwidth is expensive and limited.

Is there a way to increase the compression level further? Version 1 of the SSH protocol had the CompressionLevel configuration option, but there is no equivalent option in version 2. I am open to the idea of using additional open source tools to achieve greater compression levels.

OS: Ubuntu 20.04.

8
  • What kind of traffic are you using via the tunnel? http? https? something else? If the traffic is encrypted you are unlikely to get any benefit, only increased latency, from compression. Commented Sep 1, 2021 at 15:53
  • I can only think of mosh.org Commented Sep 1, 2021 at 15:54
  • @icarus The traffic is mostly HTTP and HTTPS. Commented Sep 2, 2021 at 6:26
  • If the traffic is http and https your best approach is probably to make sure that your browser is sending requests for compressed pages. Compression works best when it is end-to-end where both the source can take advantage of any structure it knows about in the data, rather than putting in a general purpose compressor in the middle. Selecting "mobile friendly" versions of some sites, not downloading pictures until you actually want to see them, blocking adverts will probably be much more effective in lowering your bill than any small gain you get from extra transport compression. Commented Sep 2, 2021 at 14:26
  • 1
    That leaves you with either patching sshd and ssh or creating your own solution. BTW there's a patch to enable ZSTD compression which is leaps and bounds better than zlib used by SSH: spinics.net/lists/openssh-unix-dev/msg06877.html Commented Sep 17, 2021 at 6:21

1 Answer 1

5

SSHv2 doesn't support setting the level of compression.

You can approach the issue the following ways:

  • Patch the source code to enable a higher level of compression
  • Use nc in conjunction with some compression application of your choice, e.g. zstd, bzip2, xz, etc.
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.