华为装备ssh协议设置要点儿

[复制链接]
发表于 2025-12-5 11:59:05 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
*红宝书------华为SSH协议的设置的要点*

路由器使用ssh协议来举行设置

1,须要在服务器上创建ssh账户并开启ssh协议
2,手工设置密钥(保举768以上
3,VTY用户接口下允许开启SSH登录方式


R1设置
  1. <Huawei>sys
  2. Enter system view, return user view with Ctrl+Z.
  3. [Huawei]sysn       
  4. [Huawei]sysname r1
  5. [r1]interface g0/0/0
  6. [r1-GigabitEthernet0/0/0]ip address 202.100.1.1 255.255.255.252
  7. Dec 11 2024 18:56:14-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  8. on the interface GigabitEthernet0/0/0 has entered the UP state.
  9. [r1-GigabitEthernet0/0/0]q
  10. [r1]ping 202.100.1.2
  11.   PING 202.100.1.2: 56  data bytes, press CTRL_C to break
  12.     Reply from 202.100.1.2: bytes=56 Sequence=1 ttl=255 time=80 ms
  13.     Reply from 202.100.1.2: bytes=56 Sequence=2 ttl=255 time=20 ms
  14.     Reply from 202.100.1.2: bytes=56 Sequence=3 ttl=255 time=30 ms
  15.     Reply from 202.100.1.2: bytes=56 Sequence=4 ttl=255 time=20 ms
  16.     Reply from 202.100.1.2: bytes=56 Sequence=5 ttl=255 time=20 ms
  17.   --- 202.100.1.2 ping statistics ---
  18.     5 packet(s) transmitted
  19.     5 packet(s) received
  20.     0.00% packet loss
  21.     round-trip min/avg/max = 20/34/80 ms
  22. [r1]aaa
  23. //进入aaa认证
  24. [r1-aaa]local-user ender password cipher qytang
  25. Info: Add a new user.
  26. //创建本地用户ender 密码为qytang
  27. [r1-aaa]local-user ender privilege level 15
  28. //用户的级别为最高的15级
  29. [r1-aaa]local-user ender service-type ssh
  30. //该用户用于ssh登录
  31. [r1-aaa]q       
  32. [r1]ssh user ender authentication-type password
  33. //ssh用户ender通过密码进行认证
  34. Authentication type setted, and will be in effect next time
  35. [r1]stelnet server enable
  36. //开启ssh
  37. Info: Succeeded in starting the STELNET server.       
  38. [r1]rsa local-key-pair create
  39. //创建rsa的key
  40. The key name will be: Host
  41. % RSA keys defined for Host already exist.
  42. Confirm to replace them? (y/n)[n]:y
  43. The range of public key size is (512 ~ 2048).
  44. NOTES: If the key modulus is greater than 512,
  45.        It will take a few minutes.
  46. Input the bits in the modulus[default = 512]:768
  47. Generating keys...
  48. ....++++++++
  49. .............++++++++
  50. ....................+++++++++
  51. .....................................................................+++++++++
  52. [r1]user-interface vty 0 4
  53. //进入VTY通道
  54. [r1-ui-vty0-4]au       
  55. [r1-ui-vty0-4]authentication-mode aaa
  56. //选择AAA认证
  57. [r1-ui-vty0-4]p       
  58. [r1-ui-vty0-4]pro       
  59. [r1-ui-vty0-4]protocol inb       
  60. [r1-ui-vty0-4]protocol inbound ssh
  61. //vty允许SSh登录
  62. [r1-ui-vty0-4]
  63. Dec 11 2024 19:02:14-08:00 r1 %%01SSH/4/SSH_FAIL(l)[1]:Failed to log in through
  64. SSH. (Ip=202.100.1.2, UserName=ender, Times=16777216).
  65. [r1-ui-vty0-4]q
  66. [r1]save
  67.     ^
  68. Error: Unrecognized command found at '^' position.
  69. [r1]q
  70. <r1>save
复制代码
r2
  1. <Huawei>sys
  2. Enter system view, return user view with Ctrl+Z.
  3. [Huawei]sysn       
  4. [Huawei]sysname r2
  5. [r2]in       
  6. [r2]inte       
  7. [r2]interface g0/0/0
  8. [r2-GigabitEthernet0/0/0]ip address 202.100.1.2 255.255.255.252
  9. [r2]stelnet 202.100.1.1
  10. Please input the username:ender
  11. Trying 202.100.1.1 ...
  12. Press CTRL+K to abort
  13. Connected to 202.100.1.1 ...
  14. Error: Failed to verify the server's public key.
  15. Please run the command "ssh client first-time enable"to enable the first-time ac
  16. cess function and try again.
  17. [r2]
  18. [r2]ssh client first-time enable
  19. //启用SSH客户端首次登录时的提示
  20. [r2]stelnet 202.100.1.1
  21. Please input the username:ender
  22. Trying 202.100.1.1 ...
  23. Press CTRL+K to abort
  24. Connected to 202.100.1.1 ...
  25. The server is not authenticated. Continue to access it? (y/n)[n]:y
  26. Dec 11 2024 19:01:54-08:00 r2 %%01SSH/4/CONTINUE_KEYEXCHANGE(l)[1]:The server ha
  27. d not been authenticated in the process of exchanging keys. When deciding whethe
  28. r to continue, the user chose Y.
  29. [r2]
  30. Save the server's public key? (y/n)[n]:y
  31. The server's public key will be saved with the name 202.100.1.1. Please wait...
  32. Dec 11 2024 19:02:10-08:00 r2 %%01SSH/4/SAVE_PUBLICKEY(l)[2]:When deciding wheth
  33. er to save the server's public key 202.100.1.1, the user chose Y.
  34. [r2]
  35. Enter password:
  36. Enter password:
  37. <r1>display user
  38.             ^
  39. Error:Ambiguous command found at '^' position.
  40. <r1>
  41. <r1>display use       
  42. <r1>display users
  43.   User-Intf    Delay    Type   Network Address     AuthenStatus    AuthorcmdFlag
  44.   0   CON 0   00:02:06                                   pass                  
  45.   Username : Unspecified
  46. + 130 VTY 1   00:00:00  SSH    202.100.1.2               pass                  
  47.   Username : ender               
复制代码
Username : Unspecified

  • 130 VTY 1   00:00:00  SSH    202.100.1.2               pass
    Username : ender
[code][/code]
回复

使用道具 举报

登录后关闭弹窗

登录参与点评抽奖  加入IT实名职场社区
去登录
快速回复 返回顶部 返回列表