HPE A5120 重置或是開機出現 Application program does not exist 解決方法與重置後的初始化教學

因為公司的機器找不到原本的 Switch 密碼所以只能重置,結果我在重製的時候不小心按到 Ctrl+F: Format File System 所以整台 Switch 得檔案系統連同 firmware 都不見了 (開機如果看到以下就是 firmware 不見了)

********************************************************************************
*                                                                              *
*                 HPE A5120-24G SI Switch BOOTROM, Version 180                 *
*                                                                              *
********************************************************************************
Copyright (c) 2010-2017 Hewlett Packard Enterprise Development LP

Creation Date       : Aug  9 2017
CPU L1 Cache        : 32KB
CPU Clock Speed     : 333MHz
Memory Size         : 128MB
Flash Size          : 128MB
CPLD Version        : 002
PCB Version         : Ver.B
Mac Address         : 443192154D34


Application program does not exist.
BootRom password: Not required. Please press Enter to continue.

不過也因為機型老舊所以找了很久才找到哪裡有 firmware 可以下載,還好後來在 aruba 官網上面有找到。下面就紀錄如何使用 macOS 重新上傳 firmware 與設定。

使用 console 連接 Switch

連接方法可以參考我前面的文章在 macOS 使用 console 線連接 console port 的方法

下載 firmware

下載位置 5120.SI_5.20.R1519P06.zip

設定 TFTP Server

HP Switch 更新 firmware 提供三種方法給 Switch 下載分別是

  • TFTP protocol
  • FTP protocol
  • XMODEM protocol

而這邊我選擇使用 TFTP ,因為 TFTP macOS 原生就支援了。TFTP 使用方法只要使用以下兩個指令

sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist
sudo launchctl start com.apple.tftpd

預設的 TFTP 讀取目錄在 /private/tftpboot 可以在 /System/Library/LaunchDaemons/tftp.plist 修改它,所以我直接把下載好的 firmware 直接丟到 /private/tftpboot 比較簡單

提供 firmware 給 switch

準備好環境之後就可以回到 console 讓 Switch 來抓 firmware 了

********************************************************************************
*                                                                              *
*                 HPE A5120-24G SI Switch BOOTROM, Version 180                 *
*                                                                              *
********************************************************************************
Copyright (c) 2010-2017 Hewlett Packard Enterprise Development LP

Creation Date       : Aug  9 2017
CPU L1 Cache        : 32KB
CPU Clock Speed     : 333MHz
Memory Size         : 128MB
Flash Size          : 128MB
CPLD Version        : 002
PCB Version         : Ver.B
Mac Address         : 443192154D34


Application program does not exist.
BootRom password: Not required. Please press Enter to continue.

Password recovery capability is enabled.

   BOOT MENU

1. Download application file to flash
2. Select application file to boot
3. Display all files in flash
4. Delete file from flash
5. Restore to factory default configuration
6. Enter BootRom upgrade menu
7. Skip current system configuration
8. Reserved
9. Set switch startup mode
0. Reboot
Ctrl+F: Format File System
Ctrl+P: Skip Super Password
Ctrl+R: Download application to SDRAM and Run
Ctrl+Z: Access EXTEND-ASSISTANT MENU
Ctrl+C: Display Copyright

Enter your choice(0-9): 6   <-----

1. Update full BootRom
2. Update extended BootRom
3. Update basic BootRom
0. Return to boot menu

Enter your choice(0-3): 1   <-----

1. Set TFTP protocol parameters
2. Set FTP protocol parameters
3. Set XMODEM protocol parameters
0. Return to boot menu

Enter your choice(0-3): 1   <-----

輸入 firmware 名稱

Load File Name     :5120SI-CMW520-R1519P06.bin
                   :
Server IP Address  :192.168.1.9
Local IP Address   :192.168.1.8
Gateway IP Address :0.0.0.0

Are you sure to download file to flash? Yes or No (Y/N):Y
Loading.........................................................................
................................................................................
................................................................................
............................................................Done!
Free space: 99090432 bytes
Writing flash...................................................................
...................................................Done!
The attribute of 5120si-cmw520-r1519p06.bin keeps main attribute!
Done!

switch 下載 firmware 成功

   BOOT MENU

1. Download application file to flash
2. Select application file to boot
3. Display all files in flash
4. Delete file from flash
5. Restore to factory default configuration
6. Enter BootRom upgrade menu
7. Skip current system configuration
8. Reserved
9. Set switch startup mode
0. Reboot
Ctrl+F: Format File System
Ctrl+P: Skip Super Password
Ctrl+R: Download application to SDRAM and Run
Ctrl+Z: Access EXTEND-ASSISTANT MENU
Ctrl+C: Display Copyright

Enter your choice(0-9): 0

重新啟動 switch

Starting......
Press Ctrl+D to access BASIC BOOT MENU
Press Ctrl+T to start memory test

********************************************************************************
*                                                                              *
*                 HPE A5120-24G SI Switch BOOTROM, Version 180                 *
*                                                                              *
********************************************************************************
Copyright (c) 2010-2017 Hewlett Packard Enterprise Development LP

Creation Date       : Aug  9 2017
CPU L1 Cache        : 32KB
CPU Clock Speed     : 333MHz
Memory Size         : 128MB
Flash Size          : 128MB
CPLD Version        : 002
PCB Version         : Ver.B
Mac Address         : 443192154D34


Press Ctrl-B to enter Extended Boot menu...0
Starting to get the main application file--flash:/5120SI-CMW520-R1519P06.bin!...
................................................................................
..............................
The main application file is self-decompressing.................................
................................................................................
................................................................................
.........Done!
System is starting...
Startup configuration file does not exist.
It will take a long time to get configuration file, please wait...
Press CTRL_C to break

Retrieving configuration file failed!

User interface aux0 is available.



Press ENTER to get started.
<HPE>

switch 正常開啟並且可以使用指令

切換到 system view 模式

<HPE>system-view
System View: return to User View with Ctrl+Z.
[HPE]

新增使用者

[HPE]local-user admin
New local user added.
[HPE-luser-admin]password cipher admin
[HPE-luser-admin]authorization-attribute level 3
[HPE-luser-admin]service-type ssh telnet web
[HPE-luser-admin]quit

設定 vlan 1 IP

[HPE]interface vlan 1
[HPE-Vlan-interface1]ip address 192.168.1.10 255.255.255.0
[HPE-Vlan-interface1]quit

如果設定錯誤可以使用 undo 回復

[HP-Vlan-interface1]undo ip address

儲存設定

設定完記得儲存不然重開 switch 設定就不見了,不過建議是全部都設定完成一次儲存

[HP]save

設定路由

路由可以設定可以不設定看使用需求

[HPE]ip route-static 0.0.0.0 0.0.0.0 192.168.1.254

設定特別 vlan 的路由

[HP]ip route-static 0.0.0.0 0.0.0.0 Vlan-interface 1 192.168.1.254

使用 ping 測試網路

如果有設定路由就可以使用 ping 測試外網有沒有通

[HPE]ping 168.95.1.1
  PING 168.95.1.1: 56  data bytes, press CTRL_C to break
    Reply from 168.95.1.1: bytes=56 Sequence=1 ttl=248 time=3 ms
    Reply from 168.95.1.1: bytes=56 Sequence=2 ttl=248 time=4 ms
    Reply from 168.95.1.1: bytes=56 Sequence=3 ttl=248 time=4 ms
    Reply from 168.95.1.1: bytes=56 Sequence=4 ttl=248 time=4 ms
    Reply from 168.95.1.1: bytes=56 Sequence=5 ttl=248 time=4 ms

  --- 168.95.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 3/3/4 ms

開啟 http 服務

預設 http 網頁服務是沒有開啟的,所以需要使用指令打開起它開啟後就可以使用網頁控制 switch 了

[HPE]ip http enable
Info: HTTP server has been started!

參考資料