> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/welcome/cn/bare-metal/overview/public-network/public-virtual-interface.md).

# VLAN

## **什么是** VLAN？

VLAN 让位于同一区域的实例可以通过公共网络进行通信，通过将它们分组到隔离且安全的网络段，即 [CIDR 地址块](/welcome/cn/bare-metal/overview/public-network/cidr-block.md)。VLAN 也有助于在实例数量较多时提高流量效率。

当为一个区域分配 CIDR 地址块时，VLAN 会自动生成。您无需手动创建 VLAN。一个特定的区域中只有一个 VLAN。

{% hint style="info" %} <mark style="color:blue;">**注意**</mark>

<mark style="color:blue;">VLAN 目前不支持洛杉矶区域 B 和法兰克福区域 A。</mark>
{% endhint %}

## **功能**

将您的实例加入 VLAN 后，您可以享受到以下功能：

* 隔离且安全的网络；
* 实例之间浮动 IP。

如果您希望：

* 构建自己的 LVS 在 DR 模式；
* 在实例之间使用浮动 IP 地址以满足应用程序需求或冗余；
* 获取更大的 IP 范围并立即使用；
* 未来在同一 IP 范围内绑定更多实例。

## VLAN **限制**

* VLAN 使用 CIDR 表示法来表示 IP 空间。\
  例如，一个 `/29` 表示一个 29 位前导 1 的子网掩码（`255.255.255.248`），包含 8 个 IP 地址的 IP 空间。去掉网络 ID 和广播 IP，我们将使用第一个可用 IP 作为您的 VLAN 网关，因此您将获得 8-3=5 个可用 IP 地址。
* 当您将实例绑定到 VLAN 时，您需要选择一个可用的 IP 地址给实例，实例的现有互联网 IP 地址将被 VLAN 的可用 IP 地址替换。

## VLAN **与弹性 IP**

* VLAN 提供服务器之间的二层网络通信，大多数技术如负载均衡、冗余 DR 和 IP 浮动都是基于二层网络通信的。因此，如果您需要部署上述技术，请先将您的实例加入 VLAN。
* 弹性 IP 仅提供额外的公网 IP，且一个 IP 同时只能用于一个实例。此外，弹性 IP 不支持与其他 IP 的二层网络通信。

## VLAN **与虚拟私有云**

VLAN 提供公共的二层网络通信，而虚拟私有云提供私有的二层网络通信。

* 如果您的业务需要同一区域内的实例之间进行公共通信，请将您的实例加入 VLAN。
* 负载均衡和防火墙等功能需要基于公共的二层网络通信进行构建。


---

# 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.console.zenlayer.com/welcome/cn/bare-metal/overview/public-network/public-virtual-interface.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.
