> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://helpdesk.ggcircuit.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# 🗄️ggRock 服务器 NIC 绑定 / 链路聚合

本指南概述了 ggRock Server 与网络交换机之间推荐的绑定配置，以确保最佳性能和可靠性。

---

## 📚 目录

* [关于](#2-about)
* [支持的绑定模式](#2-supported-bonding-modes)
* [IEEE 802.3ad (LACP)](#3-ieee-8023ad-lacp-dynamic-link-aggregation)
* [主动备用](#3-active-backup-bonding)
* [结论](#2-conclusion)
* [附录 1：性能测试](#2-appendix-1-single-client-pc-performance-testing)
* [附录 2：模式比较](#2-appendix-2-bonding-mode-comparison-advanced-users)

---

## 🧠 关于

**绑定**——也称为 NIC 成组或链接聚合——是一种组合多个网络接口的方法，可以改进：

* ✅ **容错能力**
* 🚀 **性能**
* ⚖️ **负载均衡**

---

## ⚙️ 支持的绑定模式

Linux 支持七种绑定模式，但**仅推荐两种**用于 ggRock：

### 🧩 IEEE 802.3ad (LACP - 动态链接聚合)

**主要优势：**

* 同时利用多个 NIC
* 提供**容错能力**和**负载均衡**

**要求：**

* 网络交换机必须支持 **LACP (IEEE 802.3ad)**
* NIC 必须具有相同的速度并以全双工方式工作
* 所有 NIC 应连接到**同一交换机**
* 服务器和客户端必须在**同一本地网络**上

**推荐设置：**

* **传输哈希策略：** `layer2+3`（推荐）
* **链接监控：** `mii`
* **监控间隔 (miimon)：** `100 ms`

|| 虽然 LACP 改进了跨多个客户端的出站吞吐量，但它不会增加以 1Gbps 运行的单个客户端 PC 的吞吐量。

**🛠 示例配置：**

**不使用 802.3ad 绑定的配置**

```bash
auto lo
iface lo inet loopback
iface eth0 inet manual
iface eth1 inet manual
auto vmbr0
iface vmbr0 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1
bridge_ports eth0
bridge_fd 0
bridge_stp off
```

**使用 802.3ad 绑定的配置**

```bash
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
auto eth1
iface eth1 inet manual
auto bond0
iface bond0 inet manual
bond-slaves eth0 eth1
bond-mode 802.3ad
bond-miimon 100
bond-xmit-hash-policy layer2+3
auto vmbr0
iface vmbr0 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1
bridge_ports bond0
bridge_fd 0
bridge_stp off
```

**所需的交换机配置：**  
确保交换机已正确配置 LACP，具有匹配的哈希策略和链接监控。

---

### 🔁 主动备用绑定

**主要优势：**

* 提供**容错能力**，不需要交换机配置

**工作原理：**

* 任何时候只有一个 NIC 处于活动状态。
* 如果活动的 NIC 失败，另一个接管。

**推荐设置：**

* **Miimon：** `100 ms`

**🛠 示例配置：**

**不使用主动备用绑定的配置**

```bash
auto lo
iface lo inet loopback
iface eth0 inet manual
iface eth1 inet manual
auto vmbr0
iface vmbr0 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1
bridge_ports eth0
bridge_fd 0
bridge_stp off
```

**使用主动备用绑定的配置**

```bash
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
auto eth1
iface eth1 inet manual
auto bond0
iface bond0 inet manual
bond-primary eth0
bond-slaves eth0 eth1
bond-mode active-backup
bond-miimon 100
auto vmbr0
iface vmbr0 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1
bridge_ports bond0
bridge_fd 0
bridge_stp off
```

**交换机配置：**  
不需要。🙌

---

## ✅ 结论

* 绑定**不会**改进**单个 iSCSI 客户端连接**的吞吐量
* 当**多个客户端**访问服务器时，绑定**可以**提供聚合吞吐量
* 在支持的系统上实现绑定**无需额外成本**

---

## 📊 附录 1 - 单客户端 PC 性能测试

![](https://ggcircuit.atlassian.net/wiki/download/attachments/15860123/image-20250329-025234.png?version=1&modificationDate=1743216765412&cacheVersion=1&api=v2)

* 单个 1G NIC：

![](https://ggcircuit.atlassian.net/wiki/download/attachments/15860123/image-20250327-145028.png?version=1&modificationDate=1743087033512&cacheVersion=1&api=v2)

* 802.3ad（两个 1G NIC）：

![](https://ggcircuit.atlassian.net/wiki/download/attachments/15860123/image-20250327-145037.png?version=1&modificationDate=1743087042166&cacheVersion=1&api=v2)

* 主动备用（两个 1G NIC）：

![](https://ggcircuit.atlassian.net/wiki/download/attachments/15860123/image-20250327-145047.png?version=1&modificationDate=1743087051917&cacheVersion=1&api=v2)

---

## 🧮 附录 2 - 绑定模式比较（高级用户）
![](https://ggcircuit.atlassian.net/wiki/download/attachments/15860123/image-20250327-145057.png?version=1&modificationDate=1743087060532&cacheVersion=1&api=v2)
![](https://ggcircuit.atlassian.net/wiki/download/attachments/15860123/image-20250327-145109.png?version=1&modificationDate=1743087071255&cacheVersion=1&api=v2)
|| 大多数交换机仅支持出站流量聚合。
|| 绑定行为可能会有所不同——请参考交换机的文档。
|| 某些绑定模式需要驱动程序级支持（例如 ethtool）。