4 tricks to speed up ssh connections
I use ssh connections to manage remote servers it’s one of the main task in my work, so over time I’ve learnt some tricks to speed up the connection phase of the ssh protocol, so in this article I’ll show you how to:
Configure ssh to use ipv4 only
Configure ssh to use a particular authentication method
Reuse SSH Connection
Disable the Dns lookup on server side
Also if you are interested in ssh you can take a look at my previous articles about How to keep ssh connections alive on Linux and how to keep a Permanent SSH Tunnels with autossh.
Please note I use these tweaks on my Ubuntu 13.04 and Arch Linux, older version of ssh could not have all these options.
Use ssh with IPV4 only.
Sometimes I can reach a server over IPv4, but not over IPv6. Other times the IPv6 connection it’s unstable or buggy, so being able to force an SSH connection over IPv4 can be handy, and it’s faster in some cases.
To force an IPV4 connection you can simply use this command on your computer:
ssh -4 email@example.com
This will connect to hostname.com only using IPV4 protocol, on the other hand if you want to force an IPV6 connection you can use the command:
ssh -6 firstname.lastname@example.org
Use ssh with a particular authentication method
In general the best way to authenticate it’s with an exchange of keys between the ssh client and the ssh server, in this way you don’t have to put your password every time you do a connection, but sometimes you don’t exchanges the keys between your client and the server and so you must use the good old password.
In this case you can use an option to skip the pubkey method and go directly to the password method, to do this use this command:
ssh -o PreferredAuthentications=keyboard-interactive -o PubkeyAuthentication=no email@example.com
You can also
Read more at Linux Aria
Comments are closed.