# 7.7.故障排除

在排查硬件和软件配置问题时，应首先检查最基础的内容：

* 网线是否插好？
* 网络服务是否配置正确？
* 防火墙是否配置正确？
* FreeBSD 是否支持该网卡？
* 路由器是否正常工作？

> **技巧**
>
> 在提交 bug 报告之前，请务必查看 [FreeBSD 发布页面](https://www.freebsd.org/releases/) 中的硬件说明，更新至最新的 STABLE 版本，查阅邮件列表归档，并搜索互联网。

## 7.7.1. 有线网络中的故障排查

如果网卡能够工作，但性能较差，请阅读 [tuning(7)](https://man.freebsd.org/cgi/man.cgi?query=tuning\&sektion=7\&format=html)。同时检查网络配置，因为错误的网络设置可能导致连接缓慢。

出现 `No route to host` 消息时，说明系统无法将数据包路由到目标主机。这可能是因为没有指定默认路由，或者网线未插好。检查 `netstat -rn` 的输出，确保有一条有效的到主机的路由。如果没有，请参阅 [网关与路由](https://docs.freebsd.org/en/books/handbook/advanced-networking/#network-routing)。

`ping: sendto: Permission denied` 错误通常是防火墙配置错误所致。如果 FreeBSD 上启用了防火墙但未定义任何规则，则默认策略是拒绝所有流量，即使是 [ping(8)](https://man.freebsd.org/cgi/man.cgi?query=ping\&sektion=8\&format=html)。更多信息请参见 [防火墙](https://docs.freebsd.org/en/books/handbook/firewalls/#firewalls)。

## 7.7.2. 无线网络中的故障排查

本节介绍了一些用于排查常见无线网络问题的步骤：

* 如果在扫描时未列出接入点，请检查配置是否将无线设备限制在特定信道范围内。
* 如果设备无法与接入点建立关联，请确认配置与接入点的设置一致，包括认证方式与安全协议。尽量简化配置。如果使用 WPA2 或 WPA 等安全协议，可以将接入点配置为开放认证且无安全保护，以测试是否能传输数据。
* 待系统能够与接入点建立关联，使用 [ping(8)](https://man.freebsd.org/cgi/man.cgi?query=ping\&sektion=8\&format=html) 等工具诊断网络配置。
* 有许多底层调试工具可用。可以使用 [wlandebug(8)](https://man.freebsd.org/cgi/man.cgi?query=wlandebug\&sektion=8\&format=html) 在 802.11 协议支持层启用调试信息。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://handbook.bsdcn.org/di-7-zhang-wang-luo/7.7.-gu-zhang-pai-chu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
