簡介
本文檔介紹如何藉助HTTP伺服器對APIC進行重新映像。
問題
如果APIC集群發生故障或硬體從L2/M2遷移到L4/M4,單個APIC裝置可能需要重新映像才能恢復功能。此過程概述了使用HTTP伺服器逐一對APIC進行重新映像的簡化方法,有助於以最小的中斷實現更快的群集恢復。
對需要重新映像的每個APIC裝置依次重複此過程。重新映像所有APIC後,根據需要恢復集群配置,並進行徹底測試以驗證功能。
此簡明程式可實現高效的APIC恢復,使管理員能夠及時解決集群故障並有效地恢復網路運營。
必要條件
- 必須使用OOB IP地址配置CIMC。
- 檢視APIC版本說明,並確認您需要對哪個APIC軟體映像進行重新映像。
- 從software.cisco.com獲取軟體映像
- 確認映像的MD5校驗和與Cisco.com上發佈的校驗和匹配
- 將APIC映像上傳到HTTP伺服器上。
解決方案
要使用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
Map-Status必須顯示為OK。
舉例來說:
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 ,當收到To speed the install, enter iso url in next ten minutes消息時,請輸入帶有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: ' <<Asking again to select the interface after selecting the type i,e static >>
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以打開控制器和Lunch KVM的電源,它將要求APIC初始配置