[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ssh连接慢的问题?





2008/11/12 Ding Honghui <hhding.gnu@gmail.com>
Arthur Wong wrote:
> 感谢你的提议,我修改之后感觉确实快了不少!
>
> To Ding Honghui :
> 请问mdns与dns有什么区别,或者说mdns比dns先进在什么地方 ?
>
> 2008/11/12 隋金鑫 <suijinxin@hit.edu.cn <mailto:suijinxin@hit.edu.cn>>
>
>     Ding Honghui,您好!
>
>        我在debian下这么设置的,不知道是否对你有用:
>
>     编辑/etc/nsswitch.conf文件,文件内容如下,注释掉hosts一行,把hosts改
>     为如下所示:
>
>     # /etc/nsswitch.conf
>     #
>     # Example configuration of GNU Name Service Switch functionality.
>     # If you have the `glibc-doc-reference' and `info' packages
>     installed, try:
>     # `info libc "Name Service Switch"' for information about this file.
>
>     passwd:         compat
>     group:          compat
>     shadow:         compat
>
>     #hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4
>     hosts:          files dns
>     networks:       files
>
>     protocols:      db files
>     services:       db files
>     ethers:         db files
>     rpc:            db files
>
>     netgroup:       nis
>
>
>     ======= 2008-11-12 12:33:48 您在来信中写道:=======
>
>     >LI Daobing (李道兵) wrote:
>     >> 2008/11/12 Arthur Wong <wzc0066@gmail.com
>     <mailto:wzc0066@gmail.com>>:
>     >>>
>     >>> 2008/11/12 LI Daobing (李道兵) <lidaobing@gmail.com
>     <mailto:lidaobing@gmail.com>>
>     >>>> 2008/11/12 Arthur Wong <wzc0066@gmail.com
>     <mailto:wzc0066@gmail.com>>:
>     >>>>> Hello all :
>     >>>>>
>     >>>>> 记得以前用ubuntu6.06的时候,如果是局域网内 ssh 连接到其它机
>     器,很快就能看到输入密码的提示信息出现;
>     >>>>> 但现在每次都要等半天(至少有 30s 吧, 当然还是局域网内),请问
>     大家有这种问题吗?
>     >>>>> 有没有什么办法加快一点昵 ?
>     >>>>>
>     >>>> 关掉SSH服务器的 Dns 试试, 在 /etc/ssh/sshd_config 中加入 UseDNS
>     no, 参见 sshd_config(5)
>     >>> Thank you very much.
>     >>>
>     >>> 我已经在 /etc/ssh/sshd_config 中最后一行添加了 UseDNS no,
>     >>> 并且重启了sshd服务,但好像没什么效果,ssh本地服务器还是需要很长
>     时间等待,请问该如何使配置生效 ?
>     >>>
>     >> 这样不行就只能查 log 了,我也没有其他办法了。
>     >>
>     >>
>     >>
>     >还有可能就是尝试了kerbose的认证。。
>     >可以用ssh -vvv host来看看到第什么地方等待时间比较长。
>     >
>     >
>     >--
>     >To UNSUBSCRIBE, email to debian-chinese-gb-REQUEST@lists.debian.org
>     <mailto:debian-chinese-gb-REQUEST@lists.debian.org>
>     >with a subject of "unsubscribe". Trouble? Contact
>     listmaster@lists.debian.org <mailto:listmaster@lists.debian.org>
>     >
>
>     = = = = = = = = = = = = = = = = = = = =
>
>
>     致
>     礼!
>
>
>     隋金鑫
>     suijinxin@hit.edu.cn <mailto:suijinxin@hit.edu.cn>
>     2008-11-12
>
>
mdns[1]主要是用来解决zeroconf的问题,一般用于局域网内来解析主机名。在
linux中的实现是,每个主机运行一个mdns的daemon,让客户地查询的时候,返回
自己的主机名。譬如你的主机名叫做abc,那么如果你在nsswitch.conf里面配置了
需要支持mdns解析的话,那么你就可以通过ping abc.local, ssh abc.local等来
访问这个机器。其实实质上应该是gethostbyname那里读取了nsswitch.conf,然后
调用相应的实现来获取地址的。它的好处是,不用配置。

[1] http://www.multicastdns.org/

非常感谢!
如果我们更改了nsswitch.conf里的配置,去掉了mdns的支持,那对平时的使用有没有什么消极的影响 ?
( 如果仅仅为了缩短ssh的连接时间而影响其它功能的正常使用,就有些得不偿失了)

Reply to: