一、设备与配置范围
本文涉及两台 H3C 设备:
| 设备名称 | 主要配置 |
|---|---|
| FlowTrafficAuditTest | 本地端口镜像组 1,源端口 GE2/0/24,监控端口 GE2/0/23 |
| L2Point5Switch | VLAN 100/200、Access 端口、IRF 端口、SNMP/NTP/SSH/Telnet 等 |
二、FlowTrafficAuditTest 端口镜像配置
1. 配置目标
将 GigabitEthernet2/0/24 的入方向和出方向流量镜像到 GigabitEthernet2/0/23。
2. 关键配置
sysname FlowTrafficAuditTest
mirroring-group 1 local
interface GigabitEthernet2/0/24
mirroring-group 1 mirroring-port both
#
interface GigabitEthernet2/0/23
mirroring-group 1 monitor-port
3. 配置说明
mirroring-group 1 local:创建本地镜像组 1。mirroring-group 1 mirroring-port both:将 GE2/0/24 作为镜像源端口,镜像双向流量。mirroring-group 1 monitor-port:将 GE2/0/23 作为监控端口。
4. 验证命令
display mirroring-group 1
文档中验证结果类似:
Mirroring group 1:
Type: Local
Status: Active
Mirroring port:
GigabitEthernet2/0/24 Both
Monitor port: GigabitEthernet2/0/23
三、L2Point5Switch 基础与 VLAN 配置
1. 基础系统配置
sysname L2Point5Switch
clock timezone Beijing add 08:00:00
clock protocol none
telnet server enable
irf mac-address persistent timer
irf auto-update enable
undo irf link-delay
irf member 1 priority 32
lldp global enable
password-recovery enable
2. VLAN 配置
最终配置中:
vlan 1
name Default
vlan 100
description VLAN100
vlan 200
description VLAN200
3. 端口划分
文档中端口划分如下:
- GE1/0/1~GE1/0/8:Access VLAN 100,描述为
VLAN100_For 8 device - GE1/0/9~GE1/0/17:Access VLAN 200,描述为
VLAN100_For 9 device - GE1/0/18~GE1/0/22:仅配置
port bridge enable - GE1/0/23~GE1/0/24:用于 IRF 端口
- GE1/0/25~GE1/0/28:未配置业务
配置示例:
interface range GigabitEthernet1/0/1 to GigabitEthernet1/0/8
description VLAN100_For 8 device
port access vlan 100
port bridge enable
#
interface range GigabitEthernet1/0/9 to GigabitEthernet1/0/17
description VLAN100_For 9 device
port access vlan 200
port bridge enable
#
interface range GigabitEthernet1/0/18 to GigabitEthernet1/0/22
port bridge enable
注意:文档中 GE1/0/9~GE1/0/17 的描述为
VLAN100_For 9 device,但实际加入的是port access vlan 200。建议将描述修正为VLAN200_For 9 device,避免维护误解。
四、IRF 端口配置
文档中使用 GE1/0/23 和 GE1/0/24 作为 IRF 物理成员端口:
irf-port 1/2
port group interface GigabitEthernet1/0/23 mode normal
port group interface GigabitEthernet1/0/24 mode normal
同时配置:
irf mac-address persistent timer
irf auto-update enable
undo irf link-delay
irf member 1 priority 32
说明:
irf member 1 priority 32用于设置成员优先级,数值越大越优先成为 Master。irf-port 1/2表示 IRF 成员 1 的 IRF 端口 2。- 实际部署时需确保 IRF 端口加入
irf-port后,再绑定物理接口,并按需激活 IRF 配置。
验证命令:
display irf
display irf configuration
display interface brief
五、路由与管理配置
文档中曾配置管理 VLAN 接口:
interface Vlan-interface1
ip address 192.168.10.2 255.255.255.0
并配置默认路由:
ip route-static 0.0.0.0 0 192.168.8.2
但后续执行了:
undo int vlan 1
因此最终配置中已经没有 Vlan-interface1 管理 IP。若需要保留远程管理能力,建议重新配置管理 VLAN 接口和默认路由,例如:
interface Vlan-interface1
ip address 192.168.10.2 255.255.255.0
quit
ip route-static 0.0.0.0 0 192.168.8.2
注意:最终配置中仍有默认路由,但如果没有三层接口或管理地址,该路由的实际可用性需要结合现网确认。
六、日志、SNMP、NTP/SNTP 配置
1. 日志主机
文档中配置了日志主机:
undo info-center enable
info-center loghost 192.168.8.156
注意:
undo info-center enable会关闭信息中心功能,可能导致日志无法正常输出到日志主机。若需要日志主机生效,通常应先启用info-center enable,再配置 loghost。例如:
info-center enable
info-center loghost 192.168.8.156
2. SNMP 配置
snmp-agent
snmp-agent local-engineid 800063A280487397F4C53B00000001
snmp-agent community write private
snmp-agent community read public
snmp-agent sys-info version all
snmp-agent target-host trap address udp-domain 192.168.8.123 params securityname public v2c
snmp-agent target-host trap address udp-domain 192.168.8.20 params securityname public v2c
安全建议:文档中使用了
public/private作为 SNMP 团体名,属于弱口令,生产环境应更换为强团体名,并结合 ACL 限制 SNMP 访问来源。
3. NTP/SNTP 配置
ntp-service refclock-master
ntp-service unicast-server 192.168.0.12
sntp unicast-server 192.168.0.11
说明:
ntp-service refclock-master表示设备作为 NTP 主时钟参考。- 同时又配置了 NTP 单播服务器和 SNTP 服务器,实际部署时建议根据网络规划选择一种时间同步方式,避免配置冲突或维护混乱。
七、远程登录与本地用户
1. VTY 配置
line aux 0
user-role network-admin
#
line vty 0 4
authentication-mode scheme
user-role network-operator
protocol inbound telnet
#
line vty 5 63
user-role network-operator
2. Telnet/SSH/HTTP/HTTPS
telnet server enable
ssh server enable
ip http enable
ip https enable
3. 本地用户
文档中创建了多个本地用户,例如 REBECCA、RRR、abc、admin、test,并配置了不同的服务类型和用户角色。配置形式类似:
local-user admin class manage
password hash ******
service-type ftp
service-type telnet http https
authorization-attribute user-role network-admin
authorization-attribute user-role network-operator
local-user test class manage
password hash ******
service-type http https ssh
authorization-attribute user-role network-admin
authorization-attribute user-role network-operator
安全建议:
- 文档中暴露了密码哈希,实际文章中不建议公开。
- 生产环境应遵循最小权限原则,避免普通运维用户同时具备
network-admin权限。- 若使用 SSH 登录,VTY 下应配置
protocol inbound ssh或protocol inbound all;当前文档中 VTY 0~4 仅放通 Telnet。
八、配置验证命令汇总
FlowTrafficAuditTest
display mirroring-group 1
display current-configuration
display saved-configuration
L2Point5Switch
display current-configuration
display vlan brief
display interface brief
display irf
display ip interface brief
display ntp-service status
display snmp-agent sys-info
display ssh server status
