H3C S5560S-28P-SI 交换机配置详解:Comware 7 多业务网关实战解析

本文针对一台在线运行的 H3C S5560S-28P-SI 交换机进行完整配置解析,运行环境为 Comware 7.1.070 Release 6328P03。文章按设备概况→全局参数→VLAN→DHCP→QoS→ACL→接口→路由/NTP→AAA→安全建议的顺序组织,并对每一段配置给出作用说明与潜在风险提示。

本文针对一台在线运行的 H3C S5560S-28P-SI 交换机进行完整配置解析,运行环境为 Comware 7.1.070 Release 6328P03。文章按设备概况→全局参数→VLAN→DHCP→QoS→ACL→接口→路由/NTP→AAA→安全建议的顺序组织,并对每一段配置给出作用说明与潜在风险提示,便于网络运维人员对照检查。

一、设备概况

  • 设备型号:H3C S5560S-28P-SI(1U 三层交换机,24×GE + 4 SFP 端口)
  • 软件版本:Comware 7.1.070 Release 6328P03
  • 运行时长:1 周 4 天 1 小时 25 分钟(最近一次重启原因:User reboot)
  • 管理 IP:Vlan-interface100 192.168.100.254/24
  • 默认路由出口:0.0.0.0/0 → 192.168.100.100(上层网关/防火墙)
  • NTP 源:time.windows.com(公网单源)

凭据说明:本文涉及 local-user admin 与 line aux 0 的密码 hash 均已替换为 <REDACTED>,不展示任何明文或可还原密文。

二、系统基础与全局参数

 sysname 中S5560                      # 设备名,含中文字符(GBK 编码)
 clock timezone Beijing add 08:00:00  # 时区 = 北京 (+08:00)
 clock protocol ntp                   # 时钟源协议 = NTP
 telnet server enable                 # ⚠️ 开启 Telnet 明文登录(端口 23)
 irf mac-address persistent timer     # IRF 堆叠 MAC 表项持久化定时器
 irf auto-update enable               # IRF 自动升级(单台不生效,预留给堆叠)
 undo irf link-delay                  # 关闭 IRF 链路延迟检测
 irf member 1 priority 1              # IRF member 1 优先级 = 1(单台占位)
 ip unreachables enable               # 启用 ICMP Destination Unreachable
 ip ttl-expires enable                # 启用 ICMP Time Exceeded
 dhcp enable                          # 全局开启 DHCP 功能
 dhcp snooping enable                 # 全局开启 DHCP Snooping
 dns proxy enable                     # 开启 DNS 代理
 dns server 202.102.192.20 202.102.199.20
 lldp global enable                   # 全局开启 LLDP
 password-recovery enable             # ⚠️ 允许 console 口重置密码

配置项解析

配置行 作用 备注/风险
sysname 中S5560 设备标识,出现在 prompt 终端编码不一致会乱码,建议 SSH/console 用 UTF-8
clock timezone … +08:00 影响所有时间戳显示 客户端时区不对要手动同步
telnet server enable 启动端口 23 明文协议,强烈建议改 SSH 或限定源 IP
irf … 出厂默认 IRF 配置 单台无意义,真要堆叠需补 irf-port
undo irf link-delay 关闭 IRF 链路延迟检测 单台无所谓;堆叠场景别 undo
ip unreachables enable / ttl-expires enable 配合 traceroute / PMTU 发现 暴露设备 IP 给扫描器
dhcp snooping enable 全局开关,需 VLAN 上单独启用 见下文接口段
password-recovery enable console 口可重置密码 安全风险:机房设备建议关闭

三、VLAN 数据库

vlan 1            # 默认 VLAN,未做业务
vlan 2 to 10      # 业务 VLAN 2-10 批量创建
vlan 20
vlan 30
vlan 40
vlan 50
vlan 60
vlan 70
vlan 80
vlan 90
vlan 100          # 管理 VLAN + 防火墙接入
vlan 200          # 预留
  • VLAN 1 仍存在:默认所有未配置端口在 VLAN 1,建议把 access 端口 port default vlan X 改到具体业务 VLAN。
  • VLAN 200 没有接口引用,纯预留,可用于监控 / IoT 扩展。

四、DHCP 服务器配置

全局 dhcp enable 已在第一节开启,下面 10 个 ip-pool 共享同一 DHCP server 实例。

4.1 地址池总览

Pool 名 网关 分配范围 DNS 静态绑定数
vlan1 192.168.1.1 .100–.200 202.102.199.20, 192.168.1.1 1
vlan2 192.168.2.1 .100–.200 202.102.199.20, 192.168.2.1 3
vlan3 192.168.3.1 .100–.200 202.102.199.20, 192.168.3.1 1
vlan4 192.168.4.1 .100–.200 192.168.4.1, 202.102.199.20 0
vlan5 192.168.5.1 .99–.200 192.168.5.1, 202.102.199.20 1
vlan6 192.168.6.1 .100–.200 192.168.6.1, 202.102.199.20 1
vlan7 192.168.7.1 .3–.200 192.168.7.1, 202.102.199.20 8
vlan8 192.168.8.1 .98–.200 192.168.8.1, 202.102.199.20 4
vlan9 192.168.9.1 .98–.200 192.168.9.1, 202.102.199.20 11
vlan10 192.168.10.1 .100–.200 192.168.10.1 0

4.2 关键 DHCP 段(节选 vlan7)

dhcp server ip-pool vlan7
 gateway-list 192.168.7.1
 network 192.168.7.0 mask 255.255.255.0
 address range 192.168.7.3 192.168.7.200
 dns-list 192.168.7.1 202.102.199.20
 forbidden-ip 192.168.7.1
 static-bind ip-address 192.168.7.3   mask 255.255.255.0 hardware-address 000c-29df-ff88
 static-bind ip-address 192.168.7.4   mask 255.255.255.0 hardware-address 244b-fee9-7912
 static-bind ip-address 192.168.7.6   mask 255.255.255.0 hardware-address 000c-29c9-e105
 static-bind ip-address 192.168.7.7   mask 255.255.255.0 hardware-address 000c-2979-efd1
 static-bind ip-address 192.168.7.11  mask 255.255.255.0 hardware-address 000c-29c1-e094
 static-bind ip-address 192.168.7.98  mask 255.255.255.0 hardware-address 6c92-bfc4-7ae4
 static-bind ip-address 192.168.7.100 mask 255.255.255.0 hardware-address 6c92-bfc4-7ae2
 static-bind ip-address 192.168.7.136 mask 255.255.255.0 hardware-address 000c-29ae-578a

4.3 DHCP 段观察要点

  1. 大量 MAC 以 000c-29xx / 08cc-81xx 开头:这是 VMware 虚拟机默认 OUI,说明 vlan7/8/9 的 static-bind 大概率是虚拟机 IP 固定需求。若虚拟化平台迁移,这些绑定将成为孤儿。
  2. vlan2 漏写 network:其它 pool 都写了 network 192.168.x.0 mask 255.255.255.0,vlan2 漏写,配置不严谨。
  3. vlan10 只有 dns-list 192.168.10.1:把网关当 DNS,若该 VLAN 没有 DNS 代理,用户解析会失败。
  4. forbidden-ip 只列 .1:通常用 forbidden-ip 192.168.x.1 192.168.x.100 避免网关+保留起始地址段冲突。
  5. 缺租期设置:使用 H3C 默认值(一般 1 天)。如需调整,加 lease day X hour Y。

五、QoS(流量分类 / 行为 / 策略)

traffic classifier hao0564 operator and
 if-match acl 3000

traffic classifier icmp operator and

traffic behavior hao_http
 car cir 1024 cbs 64000 ebs 0 green pass red discard yellow pass
traffic behavior icm
traffic behavior icmp

qos policy hao_http
 classifier hao0564 behavior hao_http

qos policy ahha
 classifier icmp behavior icm
  • behavior hao_http 用 CAR 限速到 1024 kbps:cir 1024 承诺信息速率 1 Mbps,ebs 0 不允许超额突发,绿/黄包放行、红包丢弃。
  • qos policy ahha 把 classifier icmp 绑到 behavior icm(注意 behavior 名是 icm 而非 icmp,可能是历史笔误),且该策略没有任何接口引用。
  • 真正下发需要 qos apply policy,见下文 GE1/0/1 接口段。

六、ACL(访问控制列表)

acl advanced 3000
 rule 10 deny tcp source 192.168.7.4 0 destination-port eq 443

acl advanced 3001
 rule 0 deny ip source 192.168.9.99 0 destination 192.168.5.100 0
ACL 动作 含义
3000 rule 10 deny tcp src 192.168.7.4 dst-port 443 封 vlan7 上 .4 的 HTTPS 出站(仅 443,不影响 http 80)
3001 rule 0 deny ip src 192.168.9.99 dst 192.168.5.100 禁止 vlan9 .99 访问 vlan5 .100(任意协议/端口)

⚠️ 两段 ACL 都没有 packet-filter 引用,只是分类器里被 QoS 引用,没有真正做包过滤。如需真正生效,需在 Vlan-interface 上加 packet-filter 3000 inbound / packet-filter 3001 inbound。

七、接口配置

7.1 Bridge-Aggregation(链路聚合)

interface Bridge-Aggregation1
 description 核心交换机G1/0/23-G1/0/24
 port link-type trunk
 port trunk permit vlan all
 link-aggregation mode dynamic

interface Bridge-Aggregation2
 description 客户端防火墙Guest接GE1/0/3-GE1/0/4
 port access vlan 100
 link-aggregation mode dynamic
  • BAG1:上联核心交换机,trunk 所有 VLAN。
  • BAG2:上联防火墙,access vlan 100(管理 + Guest)。
  • 均为 mode dynamic(LACP),对端也需 LACP 才能协商成功。

7.2 VLAN 接口(SVI)

interface Vlan-interface1   ip address 192.168.1.1   255.255.255.0
interface Vlan-interface2   ip address 192.168.2.1   255.255.255.128  # /25
interface Vlan-interface3   ip address 192.168.3.1   255.255.255.0
interface Vlan-interface4   ip address 192.168.4.1   255.255.255.0
interface Vlan-interface5   ip address 192.168.5.1   255.255.255.0
interface Vlan-interface6   ip address 192.168.6.1   255.255.255.0
interface Vlan-interface7   ip address 192.168.7.1   255.255.255.0
   dhcp server apply ip-pool vlan7
interface Vlan-interface8   ip address 192.168.8.1   255.255.255.0
   dhcp server apply ip-pool vlan8
interface Vlan-interface9   ip address 192.168.9.1   255.255.255.0
   dhcp server apply ip-pool vlan9
interface Vlan-interface10  ip address 192.168.10.1  255.255.255.0
interface Vlan-interface20  ip address 192.168.20.1  255.255.255.0
interface Vlan-interface30  ip address 192.168.30.1  255.255.255.0
interface Vlan-interface100 ip address 192.168.100.254 255.255.255.0

7.3 GigabitEthernet 物理端口(关键口)

# 上联 / 防火墙主用口
interface GigabitEthernet1/0/1
 port link-mode bridge
 description 客户端防火墙g1/0/1口
 port access vlan 100
 qos apply policy hao_http inbound
 dhcp snooping trust
 dhcp snooping binding record

# 防火墙聚合(备用链路)
interface GigabitEthernet1/0/21
 port link-mode bridge
 description 客户端防火墙Guest接GE1/0/3-GE1/0/4
 port access vlan 100
 port link-aggregation group 2

interface GigabitEthernet1/0/22
 port link-mode bridge
 description 客户端防火墙Guest接GE1/0/3-GE1/0/4
 port access vlan 100
 port link-aggregation group 2

# 核心聚合(上联)
interface GigabitEthernet1/0/23
 port link-mode bridge
 port link-type trunk
 port trunk permit vlan all
 port link-aggregation group 1

interface GigabitEthernet1/0/24
 port link-mode bridge
 port link-type trunk
 port trunk permit vlan all
 port link-aggregation group 1

# 其他 GE 口(默认在 VLAN 1)
interface GigabitEthernet1/0/2 ~ GigabitEthernet1/0/28
 port link-mode bridge

7.4 接口段观察

  1. GE1/0/1 限速 1Mbps inbound:防火墙主用口。CAR 限速,建议确认是哪个网络(Guest 还是内网)。
  2. GE1/0/21、22 加入 BAG2 但 BAG2 没有 dhcp snooping trust:从 BAG2 收到的 DHCP 报文会被当成客户端报文丢弃,是潜在 DHCP 故障点。
  3. GE1/0/2–28(除聚合口)所有端口都在 VLAN 1:安全风险——任何插线设备进入 VLAN 1,建议 port default vlan X 改到具体业务 VLAN。
  4. 未启用 STP 边缘端口:access 口默认跑 STP 收敛,DHCP 获取 IP 有 30s 延迟,建议 stp edged-port enable + stp bpdu-protection。
  5. 未启用 port-security / 802.1X:纯 DHCP snooping 不阻断非法 MAC。

八、路由与 NTP

 ip route-static 0.0.0.0 0 192.168.100.100      # 默认路由

 ntp-service enable
 ntp-service unicast-server time.windows.com     # 唯一 NTP 源
  • 默认路由单出口:上层挂掉所有 VLAN 断网。可加 ip route-static ... preference X 做浮动路由或 VRRP。
  • NTP 单源公网域名:依赖 DNS 解析,没配认证。建议加内网 NTP 同步服务器做主源,公网做备。

九、AAA 与用户管理

line class aux
 user-role network-admin

line class vty
 user-role network-operator

line aux 0
 authentication-mode password
 user-role network-admin
 set authentication password hash <REDACTED>

line vty 0 63
 authentication-mode scheme
 user-role network-admin
 user-role network-operator

radius scheme system
 user-name-format without-domain

domain system
 domain default enable system

local-user admin class manage
 password hash <REDACTED>
 service-type ftp telnet http https terminal
 authorization-attribute work-directory flash:/
 authorization-attribute user-role network-admin
 authorization-attribute user-role network-operator

 ip http enable
 ip https enable

9.1 AAA 段观察

  1. VTY 用 authentication-mode scheme 但 RADIUS 方案 system 没配 server:当前 RADIUS 认证必失败,实际靠 AAA fallback 走本地 local-user admin。生产环境需补 radius scheme system primary server <ip>。
  2. aux 口和 telnet 口是两套独立密码 hash:管理混乱,建议统一走 AAA 路径,undo set authentication password。
  3. service-type ftp:本地用户不需 FTP 能力,建议删除降低攻击面。
  4. authorization-attribute user-role network-admin + network-operator:同时具备 admin 和 operator 权限。
  5. 未启用 password-control:建议 password-control enable + 复杂度 / 轮换 / 历史策略。
  6. 无 VTY ACL:line vty 0 63 没配 acl 2000 inbound,任何 IP 都能 telnet 进来。

十、安全与管理面总结

项 当前状态 建议
Telnet 服务 开启(明文) undo telnet server enable,启用 ssh server enable
HTTP 服务 开启(明文) undo ip http enable,只用 HTTPS
VTY ACL 无 加 line vty 0 63 的 acl 2000 inbound
密码策略 未启用 password-control enable + 长度 / 复杂度
RADIUS 方案存在无 server 补 primary server 或移除该段
SSH server 未开启 ssh server enable(首选)
端口安全 仅 DHCP snooping access 口加 port-security 或 802.1X
STP 边缘端口 默认非边缘 access 口 stp edged-port enable
BPDU guard 无 stp bpdu-protection
DHCP snooping trust 仅 G1/0/1 BAG2 也加 trust,VLAN 启用 snooping
风暴抑制 未配 access 口 storm-constrain
ACL 仅 2 条,未生效 加 packet-filter 真正过滤
配置保存 未观察到 save save 把运行配置写入 flash

十一、依赖与时序关系(总览)

[外网] → [192.168.100.100 网关]
                ↓
[BAG1 / G1/0/23-24 trunk]
                ↓
[本设备 S5560] ← 管理 VLAN 100 (.254)
        ↓                ↓                ↓
vlan 2-10, 20/30     vlan 100          静态默认路由
SVI .1 业务网关       BAG2 / G1/0/21-22
DHCP server (本机)        ↓
                [防火墙客户端网段]
                G1/0/1 限速 1Mbps
                G1/0/1 = dhcp snooping trust

DHCP Snooping:
  trust 端口: G1/0/1(防火墙主用口)
  ⚠️ BAG2 端口(G1/0/21/22)trust 状态未设

本文仅作只读分析,未对设备做任何写操作。所有配置数据均来自通过 telnet/应用密码抓取的 display current-configuration 输出,密码 hash 已脱敏。如需针对 ACL、SSH、AAA、DHCP snooping 等具体模块的改造方案,欢迎评论区留言讨论。

H3C交换机IRF及BFD MAD检测配置实验:https://www.hao0564.com/5803.html

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注