4 Comments

  1. Below is a script I made that you can use to benchmark each cipher. I use /dev/zero, /dev/null, and localhost to eliminate potential i/o bottlenecks. The results should report realistic maximum transfer throughput. There is also the “openssl speed” benchmark, but I find that doesn’t produce accurate data transfer throughput results.

    The following code works on Linux, Mac OS X, and Solaris:
    for i in 3des-cbc aes128-cbc aes128-ctr aes128-gcm@openssh.com aes192-cbc aes192-ctr aes256-cbc aes256-ctr aes256-gcm@openssh.com arcfour arcfour128 arcfour256 blowfish-cbc cast128-cbc chacha20-poly1305@openssh.com rijndael-cbc@lysator.liu.se; do dd if=/dev/zero bs=1000000 count=1000 2> /dev/null | ssh -c $i localhost "(time -p cat) > /dev/null" 2>&1 | grep real | awk '{print "'$i': "1000 / $2" MB/s" }'; done

    With AES-NI acceleration, aes128-gcm@openssh.com is the fastest cipher on OpenSSH Intel systems… take a look:

    Intel Core i7-2635QM (MacBookPro8,2)/ Fedora 21:
    3des-cbc 18.34 MB/s
    aes128-cbc 167.54 MB/s
    aes128-ctr 230.26 MB/s
    aes128-gcm@openssh.com 328.37 MB/s
    aes192-cbc 158.13 MB/s
    aes192-ctr 228.28 MB/s
    aes256-cbc 148.89 MB/s
    aes256-ctr 222.80 MB/s
    aes256-gcm@openssh.com 317.49 MB/s
    arcfour 178.52 MB/s
    arcfour128 177.52 MB/s
    arcfour256 178.50 MB/s
    blowfish-cbc 66.75 MB/s
    cast128-cbc 58.68 MB/s
    chacha20-poly1305@openssh.com 131.70 MB/s
    rijndael-cbc@lysator.liu.se 149.04 MB/s

    Mac OS X 10.10 cipher support is abysmal compared to Linux, take a look at the results:
    Intel Core i7-2635QM (MacBookPro8,2)/ Mac OS X 10.10:
    3des-cbc 14.98 MB/s
    aes128-cbc 88.08 MB/s
    aes128-ctr 87.18 MB/s
    aes192-cbc 85.18 MB/s
    aes192-ctr 84.10 MB/s
    aes256-cbc 82.51 MB/s
    aes256-ctr 81.48 MB/s
    arcfour 133.93 MB/s
    arcfour128 133.99 MB/s
    arcfour256 133.93 MB/s
    blowfish-cbc 39.96 MB/s
    cast128-cbc 39.06 MB/s
    rijndael-cbc@lysator.liu.se 82.24 MB/s

    1. With automatic cipher selection:

      for i in `ssh -Q cipher`; do dd if=/dev/zero bs=1000000 count=1000 2> /dev/null | ssh -c $i localhost “(time -p cat) > /dev/null” 2>&1 | grep real | awk ‘{print “‘$i’: “1000 / $2″ MB/s” }’; done

  2. @Nikolas:
    You test are performed on the same hardware, just different OS ?
    If so, the difference is indeed quite impressive.

    Make sense that a CPU with AES hardware support performs better, no ?

    I think that you need to take into account both machine, a ssh is not usualy used to connect locally.

    I use ssh for two main purpose.
    – edit file remotely, using a screen and vi.
    – ssh -Y to forward some graphical application (wireshark for instance)

    the cipher, the MACs and the compression have huge and different impact according to the usecase.
    I use one dedicated ~/.ssh/config entry for each usecase, different parameters (to connect to the same server).
    I have different parameters per server, as some have aes hardware acceleration and some don’t.
    I also take into account the network, when I work on my laptop on wifi, I use different parameters than ethernet.

    Bref, it’s a very deep and non-deterministic science.
    I don’t think there is one config that rules them all.

Leave a Reply

Your email address will not be published. Required fields are marked *