项目背景

本次任务针对两台 WS-C4507R-E 交换机进行系统软件升级,并配置 VRRP 实现网关冗余。设备业务已经迁移,无业务中断要求,可直接进行升级。

设备信息

项目 信息
机箱型号 WS-C4507R+E
引擎型号 WS-X45-SUP8L-E(两块)

⚠️ 重要提示:Sup8L-E 引擎必须使用文件名包含 es8 的专用镜像,通用 cat4500e-universal 版本不兼容。

准备工作

硬件准备

物品 用途
Console 线(USB 转 RJ45) 本地连接设备进行底层操作
网线 连接电脑与交换机管理口,用于文件传输
笔记本电脑 运行终端软件和 TFTP 服务器

软件准备

软件 用途
Xshell / SecureCRT 终端连接,执行命令
Xftp / TFTP 服务器 传输镜像文件
思科官方镜像 需匹配引擎型号

关键信息

确认项 结果
设备型号 WS-C4507R+E
引擎型号 WS-X45-SUP8L-E(两块)
原运行版本 槽位3:03.09.00.E
槽位4:03.08.03.E
目标版本 按需(认准 es8 版本
VRRP 配置 基于原有配置添加虚拟网关

操作过程

备份当前配置

可以通过 show 命令加上终端工具日志进行保存,也可以直接使用 TFTP 传输文件。

1
2
3
4
5
6
7
8
9
10
# 导出 running-config(标准配置)
Switch# copy running-config tftp://192.168.1.100/switch1-running.cfg

# 导出 startup-config
Switch# copy startup-config tftp://192.168.1.100/switch1-startup.cfg

Switch# show version > flash:show-version.txt
Switch# show module > flash:show-module.txt
Switch# copy flash:show-version.txt tftp://192.168.1.100/
Switch# copy flash:show-module.txt tftp://192.168.1.100/

上传镜像文件

1
2
3
4
Switch# copy tftp: bootflash:
Address or name of remote host []? 192.168.1.100
Source filename []? cat4500e-universal.SPA.03.11.09.E.152-7.E9.bin
Destination filename []? (回车)

验证上传成功

1
Switch# dir bootflash: | include .bin

配置启动设置

1
2
3
4
5
Switch# configure terminal
Switch(config)# boot system flash bootflash:cat4500e-universal.SPA.03.11.09.E.152-7.E9.bin
Switch(config)# config-register 0x2102
Switch(config)# end
Switch# write memory

重新加载镜像

1
2
Switch# reload
Proceed with reload? [confirm] 回车

进入 ROMmon 模式

报错

1
2
3
loadprog: error - Invalid image for platform
image CPU type = 182, platform CPU type = 232
Could not find a valid file in BOOT environment variable.

原因:上传的镜像文件与引擎型号不匹配。

  • 设备引擎为 Sup8L-E,需要使用文件名包含 es8 的专用镜像
  • 错误上传了 cat4500e-universal...(适用于 Sup7-E / Sup6-E)

解决
如果原来的镜像文件还在,使用原来的镜像重新启动,然后再重新升级即可。

1
2
3
4
# 查看 bootflash 中的文件
rommon 0 > dir bootflash:
# 从 bootflash 启动
rommon 2 > boot bootflash:cat4500es8-universal.SPA.03.08.03.E.bin

或者重新下载正确镜像:cat4500es8-universal...在 ROMmon 模式下通过 tftpdnld 重新上传镜像文件并启动

升级备用引擎

1
2
dir bootflash: | include .bin
copy bootflash:cat4500es8-universal.SPA.03.09.00.E.152-2.E.bin slavebootflash:

验证复制成功

1
dir slavebootflash: | include .bin

配置备用启动

1
2
3
4
5
configure terminal
boot system flash slavebootflash:cat4500es8-universal.SPA.03.09.00.E.152-2.E.bin
config-register 0x2102
end
write memory

重启备用引擎

1
redundancy reload peer

验证冗余状态

1
2
show redundancy
show module

期望结果:两台引擎均运行 03.09.00.E,状态为 ActiveStandby Hot

VRRP 配置

配置规划(示例)

项目 规划值
业务 VLAN VLAN 100
虚拟网关 IP 192.168.100.1
SwitchA 物理 IP 192.168.100.2
SwitchA 优先级 200(Master)
SwitchB 物理 IP 192.168.100.3
SwitchB 优先级 100(Backup)

配置命令

Master 设备配置

1
2
3
4
5
6
7
8
9
10
11
12
configure terminal
vlan 100
name VRRP-VLAN
exit
interface vlan 100
ip address 192.168.100.2 255.255.255.0
no shutdown
vrrp 1 ip 192.168.100.1
vrrp 1 priority 200
vrrp 1 preempt
end
write memory

Backup 设备配置

1
2
3
4
5
6
7
8
9
10
11
12
configure terminal
vlan 100
name VRRP-VLAN
exit
interface vlan 100
ip address 192.168.100.3 255.255.255.0
no shutdown
vrrp 1 ip 192.168.100.1
vrrp 1 priority 100
vrrp 1 preempt
end
write memory

验证命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 查看 VRRP 状态
show vrrp brief

# 期望输出
# Interface Grp Pri State Virtual IP
# Vlan100 1 200 MASTER 192.168.100.1 (Master)
# Vlan100 1 100 BACKUP 192.168.100.1 (Backup)

# 查看详细状态
show vrrp

# 测试故障切换(在 Master 上执行)
configure terminal
interface vlan 100
shutdown
# 观察 Backup 是否在约3秒内变为 MASTER

# 恢复
no shutdown