Interface config
Huawei network device (USG firewall + S/CE switch) CLI skills pack for OpenClaw AI agent — also usable as a standalone cheatsheet.
npx -y skills add nanxiaoyao/network-huawei-skills --skill interface-configAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
This skill should be used when the user asks to configure or troubleshoot physical interfaces and link aggregation (Eth-Trunk) on Huawei CloudEngine / S series switches. Covers interface attributes (speed, duplex, MTU, jumbo frame, flow control, PoE, error packets), Eth-Trunk in manual and LACP modes, M-LAG/iStack cross-device aggregation, and interface fault diagnosis. Applicable platforms S/CE switches (V200R011C10+/V200R022C00+) and USG firewalls (V500R005C20+/V600R007C20+).
SKILL.md
8.7 KB, ~3.1k tokens by cl100k_base, as published. Nobody here has run it
华为交换机接口与链路聚合配置技能 (interface-config)
适用平台 S 系列 V200R011C10+ | CE 系列 V200R022C00+ 文档来源 华为产品文档 dc_cfg_int_* / dc_cfg_eth-trunk_*
接口是所有协议的物理底座 出问题先看接口 Eth-Trunk 链路聚合是接口的逻辑形态 提带宽+冗余
触发场景
- 接口配置 IP / 描述 / 速率 / 双工
- 接口物理 down 不通
- 大量错包 CRC 错 入向丢包
- 配 MTU / 巨帧 jumbo frame
- PoE 供电
- 配置 Eth-Trunk 链路聚合(手工 / LACP)
- LACP 不协商 / 成员口不上线
- 跨设备聚合(M-LAG 堆叠跨设备聚合)
- Trunk 链路两端速率不匹配
物理接口配置
基础属性
interface GigabitEthernet 0/0/1
description To-CoreSW
speed 1000 # 速率 10/100/1000
duplex full # 双工
negotiation disable # 关闭自协商(双方都关或都开 否则速率不匹配)
mtu 9216 # 巨帧(默认 1500)
jumboframe enable 9216
flow-control # 流控
undo shutdown
接口三层化
interface GigabitEthernet 0/0/1
undo portswitch # 转为三层口(仅部分款支持)
ip address 10.1.1.1 24
PoE 供电(S 系列接入交换机)
interface GigabitEthernet 0/0/1
poe enable
poe power max 30000 # 30W 最大功率(mW)
poe priority { critical | high | low }
display poe interface # 查 PoE 状态
display poe power # 查总功耗
错包诊断
display interface GigabitEthernet 0/0/1
# 看 Input/Output errors、CRC、Frames、Drops 等计数
clear counters interface GigabitEthernet 0/0/1
Eth-Trunk 链路聚合
两种模式
| 模式 | 适用 | 协商 |
|---|---|---|
| 手工 manual | 简单 不要协商 | 无 LACP |
| LACP(lacp-static) | 推荐 自动协商 故障检测 | LACP 报文 |
配置 手工模式
interface Eth-Trunk 1
mode manual load-balance # 手工模式 默认就是
quit
interface GigabitEthernet 0/0/1
eth-trunk 1
quit
interface GigabitEthernet 0/0/2
eth-trunk 1
quit
配置 LACP 模式(推荐)
interface Eth-Trunk 1
mode lacp-static
lacp preempt enable
lacp preempt delay 30
max active-linknumber 4
min active-linknumber 1
quit
interface GigabitEthernet 0/0/1
eth-trunk 1
interface GigabitEthernet 0/0/2
eth-trunk 1
LACP 系统优先级与接口优先级
# 系统优先级 决定谁是 Actor 哪边的接口优先级生效
lacp priority 100 # 系统级 默认 32768
# 接口优先级 决定哪些接口为活动接口
interface GigabitEthernet 0/0/1
lacp priority 100 # 接口级
两端比较:系统优先级数值小的胜 然后比较 MAC 接口优先级数值小为活动
负载均衡算法
interface Eth-Trunk 1
load-balance src-dst-mac # 源目 MAC
load-balance src-dst-ip # 源目 IP
load-balance src-dst-ip-l4port # 五元组 推荐
验证
display eth-trunk 1
display eth-trunk 1 brief
display lacp statistics eth-trunk 1
display interface eth-trunk 1
正常时:
- Status: Selected(活动)
- Number of UP port in Trunk: ≥ min active-linknumber
- LACP 模式下 PartnerKey 与本端 LacpKey 一致
跨设备聚合
堆叠跨设备聚合(S 系列 iStack)
两台设备做 iStack 后 成员口分散在不同物理框 → 普通 Eth-Trunk 即可跨设备
M-LAG(CE 系列)
两台独立设备做 M-LAG → 对下游表现为一个聚合组 详见 stack-istack 技能 + 单独 m-lag
接口命令速查
命名
| 类型 | 示例 |
|---|---|
| 千兆 | GigabitEthernet 0/0/1 |
| 万兆 | 10GE 0/0/1 |
| 40G | 40GE 0/0/1 |
| 100G | 100GE 0/0/1 |
| Eth-Trunk | Eth-Trunk 1 |
| VLANIF | Vlanif 10 |
| Loopback | LoopBack 0 |
基础
interface <if>
description <text>
speed { 10 | 100 | 1000 | 10000 | auto }
duplex { full | half | auto }
negotiation disable | enable
mtu <bytes>
jumboframe enable [<bytes>]
flow-control
shutdown / undo shutdown
undo portswitch # 转三层口(部分款型)
portswitch # 转二层口
错误处理
display interface <if>
display interface brief
display interface phy-option # 光模块信息
display transceiver verbose interface <if> # 详细光模块
clear counters interface <if>
loopback internal # 接口内环测试
loopback external # 外环(需配回环头)
Eth-Trunk 命令速查
| 命令 | 视图 | 说明 |
|---|---|---|
| interface Eth-Trunk <id> | system | 创建/进入 |
| mode { manual load-balance | lacp-static } | trunk | 模式 |
| eth-trunk <id> | interface | 接口加入 Trunk |
| max active-linknumber <num> | trunk | LACP 最大活动数 |
| min active-linknumber <num> | trunk | 最小活动数 低于则 trunk down |
| load-balance <algo> | trunk | 负载算法 |
| lacp preempt enable | trunk | 抢占 |
| lacp preempt delay <s> | trunk | 抢占延时 |
| lacp timeout { fast | slow } | trunk | LACP 超时 fast=1s slow=30s |
| lacp priority <num> | system / interface | LACP 优先级 |
| display eth-trunk [<id>] | - | 查 trunk |
| display lacp statistics eth-trunk <id> | - | LACP 报文统计 |
完整范式 LACP 跨堆叠聚合上联
需求:两台 S5720 堆叠 与上联 S6720 用 2×10GE LACP 聚合上联
system-view
# 接口配置(成员口分散到不同堆叠成员)
interface 10GE 1/0/1 # 成员 1 的 10GE 1
eth-trunk 10
quit
interface 10GE 2/0/1 # 成员 2 的 10GE 1
eth-trunk 10
quit
# Trunk 配置
interface Eth-Trunk 10
mode lacp-static
max active-linknumber 2
min active-linknumber 1
load-balance src-dst-ip-l4port
port link-type trunk
port trunk allow-pass vlan 10 20 30
quit
# 上联设备做相同的 Eth-Trunk 配置(mode/参数对称)
常见陷阱
- 两端 speed/duplex 一端 auto 一端固定 → 协商可能不一致
- 两端 mtu / jumboframe 不一致 → 大包不通 小包通
- LACP 模式两端不同(一端 manual 一端 lacp-static)→ 一直不上线
- 成员口数量两端不一致 → 协商成功数取较小
- eth-trunk 已有 IP → 成员口加入失败 必须先清 IP
- 成员口配了 VLAN/IP → 加入 trunk 失败 先清干净
- 负载算法两端不同 → 不影响通信 但流量分布不均
- PoE 总功率超限 → 部分端口不供电 看
display poe power-budget
排查流程
接口/聚合不通
|
v
[1] display interface brief → 物理 UP 否
|
├─ DOWN → 走分支 A 物理层
└─ UP
|
v
[2] 是聚合口? 是 → display eth-trunk
|
├─ 活动数=0 → 走分支 B 聚合协商
└─ 活动 < 期望 → 走分支 C 部分成员异常
相关文件
- references/interface-commands.md 完整命令
- references/interface-troubleshooting.md 故障排查
⚠️ CE 系列差异(注意)
CE 系列虽然接口/Eth-Trunk 命令大体与 S 一致,但有几处关键差异:
1. 二阶段提交(commit)模型
CE 配置完所有命令后必须执行 commit 才生效(V200R022 起强制):
[~SwitchA] interface 10GE 1/0/1
[~SwitchA-10GE1/0/1] eth-trunk 10
[*SwitchA-10GE1/0/1] commit # 注意:必须 commit
~表示已提交状态*表示有未提交修改- 不 commit 重启后修改丢失
2. Eth-Trunk 模式新增
CE 支持 mode lacp-dynamic(S 系列只有 manual 和 lacp-static)
3. 跨芯片/跨堆叠成员推荐
官方文档明确建议 Eth-Trunk 成员接口跨芯片/跨堆叠成员,提升可靠性
4. 接口命名差异
| 平台 | 千兆 | 万兆 | 40G | 100G |
|---|---|---|---|---|
| S 系列 | GigabitEthernet | 10GE | 40GE | - |
| CE 系列 | GE / 10GE | 10GE / 25GE | 40GE | 100GE |
| USG 防火墙 | GigabitEthernet | 10GE / XGigabitEthernet | - | - |
⚠️ USG 防火墙接口差异
防火墙接口与交换机的主要差异:
- 接口必须加入安全区域 才能转发
firewall zone trust add interface GigabitEthernet 1/0/1 - 接口默认三层 不需要
undo portswitch - VLAN 模式 需要
portswitch后才能配 VLAN(交换模式) - Eth-Trunk 也支持 命令与交换机一致
- PoE 防火墙不支持
Gives 0 of the 12 instructions most project setup skills give in ~3.1k tokens
Counted across 999 of the 1,637 authors here whose files we hold, read 2026-08-06
- ask one question at a timein 29 of 999, across 28 files
- detect the package manager from lockfilesin 28 of 999, across 9 files
- present findings to the userin 25 of 999, across 4 files
- explore current repo statein 24 of 999, across 3 files
- update the agent skills block in place if it existsin 24 of 999, across 3 files
- install husky lint-staged and prettierin 23 of 999, across 4 files
- create the lintstagedrc filein 22 of 999, across 3 files
- commit all changed filesin 22 of 999, across 3 files
- run lint-staged to verify it worksin 22 of 999, across 3 files
- initialize huskyin 21 of 999, across 2 files
- create the husky pre-commit filein 21 of 999, across 2 files
- create a prettierrc file if missingin 21 of 999, across 2 files
Said here and by no other author read
- Check interface status first when troubleshooting
- Disable auto-negotiation consistently across both link ends
- Clear existing IP and VLAN configurations before adding member interfaces
- Use LACP mode for automatic negotiation and fault detection
- Set LACP preemption and preempt delay
- Set minimum and maximum active link numbers
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.