> For the complete documentation index, see [llms.txt](https://docs.verge.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verge.io/knowledge-base/zh/networking/accessing-the-ui-from-a-vm.md).

# 从虚拟机访问 VergeOS UI

## 概述

{% hint style="info" %}
**要点**

* 从环境中的虚拟机访问 VergeOS UI
* 使用发夹式转发网络技术
* 在内部网络上创建特定的网络规则
  {% endhint %}

本文将指导您完成从运行在 VergeOS 系统内部的虚拟机（VM）访问 VergeOS 用户界面（UI）的设置过程。这是通过一种称为 hair-pinning 的网络技术来实现的，其中数据包会到达某个接口，向外进入互联网，但不会继续传输，而是“发夹式转弯”并从同一接口返回。

## 前提条件

* 正在运行的 VergeOS 环境
* 您 VergeOS 环境中的一台虚拟机（VM）
* 可访问 VergeOS UI
* 对 VergeOS 中网络规则的基本了解

## 步骤

1. 转到内部网络
   * 登录到您的 VergeOS 环境
   * 转到目标 VM 所连接的内部网络
2. 创建新规则
   * 找到创建新规则的选项
   * 按以下设置配置该规则：

     **规则：**

     * 名称：使用一个参考名称，例如“允许 UI”
     * 操作：转换
     * 协议：TCP
     * 方向：入站
     * 接口：自动
     * Pin：否

     **源：**

     * 类型：任意 / 无
     * 源端口/范围：留空

     **目标：**

     * 类型：我的网络地址
     * 目标端口/范围：80、443

     **目标：**

     * 类型：其他网络 DMZ IP
     * 目标网络：Core
     * 目标端口/范围：留空
3. 提交规则
   * 点击“提交”以保存规则
4. 应用新规则
   * 点击“应用规则”以激活新创建的规则
5. 从 VM 访问 UI
   * 在您的 VM 中打开网页浏览器
   * 转到内部网络的 IP 地址（例如，如果内部网络 IP 是 192.168.0.1，请使用此地址）

{% hint style="success" %}
**专业提示**

始终确保您的 VM 网络设置已正确配置为使用您已设置此规则的内部网络。
{% endhint %}

## 可视化指南

以下是规则配置的可视化表示：

![hairpin.png](/files/168f1bba95624eec5ed41daabd6ccbdc30c9a664)

## 故障排除

{% hint style="warning" %}
**常见问题**

* 问题：创建规则后无法访问 UI
  * 解决方案：
    1. 验证规则是否已正确应用
    2. 检查 VM 的网络接口是否位于正确的内部网络上
    3. 确保没有防火墙规则阻止连接
       {% endhint %}

## 其他资源

* [网络概览](/run-the-platform/networking/network-overview.md)
* [网络规则](/run-the-platform/networking/network-rules.md)
* [创建内部网络](/run-the-platform/networking/internal-networks.md)

## 反馈

{% hint style="info" %}
**需要帮助吗？**

如果您在设置 UI 访问时遇到任何问题，或对该流程有任何疑问，请随时联系我们的支持团队。
{% endhint %}

***

{% hint style="info" %}
**文档信息**

* 最后更新：2024-08-29
* VergeOS 版本：4.13.3
  {% endhint %}


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.verge.io/knowledge-base/zh/networking/accessing-the-ui-from-a-vm.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
