简介
本文档介绍如何使用HTTP服务器重新映像应用策略基础设施控制器(APIC)。
先决条件
要求
- 必须使用OOB IP地址配置思科集成管理控制器(CIMC)。
- 检查APIC版本说明,并确认需要重新映像哪个APIC软件映像。
- 从software.cisco.com获取软件映像。
- 确认映像的MD5校验和与在Cisco.com上发布的校验和匹配。
- 上传HTTP服务器上的APIC映像。
使用的组件
本文档不限于特定的软件和硬件版本。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
背景信息
如果APIC集群发生故障或硬件从L2/M2迁移到L4/M4,单个APIC设备可能需要重新映像才能恢复功能。此过程概述了一种使用HTTP服务器逐一重新映像APIC的简化方法,有助于以最少的中断实现更快的群集恢复。
按顺序对每个需要重新映像的APIC设备重复此过程。重新映像所有APIC后,根据需要恢复集群配置,并进行彻底测试以验证功能。
此简明的操作步骤可实现高效的APIC恢复,使管理员能够及时解决群集故障并有效恢复网络运营。
解决方案
要使用HTTP服务器重新映像APIC,需要执行以下步骤。
步骤1.从Cisco网站下载固件。
打开software.cisco.com/download。
步骤2.输入APIC并在此处为ACI选择适当的版本 — 在本例中,选择4.2(7F)。
例如:

步骤3.将APIC软件ISO映像复制到HTTP服务器。
示例:http://x.x.x.x/iso/

步骤4.通过SSH/控制台连接到思科集成管理控制器。
# ssh admin@cimc_ip
其中cimc_ip是CIMC IP地址。例如:
# ssh admin@x.x.x.x
admin@x.x.x.x's password:
system#
system# scope vmedia
system /vmedia #
system /vmedia # map-www volume_name http://http_server_ip_and_path iso_file_name
其中:
- volume_name是卷的名称。
- http_server_ip_and_path是HTTP服务器的IP地址和.iso文件位置的路径。
- iso_filename是.iso文件的名称。
注意:http_server_ip_and_path与iso_filename之间存在空格。
例如:
system /vmedia # map-www apic http://x.x.x.x/iso/ aci-apic-dk9.4.2.7f.iso
Server username: admin
Server password:
Confirm password:
注意:/*如果此处不需要身份验证,请按Enter键。
system /vmedia # show mappings detail
映射状态必须显示为正常。
例如:
system /vmedia # show mappings detail
Volume apic:
Map-Status: OK
Drive-Type: CD
Remote-Share: http://x.x.x.x/iso/
Remote-File: aci-apic-dk9.4.2.7f.iso
Mount-Type: www
Mount-Options: noauto,username=admin,password=********3
system /vmedia #
system /vmedia # connect host
CISCO Serial Over LAN:
Press Ctrl+x to Exit the session
步骤5.从CIMC GUI的KVM控制台重新通电。
选择Power(电源)> Power Cycle System(cold boot)以重启控制器

从SOL控制台:在启动过程中观察屏幕,并准备在适当的时间按F6以进入启动选择菜单。
例如:

按F6后
注意:如果您错过机会并且无法在适当的时刻按F6,请返回第5步重新启动控制器并重复此过程,直到可以按F6进入引导选择菜单。

您还必须输入BIOS密码。默认密码是password。

在启动选择菜单中,选择Cisco CIMC-Mapped vDVD1.22选项作为一次性启动设备。

步骤6.返回CIMC CLI并监控连接主机的输出。
监控CIMC cli ,当收到消息要加速安装,请在接下来的10分钟内输入iso url,然后输入带APIC映像的http服务器URL。
++ grep /run/install/repo
++ cut -f 1 -d ' '
++ tr -d '[:digit:]'
+ usbdevice=/dev/sr
+ mkdir /mnt/usbdata
+ mount /dev/sr2 /mnt/usbdata
mount: special device /dev/sr2 does not exist
+ true
+ '[' -f /mnt/usbdata/ifabric.iso ']'
+ mountpoint -q /mnt/usbdata
+ true
+ echo 'INFO: found second partition on install media but did not find ifabric.iso. '
INFO: found second partition on install media but did not find ifabric.iso.
+ echo 'Continuing on to ISO URL prompt.'
Continuing on to ISO URL prompt.
+ '[' 0 -eq 0 ']'
+ read_iso_url
+ true,,
+ echo 'To speed up the install, enter iso url in next ten minutes: ' << Enter the http server URL with apic image >>
To speed up the install, enter iso url in next ten minutes:
+ read -t 600 -p '? ' url
?
http://x.x.x.x/iso/aci-apic-dk9.4.2.7f.iso 5:program-log << Enter the http server details >>
[anaconda] 1:main* 2:shell 3:log 4:storage-lo> Switch tab: Alt+Tab | Help: F1
注意:http_server_ip_and_path和iso_filename之间没有空格。
第 7 步: 输入HTTP URL后,引导过程将继续。
注意:如果选择静态选项,系统会要求您输入接口名称、管理IP地址和网关。
+ '[' 0 -eq 0 ']'
+ read_iso_url
+ true
+ echo 'To speed up the install, enter iso url in next ten minutes: '
To speed up the install, enter iso url in next ten minutes:
+ read -t 600 -p '? ' url
?
[ahttp://x.x.x.x/iso/aci-apic-dk9.4.2.7f.iso 5:program-log
++ awk -F '/|:' '{print $4}'
+ urlip=x.x.x.x
+ '[' -z http://x.x.x.x/iso/aci-apic-dk9.4.2.7f.iso ']'
+ '[' -z x.x.x.x ']'
+ break
+ '[' -n http://x.x.x.x/iso/aci-apic-dk9.4.2.7f.iso ']'
+ set +e
+ configured=0
+ '[' 0 -eq 0 ']'
+ echo 'Configuring network interface'
Configuring network interface
+ echo 'type static, dhcp, bash for a shell to configure networking, or url to re-enter the url: '
>>
<< Type static and configure the APIC OOB IP address with it’s gateway>>
type static, dhcp, bash for a shell to configure networking, or url to re-enter the url:
+ read -p '? ' ntype
? static. << Enter the static to configure the networking >>
[anaconda] 1:main* 2:shell 3:log 4:storage-lo> Switch tab: Alt+Tab | Help: F1
注意:键入静态后,它将列出CIMC接口,选择正确的接口。如果选择了错误的接口,则丢包率为100%,然后ping尝试三次失败后,它会再次要求选择正确的接口,直到丢包为0。如果您不知道接口,请依次选择所有接口。
例如:
+ case $ntype in
+ configure_static
+ echo 'Available interfaces'
Available interfaces
+ ls -l /sys/class/net
total 0
lrwxrwxrwx. 1 root root 0 May 3 07:08 enp11s0 -> ../../devices/pci0000:00/0000:00:03.0/0000:06:00.0/0000:07:01.0/0000:09:00.0/0000:0a:00.0/0000:0b:00.0/net/enp11s0
lrwxrwxrwx. 1 root root 0 May 3 07:08 enp12s0 -> ../../devices/pci0000:00/0000:00:03.0/0000:06:00.0/0000:07:01.0/0000:09:00.0/0000:0a:01.0/0000:0c:00.0/net/enp12s0
lrwxrwxrwx. 1 root root 0 May 3 07:08 enp1s0f0 -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/net/enp1s0f0
lrwxrwxrwx. 1 root root 0 May 3 07:08 enp1s0f1 -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.1/net/enp1s0f1
lrwxrwxrwx. 1 root root 0 May 3 07:08 lo -> ../../devices/virtual/net/lo
+ read -p 'Interface to configure: ' interface
Interface to configure: enp1s0f0 << select the correct interface >>
[anaconda] 1:main* 2:shell 3:log 4:storage-lo>
第8步: 正确的接口检查。
进入接口后,它将尝试ping http服务器,如果所选接口正确,则数据包丢失必须为0%,并开始从http服务器获取映像。
例如:在进入0%丢包的正确接口后。
+ read -p 'Interface to configure: ' interface
Interface to configure: enp1s0f0
+ read -p 'address: ' addr
address: x.x.x.x/24
+ read -p 'gateway: ' gw
gateway: x.x.x.x
+ ip addr add x.x.x.x/24 dev enp1s0f0
+ ip link set enp1s0f0 up
+ ip route add default via x.x.x.x
++ seq 1 2
+ for count in '$(seq 1 2)'
+ ping -c 1 x.x.x.x
PING x.x.x.x (x.x.x.x) 56(84) bytes of data.
64 bytes from x.x.x.x: icmp_seq=1 ttl=64 time=55.0 ms
--- x.x.x.x ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 55.056/55.056/55.056/0.000 ms
+ configured=1
+ break
+ '[' 1 -eq 0 ']'
+ echo 'Fetching http://x.x.x.x/iso/aci-apic-dk9.4.2.7f.iso'
Fetching http://x.x.x.x/iso/aci-apic-dk9.4.2.7f.iso >> started fetching the apic image from HTTP server
+ wget -o /dev/null -O /tmp/cdrom.iso http://x.x.x.x/iso/aci-apic-dk9.4.2.7f.iso
如果您选择了错误的接口,则数据包丢失将为100%,在三次尝试ping失败后,它会再次要求选择正确的接口。
例如:在进入错误接口后出现100%的数据包丢失。
+ read -p 'Interface to configure: ' interface
Interface to configure: enp11s0
+ read -p 'address: ' addr
address: x.x.x.x/24
+ read -p 'gateway: ' gw
gateway: x.x.x.x
+ ip addr add x.x.x.x/24 dev enp11s0
+ ip link set enp11s0 up
+ ip route add default via x.x.x.x
++ seq 1 2
+ for count in '$(seq 1 2)'
+ ping -c 1 x.x.x.x
PING x.x.x.x (x.x.x.x) 56(84) bytes of data.
From x.x.x.x icmp_seq=1 Destination Host Unreachable
--- x.x.x.x ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
+ sleep 20
+ for count in '$(seq 1 2)'
+ ping -c 1 x.x.x.x
PING x.x.x.x (x.x.x.x) 56(84) bytes of data.
From x.x.x.x icmp_seq=1 Destination Host Unreachable
--- x.x.x.x ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
+ sleep 20
+ '[' 0 -eq 0 ']'
+ echo 'Configuring network interface'
Configuring network interface
+ echo 'type static, dhcp, bash for a shell to configure networking, or url to re-enter the url: ' <>
type static, dhcp, bash for a shell to configure networking, or url to re-enter the url:
+ read -p '? ' ntype
?
保持监控CIMC CLI并等待约40至50分钟,您将在CLI上获得以下输出。
[anaconda] 1:main* 2:shell 3:log 4:storage-lo> Switch tab: Alt+Tab | Help: F1
[ OK ] Started Show Plymouth Power Off Screen.
[ OK ] Stopped Availability of block devices.
Stopping Logout off all iSCSI sessions on shutdown...
Stopping LVM2 metadata daemon...
[ OK ] Stopped LVM2 metadata daemon.
[ OK ] Stopped Logout off all iSCSI sessions on shutdown.
[ OK ] Stopped target Network.
[ OK ] Stopped Remount Root and Kernel File Systems.
Stopping Remount Root and Kernel File Systems...
[ OK ] Started Restore /run/initramfs.
[ OK ] Reached target Shutdown.
dracut Warning: Killing all remaining processes
Powering off.
reboot: Power down
第9步: 关闭电源后退出SOL
等待,直到您在SOL控制台中看到消息关闭为止,然后按Ctrl和x(Ctrl+x)退出SOL,然后再次登录CIMC并再次更改范围。
(i) Change the scope to virtual media again:
system# scope vmedia
system /vmedia #
(ii) Unmap the .iso image that you mapped in 2.c:
system /vmedia # unmap volume_name
At the Save mapping prompt, enter yes if you want to save the mapping or no if you do not want to save the mapping. For example:
system /vmedia # unmap apic
Save mapping? Enther 'yes' or 'no' to confirm (CTRL-C to cancel) → yes
system /vmedia #
(iii) Connect back to SOL again:
system /vmedia # connect host
步骤10.初始配置
从KVM控制台:选择Power > Power on System以打开控制器和午餐KVM的电源,它将要求APIC初始配置。

警告:此方法仅适用于IPv4 APIC(HTTP服务器)带外(OOB)编址。请注意,目前尚不支持IPv6。