# 21.6.GEOM Gate 网络设备

GEOM 提供了一种简单的机制，通过 GEOM Gate 网络守护进程（ggated）为设备（如磁盘、CD 和文件系统）提供远程访问。具有设备的系统运行服务器守护进程，处理客户端通过 ggatec 发出的请求。由于客户端和服务器之间的连接没有加密，因此设备不应包含任何敏感数据。

类似于 [NFS（网络文件系统）](https://docs.freebsd.org/en/books/handbook/network-servers/#network-nfs)，[ggated](https://man.freebsd.org/cgi/man.cgi?query=ggated\&sektion=8\&format=html) 使用 exports 文件进行配置。该文件指定哪些系统被允许访问导出的资源以及提供什么级别的访问权限。例如，要为客户端 `192.168.1.5` 提供对第一个 SCSI 磁盘上第四个切片的读写权限，可以创建 **/etc/gg.exports** 文件并加入以下行：

```sh
192.168.1.5 RW /dev/da0s4d
```

在导出设备之前，请确保该设备没有被挂载。然后，启动 ggated：

```sh
# ggated
```

有多个选项可以指定备用的监听端口或更改 exports 文件的默认位置。有关详细信息，请参阅 [ggated(8)](https://man.freebsd.org/cgi/man.cgi?query=ggated\&sektion=8\&format=html)。

要在客户端计算机上访问导出的设备，首先使用 `ggatec` 指定服务器的 IP 地址和导出设备的设备名称。如果成功，命令会显示一个 `ggate` 设备名称进行挂载。在空闲的挂载点上挂载该指定的设备名称。以下示例连接到 `192.168.1.1` 上的 **/dev/da0s4d** 分区，然后将 **/dev/ggate0** 挂载到 **/mnt**：

```sh
# ggatec create -o rw 192.168.1.1 /dev/da0s4d
ggate0
# mount /dev/ggate0 /mnt
```

现在，客户端可以通过 **/mnt** 访问服务器上的设备。有关 `ggatec` 的更多详细信息和使用示例，请参阅 [ggatec(8)](https://man.freebsd.org/cgi/man.cgi?query=ggatec\&sektion=8\&format=html)。

> **注意**
>
> 如果设备当前在服务器或网络上的任何其他客户端上挂载，挂载将失败。如果需要同时访问网络资源，请改用 NFS。

当不再需要设备时，可以使用 `umount` 卸载设备，以便其他客户端可以访问该资源。


---

# 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://book.bsdcn.org/hanbook/di-21-zhang-geom-mo-kuai-hua-ci-pan-zhuan-huan-kuang-jia/21.6.-geom-gate-wang-luo-she-bei.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.
