agentsclimarketplace

Vlan config

Skill nanxiaoyao/network-huawei-skills/vlan-config

This skill should be used when the user asks to configure or troubleshoot VLANs on Huawei CloudEngine / S series switches. Covers VLAN creation, access/trunk/hybrid port modes, VLANIF Layer-3 inter-VLAN routing, voice VLAN, management VLAN, VLAN isolation (Layer-2/3), and VLAN tag manipulation. Applicable platforms S/CE switches (V200R011C10+/V200R022C00+) as primary scope; USG firewalls (V500R005C20+/V600R007C20+) only use VLAN in transparent mode or policy filtering.From its SKILL.md

Install
npx -y skills add nanxiaoyao/network-huawei-skills --skill vlan-config

Assembled 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.

SKILL.md

6.6 KB, ~2.2k tokens by cl100k_base, as published. Nobody here has run it

华为交换机 VLAN 配置技能 (vlan-config)

适用平台 S1720/S2700/S5700/S6720 V200R011C10+ | CloudEngine 5800-9800 V200R022C00+ 文档来源 华为 S 系列与 CloudEngine 系列产品文档 (dc_cfg_vlan_*)

VLAN 是交换机最基础也是最高频的配置 划分广播域 隔离用户 简化网络管理

触发场景

  • 新建 VLAN 划分网段
  • 配置 Access/Trunk/Hybrid 接口
  • 配置 VLANIF 实现 VLAN 间互访
  • 终端 PC 跨 VLAN 不通
  • 配置 voice VLAN(语音 IP 电话)
  • 管理 VLAN(telnet/SSH 登录用)
  • VLAN 内/间隔离
  • Trunk 链路两端不通
  • 配置 Super-VLAN / MUX-VLAN

接口类型对比(最常错点)

类型用途收报文发报文
Access接终端 PC/打印机收 untag 打 PVID剥 PVID 后 untag 出
Trunk交换机互联收 tag 透传 收 untag 打 PVID等于 PVID 时剥 tag 出 其他 tag 出
Hybrid混合(兼容场景)灵活控制 tagged/untagged可指定哪些 VLAN tagged 哪些 untagged

记忆口诀:Access 接终端 Trunk 接交换机 Hybrid 当救火

配置六步走

1 创建 VLAN

system-view
vlan batch 10 20 30           # 批量创建
vlan 10                       # 单个创建并进入
 description Sales            # 描述
 quit

2 接口配 Access(接终端)

interface GigabitEthernet 0/0/1
 port link-type access
 port default vlan 10

3 接口配 Trunk(交换机互联)

interface GigabitEthernet 0/0/24
 port link-type trunk
 port trunk allow-pass vlan 10 20 30    # 放通哪些 VLAN
 port trunk pvid vlan 1                  # PVID 默认 1 不动也行

⚠️ 不要写 port trunk allow-pass vlan all 除非真的要全放通 容易引入广播风暴

4 接口配 Hybrid(灵活控制)

interface GigabitEthernet 0/0/2
 port link-type hybrid
 port hybrid pvid vlan 10
 port hybrid untagged vlan 10 20         # 这些 VLAN 出去时剥 tag
 port hybrid tagged vlan 30              # 这个 VLAN 出去保留 tag

5 VLANIF 三层互访

interface Vlanif 10
 ip address 10.10.10.1 24
interface Vlanif 20
 ip address 10.10.20.1 24

终端网关指向 VLANIF 的 IP 即可实现 VLAN 间路由

6 验证

display vlan
display vlan summary
display port vlan
display interface Vlanif 10

常用命令速查

VLAN 管理

vlan batch <start> [ to <end> ]          # 批量创建
display vlan
display vlan <vid>
display vlan summary

接口模式

port link-type { access | trunk | hybrid }
port default vlan <vid>                   # access
port trunk allow-pass vlan { <list> | all }
port trunk pvid vlan <vid>
port hybrid pvid vlan <vid>
port hybrid untagged vlan <list>
port hybrid tagged vlan <list>

VLANIF

interface Vlanif <vid>
 ip address <ip> <mask>
 description <text>

语音 VLAN

voice-vlan mac-address <mac> mask <mask>
interface <if>
 voice-vlan <vid> enable
 voice-vlan mode { auto | manual }

管理 VLAN

management-vlan <vid>           # 默认 1 改成专用 VLAN 提升安全

隔离

# 二层隔离(端口隔离 同 VLAN 内不通)
port-isolate enable group <group-id>

# 三层隔离(VLAN 间禁路由)
traffic-filter inbound acl <num>

完整范式 终端 VLAN 划分 + 三层互访

需求:销售(VLAN10)与研发(VLAN20)分别接入 各自网段 通过交换机三层互通

system-view
vlan batch 10 20

# 接终端
interface GigabitEthernet 0/0/1
 port link-type access
 port default vlan 10
 quit
interface GigabitEthernet 0/0/2
 port link-type access
 port default vlan 20
 quit

# VLANIF 网关
interface Vlanif 10
 ip address 192.168.10.1 24
 quit
interface Vlanif 20
 ip address 192.168.20.1 24
 quit

# 接上联交换机(如有)
interface GigabitEthernet 0/0/24
 port link-type trunk
 port trunk allow-pass vlan 10 20
 quit

常见陷阱

  • Trunk 两端 PVID 不一致 → VLAN 1 的流量异常
  • Trunk 没把对应 VLAN 加 allow-pass → 跨交换机 VLAN 不通
  • port trunk allow-pass vlan all → 引入未规划 VLAN 广播
  • 终端 PC IP 网段与 VLANIF 不一致 → 网关不通
  • 管理 VLAN 改了但忘了在管理口加入 → 自己锁外面
  • VLANIF 接口 admin down → display interface 看 protocol 状态
  • 没有任何端口属于该 VLAN → VLANIF 也起不来

排查流程

跨 VLAN 不通
  |
  ├─ 同 VLAN 内不通 → 看接口 PVID/access vlan 是否对
  ├─ 跨交换机不通 → 看 Trunk allow-pass
  └─ 跨 VLAN 不通 → 看 VLANIF up 没 PC 网关对不对

相关文件

  • references/vlan-commands.md 完整命令速查
  • references/vlan-troubleshooting.md 故障排查

⚠️ 防火墙 VLAN 与交换机的差异

USG 防火墙的 VLAN 用法与交换机完全不同,不要混用本技能命令到防火墙:

交换机 VLAN(本技能默认描述)

  • 划分广播域,三层互通靠 VLANIF
  • 经典命令:vlan batch / port link-type / port trunk allow-pass / interface Vlanif X
  • VLAN 间路由:VLANIF + ip address

防火墙 VLAN(仅以下两种场景)

  1. 透明模式(二层透传):防火墙工作在二层,作为 VLAN 报文转发设备
    firewall transparent-mode enable
    firewall transparent inside-vlan inspect enable    # QinQ 内层 VLAN 检测
    
  2. 安全策略 VLAN 过滤:基于 VLAN ID 控制策略匹配
    security-policy
     rule name vlan_filter
      vlan-id 100
      action permit
    

关键差异点

交换机防火墙
VLAN 主要用途划广播域 + 三层互通透明转发 / 策略过滤
VLANIF 接口✅ 三层网关❌ 无(防火墙三层走物理接口)
port link-type✅ 接入/Trunk/Hybrid❌(仅透明模式下间接支持)
跨 VLAN 路由VLANIF + 路由不在防火墙做,由路由器/三层交换机做

CE 系列 vs S 系列差异

  • CE 命令完全一致(vlan / port link-type / Vlanif)
  • CE 配置后需 commit 提交(二阶段提交模型)
  • CE 进入 VLAN 视图后可用 name <vlan-name> 命名,命名后系统视图可用 vlan vlan-name <name> 直接进入

What ships with it: 2 files

7.1 KB alongside SKILL.md

Keep looking

Skills are one crate of 326,871. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.