# 共享网络设置

{% hint style="info" %}
\*\*注意：\*\*共享网络设置仅在 Parallels Desktop for Mac Pro Edition 中提供。
{% endhint %}

若要更改共享的 Host-only 网络设置，请选择 Parallels Desktop 偏好设置的**网络**选项卡并单击**共享**。您会看到以下窗口：

<figure><img src="/files/de9S6q4yzZS33egoKCdE" alt="" width="528"><figcaption></figcaption></figure>

在此窗口中，您可以对 Parallels 的 IPv4 和 IPv6 DHCP 服务器设置进行必要的更改。这些服务器为默认启用，可自动将 IP 地址分配给在共享网络模式下运行的虚拟机。要禁用其中的任何服务器，请取消选中相应的选项。

要详细了解如何配置共享网络，请参阅[在 macOS 与 Windows 之间共享网络设置](/pdfm-20-ug-zh_cn/parallels-desktop-for-mac-20-yong-hu-zhi-nan/zai-mac-shang-shi-yong-windows/lian-jie-dao-internet-huo-wang-luo/zai-macos-yu-windows-zhi-jian-gong-xiang-wang-luo-fang-wen.md)。

### **端口转发**

{% hint style="info" %}
\*\*注意：\*\*此功能仅在 Parallels Desktop for Mac Pro Edition 中有提供。
{% endhint %}

通常情况下，设置为在共享网络模式下运行的虚拟机无法从外部电脑进行访问。端口转发功能允许本地网络和互联网上的电脑将数据传输到使用共享网络模式的任何虚拟机。发送到 Mac 指定端口的数据会根据端口转发规则重定向到虚拟机的指定端口。

要添加端口转发规则，请执行以下操作：

1. 单击**端口转发规则**列表下的**添加**按钮 (+)。
2. 在显示的窗口中，执行以下操作：

   * 在**协议**字段中，指定要用于建立网络连接的端口类型。您可以从 **TCP** 或 **UDP** 端口类型中进行选择。
   * 在**源端口**字段中，输入 Mac 上的传入端口号。
   * 在**转发至**部分中，指定要连接的虚拟机的名称或 IP 地址。
   * 在**目标端口**字段中，输入数据要迁移到的虚拟机上的端口。

   <figure><img src="/files/NI3eHtx04tkQ8LZef6dS" alt=""><figcaption></figcaption></figure>
3. 单击**确定**，添加规则。

添加规则时，对虚拟机的外部连接使用以下 IP 地址组合：`<您的 Mac 的 IP 地址>:<传入端口>`。

<figure><img src="/files/cfmlrpGadXomZkzjYvLo" alt="" width="563"><figcaption></figcaption></figure>

要编辑规则，可在**端口转发规则**列表中选定该规则，单击**编辑**按钮，修改必要的设置，然后单击**确定**以应用这些修改。

要移除端口转发规则，可在**端口转发规则**列表中选定该规则，单击**删除**按钮 (-)。

要恢复默认设置，请单击**恢复默认**。


---

# 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://docs.parallels.cn/pdfm-20-ug-zh_cn/parallels-desktop-for-mac-20-yong-hu-zhi-nan/gao-ji-zhu-ti/gong-xiang-wang-luo-she-zhi.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.
