# 安装 iptables 指南

**背景说明**

部分节点因系统缺少 `iptables` 防火墙工具，影响节点正常运行及收益计算。若您的节点详情页有提示需要安装iptables，请按照以下文档进行安装。

**适用范围**\
本教程适用于 Ubuntu/Debian (apt) 等系统。

## 操作步骤

### 1. 检查 iptables 是否已安装

通过cmd命令行输入

```bash
which iptables
```

* **已安装：** 如果返回 iptables 的安装路径（例如 `/usr/sbin/iptables` 或 `/sbin/iptables`），则表明 iptables 已存在，无需后续安装步骤。
* **未安装：** 如果没有任何输出或提示 `command not found`，请继续执行步骤 2 进行安装。

### 2. 更新软件包索引

```bash
sudo apt update
```

**说明：** 此步骤确保获取最新的软件包信息，是安装前的最佳实践

### 3. 安装 iptables

```bash
sudo apt install iptables -y
```

**说明：** `-y` 参数表示自动确认安装提示，避免手动交互。

### 4. 验证安装

安装完成后，执行以下命令验证：

```bash
iptables --version
```

* **安装成功：** 命令将输出已安装的 iptables 版本号（例如 `iptables v1.8.7 (nf_tables)`）。
* **安装失败：** 如果仍提示 `command not found` 或报错，请检查步骤 2 和 3 的执行过程是否有错误输出。
