> For the complete documentation index, see [llms.txt](https://handbook.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://handbook.bsdcn.org/di-29-zhang-usb-she-bei-mo-shi-usb-otg/29.3.-usb-she-bei-mo-shi-wang-luo-jie-kou.md).

# 29.3.USB 设备模式网络接口

虚拟网络接口支持由模板 1、8 和 10 提供。这些模板都不适用于 Microsoft Windows。其他主机操作系统与所有三个模板兼容。必须加载 [usb\_template(4)](https://man.freebsd.org/cgi/man.cgi?query=usb_template\&sektion=4\&format=html) 和 [if\_cdce(4)](https://man.freebsd.org/cgi/man.cgi?query=if_cdce\&sektion=4\&format=html) 内核模块。

确保必要的模块已加载，并且在引导时设置了正确的模板，可以在 **/boot/loader.conf** 中添加以下行（如果该文件不存在，请创建它）：

```sh
if_cdce_load="YES"
hw.usb.template=1
```

要在不重启的情况下加载模块并设置模板，请使用：

```sh
# kldload if_cdce
# sysctl hw.usb.template=1
```
