1. No DNS lookups for SFTP users

关闭DNS解析

useDNS no  

2. 心跳保活

ServerAliveInterval: 客户端等待服务端时间
ClientAliveInterval: 服务端等待客户端时间

 ServerAliveInterval 120 
 ServerAliveCountMax 8

3. Session Multiplexing

多路复用,1对多时候,避免重复开启ssh进程,只保持一个socket,只需要在客户端设置。

  ControlMaster auto
  ControlPath ~/.ssh/%r@%h-%p      
  ControlPersist  12h  

添加到 /etc/ssh_config

总体配置:
Host  *         
  Compression yes
  ServerAliveInterval 60
  ServerAliveCountMax 5
  ControlMaster auto
  ControlPath ~/.ssh/%r@%h-%p      
  ControlPersist  12h

4.保持SSH服务端客户端版本一致 

Reference:

keep alive

https://patrickmn.com/aside/how-to-keep-alive-ssh-sessions/  

Wiki

https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Multiplexing  

OpenSSH Multiplexer To Speed Up OpenSSH Connections

https://www.cyberciti.biz/faq/linux-unix-osx-bsd-ssh-multiplexing-to-speed-up-ssh-connections/  

https://blog.scottlowe.org/2015/12/11/using-ssh-multiplexing/


大卫刘
1 声望1 粉丝

不断探索未知吧~


下一篇 »
运维之道