最近的一次更新, 讓 FreeBSD 主機在登入時, 速度變得很慢, 這對操作上有蠻大的影響, 於是問了同事, 也著手進行查詢相關的可能, 原來是 OpenSSH 的名稱反查問題, 簡單處理方式如下:
修改 /etc/ssh/sshd_config 檔內的一個 UseDNS 參數, 設為 no 即可.
官方說明連結: http://www.openssh.org/faq.html#3.3
3.3 – ssh(1) takes a long time to connect or log in
Large delays (more that 10 seconds) are typically caused a problem with name resolution:
- Some versions of glibc (notably glibc 2.1 shipped with Red Hat 6.1) can take a long time to resolve “IPv6 or IPv4” addresses from domain names. This can be worked around with by specifying AddressFamily inet option in ssh_config.
- There may be a DNS lookup problem, either at the client or server. You can use the nslookup command to check this on both client and server by looking up the other end’s name and IP address. In addition, on the server look up the name returned by the client’s IP-name lookup. You can disable most of the server-side lookups by setting UseDNS no in sshd_config.
下面還有如何判定是 “slow”
CPU | Time (SSHv1)[1] | Time (SSHv2) |
---|---|---|
170MHz SPARC/sun4m | 0.74 sec | 1.25 sec |
236MHz HPPA/8200[2] | 0.44 sec | 0.79 sec |
375MHz PowerPC/604e | 0.38 sec | 0.51 sec |
933MHz VIA Ezra | 0.34 sec | 0.44 sec |
2.1GHz Athlon XP 2600+ | 0.14 sec | 0.22 sec |
參考看看吧!