[分享] 解決 Linux 系統 SSH 登錄變慢,修改 ssh 配置
- UID
- 6084
- 帖子
- 13
- 精華
- 10
- 積分
- 662
- 金幣
- 604
- 威望
- 28
- 推廣
- 0
- 閱讀權限
- 10
- 在線時間
- 5 小時
- 註冊時間
- 2009-3-6
|
1樓
發表於 2009-5-12 06:55
| 只看該作者
[分享] 解決 Linux 系統 SSH 登錄變慢,修改 ssh 配置
早先的時候,發現 ssh 登錄系統慢,是因為 ssh-server端設置了/etc/ssh/sshd_conf 文件 UseDNS yes,當DNS有問題時,導致登錄過程緩慢。而另一個導致 ssh 登錄慢的原因,仍然是因為DNS解析的問題。
因為機房的 DNS 解析又出現問題,於是問題顯現出來:ssh server 的登錄過程緩慢。ssh -v 「跟蹤」了一下,發現是GSSAPIAuthentication認證嘗試等待的時間較長。
後來發現原系統默認情況下 /etc/ssh/sshd_config 的配置裡,GSSAPIAuthentication 選項是 no ,貌似是系統自動升級成,變成了 yes,並且在 /etc/ssh/ssh_config 裡也添加了此選項,於是登錄過程中便多了 GSSAPIAuthentication 的嘗試。iptables 引起 ssh 登陸變慢
今天修改 iptables 設定,從嚴設計,結果啟用新規則後發現 ssh 局域網登陸變慢;外網登陸到沒問題。
修改 /etc/ssh/sshd_conf 文件,
#UseDNS yes
修改為 UseDNS no
保存後重起 sshd,
service sshd restart 問題解決。 參考:訪客無法瀏覽此圖片或連結,請先註冊或登入會員。ssh_config and GSSAPIAuthentication
The default Fedora ssh_config file comes with GSSAPIAuthentication set
to "yes". This causes a DNS query in an attempt to resolve
_kerberos.<hostname> whenever ssh is invoked. During periods when
connectivity to the outside world is interrupted for whatever reason,
the ssh session won't proceed until the DNS query times out. Not really
a problem, just more of an annoyance when trying to ssh to another
machine on the LAN.
Is there a reason why the default ssh_config comes with
GSSAPIAuthentication set to yes?
Thanks,
Jay
|
|
|
|
|
|