# 34.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
```

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

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

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