新增文档
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
2025-11-06 20:09:07 +08:00
parent 3db787451b
commit 74bca24ec4
2 changed files with 88 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
> 本文作者:丁辉
# Xshell连接Centos7-2009缓慢
## 问题原因
`UseDNS yes` 用于 SSH 连接时的 DNS 反向解析SSH 一直检测 DNS 导致连接缓慢。
## 工作原理
### 默认行为 (`UseDNS yes`)
```bash
# SSH连接建立过程
1. 客户端发起连接 → 服务器
2. 服务器获取客户端IP → 执行DNS反向解析
3. DNS查询客户端IP的主机名 → 可能耗时
4. 然后执行DNS正向解析验证 → 可能再次耗时
5. 最后才进行身份认证
```
### 禁用后 (`UseDNS no`)
```bash
# SSH连接建立过程
1. 客户端发起连接 → 服务器
2. 服务器直接进行身份认证
3. 跳过所有DNS解析步骤
```
## 解决方案
1. 修改 SSH 配置文件
```bash
vi /etc/ssh/sshd_config
```
修改为如下内容
```bash
UseDNS no
```
2. 重启服务
```bash
systemctl restart sshd
```
3. 再次重新连接,缓慢速度已解决