华为交换机恢复密码教程

故障案例:恢复Console口密码

设备提供如下方法可以恢复Console口密码。

  • 方法一:通过Telnet登录设备修改Console口密码。
  • 方法二:在BootROM下配置跳过Console口密码启动后,修改Console口密码。
  • 方法三:在BootROM下重命名当前启动配置文件,以空配置启动后修改Console口密码。
  1. 请优先使用方法一,如果Telnet密码也忘记了再使用其它两个方法。
  2. 如果Console登录用的是密码认证,在方法一不可能的情况下优先使用方法二。
  3. 如果Console登录用的是AAA认证,在方法一不可能的情况下使用方法二或方法三。
  4. 您可以在《AR路由器 缺省帐号与密码》(企业网运营商)文档中获取各种缺省帐号与密码信息。获取该文档需要权限,如需升级权限,请查看网站帮助。

通过Telnet登录设备修改Console口密码

如果用户拥有Telnet账号,并且具有3级或更高的权限,则可以通过Telnet登录到设备后修改Console口密码,然后保存配置。

  1. 使用Telnet账号登录设备,并确认当前账号有3级或更高的权限。使用display users命令查看当前设备所有登录用户。其中带“+”标记行为当前用户,记录对应的编号VTY1。
  2. <Huawei> display users User-Intf Delay Type Network Address AuthenStatus AuthorcmdFlag 129 VTY 0 00:23:36 TEL 10.135.18.67 pass Username : Unspecified + 130 VTY 1 01:20:36 TEL 10.135.18.91 pass Username : Unspecified 131 VTY 2 00:00:00 TEL 10.135.18.54 pass 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 – ……
  3. 修改Console用户的密码,以修改为密码认证,密码为“huawei@123”为例。
  4. # V200R003C01以及更低版本。<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# V200R005C00以及更高版本。<Huawei> system-view [Huawei] user-interface console 0 [Huawei-ui-console0] authentication-mode password [Huawei-ui-console0] set authentication password cipher Enter Password(<8-128>): [Huawei-ui-console0] return
  5. 为了防止重启后配置丢失,选择保存配置。
  6. <Huawei> save Warning: The current configuration will be written to the device. Are you sure to continue? (y/n)[n]:y It will take several minutes to save configuration file, please wait……… Configuration file had been saved successfully Note: The configuration file will take effect after being activated

在BootROM下配置跳过Console口密码启动后,修改Console口密码

设备的BootROM提供了配置跳过Console口密码启动的功能,可以在用户使用Console口登录的时候跳过密码检查。这样系统启动后除了不需要输入Console密码外,与正常启动相同,也会完成所有配置加载。设备启动后修改Console口密码,然后保存配置。

  • 要进入到BootROM菜单需要重启设备,会导致业务中断,请视具体情况做好设备备份,并尽量选择业务量较少的时间操作。
  • 清空Console口密码登录后请马上配置新的密码,否则登录超时或重启后,仍需要清空密码来登录。
  • 在此操作过程中不要对设备进行下电。
  1. 用串口线连接并重启设备,出现“Press Ctrl+B to break auto startup …”打印信息时,按下“Ctrl+B”并键入密码后进入BootROM主菜单。
  2. 配置跳过Console口密码登录。
  3. Main Menu 1. Default Startup 2. Serial Menu 3. Network Menu 4. Startup Select 5. File Manager 6. Reboot 7. Password Manager Enter your choice(1-7):7 PassWord Menu 1. Modify the menu password 2. Clear the console login password 0. Return Enter your choice(0-2):2 Clear the console login password Succeed! PassWord Menu 1. Modify the menu password 2. Clear the console login password 0. Return Enter your choice(0-2):0 Main Menu 1. Default Startup 2. Serial Menu 3. Network Menu 4. Startup Select 5. File Manager 6. Reboot 7. Password Manager Enter your choice(1-7):1
  4. 完成系统启动后,通过Console口登录时不需要认证,登录后修改Console口密码,以修改为密码认证,密码为“huawei@123”为例。
  5. # V200R003C01以及更低版本。<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# V200R005C00以及更高版本。<Huawei> system-view [Huawei] user-interface console 0 [Huawei-ui-console0] authentication-mode password [Huawei-ui-console0] set authentication password cipher Enter Password(<8-128>): [Huawei-ui-console0] return
  6. 为了防止重启后配置丢失,保存配置。
  7. <Huawei> save Warning: The current configuration will be written to the device. Are you sure to continue? (y/n)[n]:y It will take several minutes to save configuration file, please wait……… Configuration file had been saved successfully Note: The configuration file will take effect after being activated

在BootROM下重命名当前启动配置文件,以空配置启动后修改Console口密码

在BootROM下重命名当前启动配置文件,设备会以空配置启动,启动后将配置文件导出并修改Console口密码,覆盖回设备上的配置文件,达到修改登录密码的效果。

  • 要进入到BootROM菜单需要重启设备,会导致业务中断,请视具体情况做好设备备份,并尽量选择业务量较少的时间操作。
  • 在此操作过程中不要对设备进行下电。
  1. 用串口线连接并重启设备,出现“Press Ctrl+B to break auto startup …”打印信息时,按下“Ctrl+B”并键入密码后进入BootROM主菜单。
  2. 重命名当前启动配置文件。
  3. Main Menu 1. Default Startup 2. Serial Menu 3. Network Menu 4. Startup Select 5. File Manager 6. Reboot 7. Password Manager Enter your choice(1-7):4 Startup Select 1. Display Startup 2. Set Boot File 3. Set Config File 4. Startupfile Check Manage 5. Set Startup Waiting Time 0. return Enter your choice(0-5):1 ************** Current Stratup info **************** Valid Flag State : Vaild Boot File Name : flash:/softwarenew.cc Config File Name : flash:/cfgnew.zip Licence File Name : Patch File Name : Voice File Name : ************** Pre Startup info ******************** Valid Flag State : Vaild Boot File Name : flash:/software.cc Config File Name : flash:/cfg.zip Licence File Name : Patch File Name : flash:/patch.pat Voice File Name : Startup Select 1. Display Startup 2. Set Boot File 3. Set Config File 4. Startupfile Check Manage 5. Set Startup Waiting Time 0. return Enter your choice(0-5):0 Main Menu 1. Default Startup 2. Serial Menu 3. Network Menu 4. Startup Select 5. File Manager 6. Reboot 7. Password Manager Enter your choice(1-7):5 File Menu 1. Flash file system 0. Return Enter your choice(0-1):1 SDCard file system MENU 1. List file in Flash 2. Delete file in Flash 3. Rename file in Flash 4. Format Flash 5. Check Flash 0. Return Enter your choice(0-5):3 Please input the file name: cfgnew.zip Please input the new name: cfgnew-copy.zip Rename file[flash:/cfgnew.zip] to [flash:/cfgnew-copy.zip], Yes or No(Y/N): y Rename OK! SDCard file system MENU 1. List file in Flash 2. Delete file in Flash 3. Rename file in Flash 4. Format Flash 5. Check Flash 0. Return Enter your choice(0-5):0 File Menu 1. Flash file system 0. Return Enter your choice(0-1):1 Main Menu 1. Default Startup 2. Serial Menu 3. Network Menu 4. Startup Select 5. File Manager 6. Reboot 7. Password Manager Enter your choice(1-7):1
  4. 完成系统启动后,设备会恢复为默认的出厂配置,并提示设置Console口密码,以密码为“huawei@123”为例。
  5. # V200R003C01以及更低版本。
  6. Please configure the login password (maximum length 16) Enter password: Confirm password: # V200R005C00以及更高版本。Please configure the login password (<8-128>) Enter password: Confirm password:
  7. 配置设备为FTP服务器,FTP路径需与前面重命名后的配置文件的路径保持一致。
  8. <Huawei> system-view [Huawei] ftp server enable Info: Succeeded in starting the FTP server. [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
  9. 从PC上下载重命名后的配置文件。
  10. C:\Documents and Setting\Administrator> ftp 10.110.24.254 Connected to 10.110.24.254. 220 FTP service ready. User (10.110.24.254:(none)): huawei 331 Password required for huawei. Password: 230 User logged in. ftp> get cfgnew-copy.zip //与前面重命名后的配置文件的文件名保持一致 200 Port command okay. 150 Opening ASCII mode data connection for cfgnew-copy.zip. 226 Transfer complete. ftp: 收到 981 字节,用时 0.00Seconds 981000.00Kbytes/sec.
  11. 在PC上解压后使用文本编辑工具(建议用系统自带的文本编辑工具)打开并删除Console口认证配置,删除后重新压缩成.zip文件。
  12. 将修改后的配置文件上传到设备,并覆盖原有配置文件。
  13. <ftp> put cfgnew-copy.zip 200 Port command okay. 150 Opening ASCII mode data connection for cfgnew-copy.zip. 226 Transfer complete. ftp: 发送981 字节,用时 0.00Seconds 981000.00Kbytes/sec.
  14. 设置修改后的配置文件为下一次启动配置文件,选择不保存配置重启设备。
  15. <Huawei> startup saved-configuration cfgnew-copy.zip This operation will take several minutes, please wait… Info: Succeeded in setting the file for booting system <Huawei> reboot fast System will reboot! Continue ? [y/n]:y
  16. 完成系统启动后,设备会提示设置Console口密码,以密码为“huawei@123”为例。
  17. # V200R003C01以及更低版本。
  18. Please configure the login password (maximum length 16) Enter password: Confirm password: # V200R005C00以及更高版本。Please configure the login password (<8-128>) Enter password: Confirm password:
  19. 为了防止下次重启后配置丢失,选择保存配置。
  20. <Huawei> save Warning: The current configuration will be written to the device. Are you sure to continue? (y/n)[n]:y It will take several minutes to save configuration file, please wait……… Configuration file had been saved successfully Note: The configuration file will take effect after being activated