同一局域网内 ssh 连接建立缓慢

同一局域网内 ssh 连接建立缓慢

你好,连接同一 LAN 上的某些 SSH Linux 服务器大约需要 10 秒:

me@PC-A $ time ssh X.Y.Z.T :
Warning: Permanently added 'X.Y.Z.T' (RSA) to the list of known hosts.

real    0m10.168s
user    0m0.005s
sys     0m0.004s

但一旦登录XYZT:

me@serverA $ time ssh localhost :
root@localhost's password:

real    0m0.518s
user    0m0.022s
sys     0m0.010s

这是 sshd_config:

me@serverA $ egrep -v "^(#|$)" /etc/ssh/sshd_config
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
SyslogFacility AUTHPRIV
AuthorizedKeysFile      .ssh/authorized_keys
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
UsePAM yes
X11Forwarding yes
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem       sftp    /usr/libexec/openssh/sftp-server

以及有关负载的一些信息:

me@serverA $ free -m
              total        used        free      shared  buff/cache   available
Mem:         128672       27136        3197        4089       98338       89989
Swap:         17407          14       17393
me@serverA $ top | head -15
top - 12:32:41 up 60 days, 20:39,  1 user,  load average: 0.45, 1.46, 1.64
Tasks: 455 total,   1 running, 454 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.3 us,  2.0 sy,  0.0 ni, 96.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 13176076+total,  3230140 free, 27788596 used, 10074203+buff/cache
KiB Swap: 17825788 total, 17811452 free,    14336 used. 92147944 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 4624 root      20   0   58824   2384   1480 R  11.8  0.0   0:00.03 top
20726 root      20   0 2086772 596588   3908 S  11.8  0.5   1995:02 bizstorenode
20729 root      20   0 2375864   1.1g   3948 S  11.8  0.9   4161:04 bizstorenode
 4626 root      20   0  159464   3740   2780 S   5.9  0.0   0:00.01 biziodf
 9278 root      20   0 1209128  57952   5000 S   5.9  0.0  87:11.35 /usr/bin/python
 9299 root      20   0  457408  62472   2420 S   5.9  0.0   3859:49 python sagentd/
20719 root      20   0 2063592 547224   3924 S   5.9  0.4   2072:04 bizstorenode
20727 root      20   0 2071220 584648   3908 S   5.9  0.4   2029:08 bizstorenode

刚刚启动了sysstat服务,还没安装,所以暂时还没有sar数据。

EDIT0:命令的结果dig

me@serverA $ time dig +short -x X.Y.Z.T

real    0m0.007s
user    0m0.000s
sys     0m0.003s

相关内容