恢復Console口密碼
設備提供如下方法恢復Console口密碼。
方法一:通過STelnet/Telnet登錄設備修改Console口密碼。
方法二:在BootROM下配置清除Console口密碼啓動後,修改Console口密碼。
方法三:在BootROM菜單下取消設置下次啓動配置文件,設備以空配置啓動後修改Console口密碼。
說明:
請優先使用方法一,如果STelnet/Telnet密碼也忘記了再使用其它兩個方法。使用Telnet協議存在安全風險,建議用戶使用STelnet V2登錄設備。
在方法一不可用的情況下優先使用方法二。
S1720GFR、S2720、S2750、S5700LI、S5700S-LI、S5720S-12TP-PWR-LI-AC和S5700S-28P-PWR-LI-AC爲BootROM菜單,S5710-X-LI、S5700S-28X-LI-AC、S5700S-52X-LI-AC、S5720SI、S5720S-SI、S5720EI、S5720HI、S5720LI、S5720S-LI、S6720EI和S6720S-EI爲BootLoad菜單。
以下設備回顯僅作舉例,不同設備,不同版本,回顯可能會稍有不同,請以設備的實際顯示爲準。
通過STelnet/Telnet登錄設備修改Console口密碼
以下涉及的命令行及回顯信息以STelnet登錄設備修改Console口密碼爲例。
如果用戶擁有STelnet賬號,並且具有3級或更高的權限,則可以通過STelnet登錄到設備後修改Console口密碼,然後保存配置。
使用STelnet賬號登錄設備,並確認當前賬號有3級或更高的權限。
使用display users命令查看當前設備所有登錄用戶。其中帶“+”標記行爲當前用戶,記錄對應的編號VTY1。
<HUAWEI> display users User-Intf Delay Type Network Address AuthenStatus AuthorcmdFlag 129 VTY 0 00:23:36 TEL 10.135.18.67 pass no Username : Unspecified+ 130 VTY 1 01:20:36 TEL 10.135.18.91 pass no Username : Unspecified 131 VTY 2 00:00:00 TEL 10.135.18.54 pass no Username : Unspecified
使用display user-interface命令可以顯示所有用戶的權限,確定VTY1對應的等級爲15,有權限修改Console口密碼。
<HUAWEI> display user-interface Idx Type Tx/Rx Modem Privi ActualPrivi Auth Int 0 CON 0 9600 - 15 - P - + 129 VTY 0 - 15 15 P - + 130 VTY 1 - 15 15 P - + 131 VTY 2 - 15 - P - 132 VTY 3 - 15 15 P - ......
修改Console用戶的密碼,以修改爲密碼認證,密碼爲“huawei@123”爲例。
<HUAWEI> system-view[HUAWEI] user-interface console 0[HUAWEI-ui-console0] authentication-mode password[HUAWEI-ui-console0] set authentication password cipher huawei@123[HUAWEI-ui-console0] return
爲了防止重啓後配置丟失,保存配置。
<HUAWEI> saveThe current configuration will be written to the device. Are you sure to continue?[Y/N]yNow saving the current configuration to the slot 0. Save the configuration successfully.
在BootROM下清除Console口密碼登錄後,修改Console口密碼
設備的BootROM提供了清除Console口密碼的功能,可以在用戶使用Console口登錄的時候跳過密碼檢查。這樣系統啓動後除了不需要輸入Console密碼外,與正常啓動相同,也會完成所有配置加載。設備啓動後重新配置驗證方式和Console口密碼,然後保存配置。
注意:
要進入到BootROM菜單需要重啓設備,會導致業務中斷,請視具體情況做好設備備份,並儘量選擇業務量較少的時間操作。
清除Console口密碼登錄後請馬上配置新的密碼。
在此操作過程中不要對設備進行下電。
用串口線連接設備,然後重啓。當出現“Press Ctrl+B to enter BootROM menu...”(V200R002及V200R003版本)或者“Press Ctrl+B or Ctrl+E to enter BootROM menu ...”(V200R005及以後發佈的版本)打印信息時,按下“Ctrl+B”或者“Ctrl+E”並鍵入密碼(缺省爲“[email protected]”,V100R006C03之前版本可能爲“huawei”),進入BootROM主菜單。
清除Console口登錄密碼。
BootROM MENU 1. Boot with default mode 2. Enter serial submenu 3. Enter startup submenu 4. Enter ethernet submenu 5. Enter filesystem submenu 6. Modify BootROM password //V200R006及之前版本:Modify BootROM password V200R007及之後版本:Enter password submenu 7. Clear password for console user 8. Reboot (Press Ctrl+E to enter diag menu) Enter your choice(1-8): 7Note: Clear password for console user? Yes or No(Y/N): yClear password for console user successfully. Choose "1" to boot, then set a new password. Note: Do not choose "8. Reboot" or power off the device, otherwise this operation will not take effect.
根據設備的提示,在BootROM主菜單下選擇“1”啓動設備。
完成系統啓動後,通過Console口登錄時不需要認證,登錄後配置Console口密碼,以修改爲密碼認證,並修改密碼爲“huawei@123”爲例。
<HUAWEI> system-view[HUAWEI] user-interface console 0[HUAWEI-ui-console0] authentication-mode password[HUAWEI-ui-console0] set authentication password cipher huawei@123[HUAWEI-ui-console0] return
爲了防止重啓後配置丟失,保存配置。
<HUAWEI> saveThe current configuration will be written to the device. Are you sure to continue?[Y/N]yNow saving the current configuration to the slot 0. Save the configuration successfully.
在BootROM菜單下取消設置下次啓動配置文件,設備以空配置啓動後修改Console口密碼
在BootROM下取消設置下次啓動配置文件,設備會以空配置(出廠配置)啓動。啓動後將原配置文件導出,手動修改其中關於Console口登錄的配置。將修改後的配置文件重新上傳至設備,配置設備以修改後的配置文件啓動,重啓後的設備將無需輸入Console口登錄密碼。(以下舉例以Console口下配置了Password認證爲例,其它認證方式以設備實際情況爲準。)
注意:
要進入到BootROM菜單需要重啓設備,會導致業務中斷,請視具體情況做好設備備份,並儘量選擇業務量較少的時間操作。
在此操作過程中不要對設備進行下電。
V200R010及之後版本Console口默認爲AAA認證,如果空配置啓動後沒有修改認證方式,配置設備以刪除認證方式後的配置文件啓動時,重啓後的設備需要輸入缺省的用戶名admin和密碼[email protected],此種情況下的回顯,以設備實際顯示爲準。
用串口線連接設備,然後重啓,當出現“Press Ctrl+B to enter BootROM menu...”(V200R002及V200R003版本)或者“Press Ctrl+B or Ctrl+E to enter BootROM menu ...”(V200R005及以後發佈的版本)打印信息時,按下“Ctrl+B”或者“Ctrl+E”並鍵入密碼(缺省爲“[email protected]”,V100R006C03之前版本可能爲“huawei”)後進入BootROM主菜單。
清空啓動配置文件,使設備以空配置啓動。
說明:
注意記錄設備當前配置文件名,以便後續恢復原配置。
BootROM MENU 1. Boot with default mode 2. Enter serial submenu 3. Enter startup submenu 4. Enter ethernet submenu 5. Enter filesystem submenu 6. Modify BootROM password //V200R006及之前版本:Modify BootROM password V200R007及之後版本:Enter password submenu 7. Clear password for console user 8. Reboot (Press Ctrl+E to enter diag menu) Enter your choice(1-8): 3 Startup Configuration Submenu 1. Display startup configuration 2. Modify startup configuration 3. Return to main menu Enter your choice(1-3): 2Note: startup file field can not be cleared '.'=clear field; 'Ctrl+D'=quit; Enter=use current configuration startup type(1: Flash) current: 1 new : Flash startup file (can not be cleared) current: HUAWEI-v200r008c00.cc new : saved-configuration file current: vrpcfg.zip new : . //清空當前值patch package current: new : Startup Configuration Submenu 1. Display startup configuration 2. Modify startup configuration 3. Return to main menu Enter your choice(1-3): 3
在BootROM主菜單下選擇“1”啓動設備。
完成系統啓動後,設備會恢復爲出廠配置。V200R009及之前版本通過Console口登錄時,提示設置Console口密碼,以密碼爲“huawei@123”爲例。
An initial password is required for the first login via the console. Continue to set it? [Y/N]:ySet a password and keep it safe. Otherwise you will not be able to login via the console. Please configure the login password (8-16) Enter Password: //輸入huawei@123Confirm Password: //再次輸入huawei@123
V200R010及之後版本通過Console口登錄時,提示輸入Console口的默認用戶名和密碼,之後會提示修改密碼,此時必須修改密碼,以密碼爲“huawei@123”爲例。
Login authentication Username:admin Password: //輸入[email protected] Warning: The default password poses security risks. The password needs to be changed. Change now? [Y/N]: y Please enter old password: //輸入[email protected] Please enter new password: //輸入huawei@123 Please confirm new password: //再次輸入huawei@123 The password has been changed successfully.
恢復原配置。當前設備爲默認的出廠配置,若希望恢復設備原配置,又不想保留原配置文件中關於Console密碼的配置,可以下載原配置文件到PC上,手動刪除Console下配置後,上傳至設備,指定爲下次啓動文件,重啓設備。
配置設備爲FTP服務器。
<HUAWEI> system-view[HUAWEI] ftp server enableInfo: The FTP server is already enabled.[HUAWEI] vlan 10[HUAWEI-vlan10] interface vlanif 10 //配置VLANIF10作爲管理接口。[HUAWEI-Vlanif10] ip address 10.110.24.254 24[HUAWEI-Vlanif10] quit[HUAWEI] interface gigabitethernet 0/0/10 //GE0/0/10爲使用Web網管登錄Switch的PC與Switch相連的物理接口編號,請按照實際現網情況進行選擇。[HUAWEI-GigabitEthernet0/0/10] port link-type access[HUAWEI-GigabitEthernet0/0/10] port default vlan 10[HUAWEI-GigabitEthernet0/0/10] quit[HUAWEI] aaa[HUAWEI-aaa] local-user huawei password irreversible-cipher huawei@123[HUAWEI-aaa] local-user huawei ftp-directory flash:[HUAWEI-aaa] local-user huawei service-type ftp[HUAWEI-aaa] local-user huawei privilege level 15
下載原配置文件vrpcfg.zip到PC。
C:\Documents and Setting\Administrator> ftp 10.110.24.254連接到 10.110.24.254。 220 FTP service ready. 用戶 (10.110.24.254:(none)): huawei331 Password required for huawei. 密碼: 230 User logged in. ftp> get vrpcfg.zip200 Port command okay. 150 Opening ASCII mode data connection for directory list. 226 Transfer complete. ftp: 收到 981 字節,用時 0.01秒 981000.00千字節/秒.
在PC上解壓後使用文本編輯工具(建議用系統自帶的文本編輯工具)打開並刪除Console口認證配置,刪除後重新壓縮成vrpcfg.zip文件。需刪除的配置如下所示:
# user-interface maximum-vty 15 user-interface con 0 authentication-mode password //需手動刪除 set authentication password cipher %@%@:*IB+w7j~""GlU$0-;\#m@Jw%@%@ //需手動刪除# user-interface con 0 authentication-mode aaa //需手動刪除 user privilege level 15 //需手動刪除
將修改後的配置文件保存後,上傳到設備,替換原配置文件。
ftp> put vrpcfg.zip200 Port command okay. 150 Opening ASCII mode data connection for directory list. 226 Transfer complete. ftp: 發送 981 字節,用時 0.00Seconds 978000.00千字節/秒.
設置修改後的配置文件爲下一次啓動配置文件,選擇不保存配置重啓設備。
<HUAWEI> startup saved-configuration vrpcfg.zipInfo: Succeeded in setting the configuration for booting system. <HUAWEI> reboot fastSystem will reboot! Continue ? [y/n]:y
重啓後,會再次提醒設置Console登錄密碼,輸入一個安全並方便自己記憶的密碼後,回車,進入命令行界面。