> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/handbook/di-35-zhang-gao-ji-wang-luo/35.6.-usb-wang-luo-gong-xiang.md).

# 35.6.USB 网络共享

许多手机提供通过 USB 分享数据连接的选项（通常称为“网络共享”）。此功能使用 RNDIS、CDC 或自定义的 Apple® iPhone®/iPad® 协议。

* Android™ 设备通常使用 [urndis(4)](https://man.freebsd.org/cgi/man.cgi?query=urndis\&sektion=4\&format=html) 驱动程序。
* Apple® 设备使用 [ipheth(4)](https://man.freebsd.org/cgi/man.cgi?query=ipheth\&sektion=4\&format=html) 驱动程序。
* 较旧的设备通常使用 [cdce(4)](https://man.freebsd.org/cgi/man.cgi?query=cdce\&sektion=4\&format=html) 驱动程序。

在连接设备之前，将适当的驱动程序加载到内核中：

```sh
# kldload if_urndis
# kldload if_cdce
# kldload if_ipheth
```

设备连接后，`ue0` 将作为正常的网络设备可用。确保在设备上启用了“USB 网络共享”选项。

为使此更改永久生效，并在引导时作为模块加载驱动程序，将适当的行添加到 **/boot/loader.conf** 文件中：

```sh
if_urndis_load="YES"
if_cdce_load="YES"
if_ipheth_load="YES"
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://book.bsdcn.org/handbook/di-35-zhang-gao-ji-wang-luo/35.6.-usb-wang-luo-gong-xiang.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
