配置SSH


首先说明:Linux上的ssh ip-address 在华为设备上 的命令是stelnet ip-address

由于通过STelnet登录设备需配置用户界面支持的协议是SSH


  • 对于USG系列,将接口加入安全区域,并配置域间包过滤,以保证网络基本通信正常,具体步骤略。对于USG BSR/HSR系列,不需要将接口加入安全区域以及配置包过滤。
  • 在服务器端生成本地密钥对。

    <USG> system-view 
    [USG] rsa local-key-pair create
    The key name will be: USG_Host
    The range of public key size is (512 ~ 2048).
    NOTES: If the key modulus is greater than 512,
           It will take a few minutes.
    Input the bits in the modulus[default = 512]:
    Generating keys...
    .......++++++++++++
    ..........++++++++++++
    ...................................++++++++
    ......++++++++

  • 在服务器端创建SSH用户。

    说明:

    SSH用户主要有password、RSA、password-rsa、all这4种认证方式:

    • 如果SSH用户的认证方式为password、password-rsa时,必须配置同名的local-user用户。

    • 如果SSH用户的认证方式为RSA、password-rsa、all,服务器端应保存SSH客户端的RSA公钥。

    # 配置VTY用户界面。

    [USG] user-interface vty 0 4
    [USG-ui-vty0-4] authentication-mode aaa
    [USG-ui-vty0-4] protocol inbound ssh
    [USG-ui-vty0-4] quit
    • 创建SSH用户Client001。

      # 新建用户名为Client001的SSH用户,且认证方式为password。

      [USG] ssh user client001
      [USG] ssh user client001 authentication-type password

      # 为SSH用户Client001配置密码为Admin@123。

      [USG] aaa
      [USG-aaa] local-user client001 password simple Admin@123
      [USG-aaa] local-user client001 service-type ssh
    • 新建用户名为Client002的SSH用户,且认证方式为RSA。

      [USG] ssh user client002
      [USG] ssh user client002 authentication-type rsa
      

  • 客户端生成客户端的本地密钥对。

    <USG> system-view
    [USG] sysname client002
    [client002] rsa local-key-pair create
    

    使用该命令进行配置时,如果RSA密钥已经存在,则进行告警,并提示原有密钥被更换。产生的密钥对命名为“hostkey”和“serverkey”。

    配置完成后,通过display rsa local-key-pair public查看客户端上生成RSA公钥。

  • 配置服务器端RSA公钥。

    # 将客户端上产生的“hostkey”密钥复制到服务器端。

    [USG] rsa peer-public-key RsaKey001
    Enter "RSA public key" view, return system view with "peer-public-key end".
    [USG-rsa-public-key] public-key-code begin
    Enter "RSA key code" view, return last view with "public-key-code end".
    [USG-rsa-key-code] 3047
    [USG-rsa-key-code] 0240
    [USG-rsa-key-code] BFF35E4B C61BD786 F907B5DE 7D6770C3 E5FD17AB
    [USG-rsa-key-code] 203C8FCB BBC8FDF2 F7CB674E 519E8419 0F6B97A8
    [USG-rsa-key-code] EA91FC4B B9E18836 5E74BFD5 4C687767 A89C6B43
    [USG-rsa-key-code] 1D7E3E1B
    [USG-rsa-key-code] 0203
    [USG-rsa-key-code] 010001
    [USG-rsa-key-code] public-key-code end
    [USG-rsa-public-key] peer-public-key end
    

  • 为SSH用户Client002绑定SSH客户端的RSA公钥。

    [USG] ssh user client002 assign rsa-key RsaKey001 //必须配置

  • SSH服务器端STelnet服务使能。

    # 使能STelnet服务功能。

    [USG] stelnet server enable

  • 配置SSH用户Client001、Client002的服务方式为STelnet。

    [USG] ssh user client001 service-type stelnet 
    [USG] ssh user client002 service-type stelnet

  • STelnet客户端连接SSH服务器。

    # 第一次登录,需要使能SSH客户端首次认证功能。

    <USG> system-view
    [USG] sysname client001
    [client001] ssh client first-time enable
    <client002> system-view
    [client002] ssh client first-time enable

    # STelnet客户端Client001用password认证方式连接SSH服务器,输入配置的用户名和密码。

    <client001> system-view
    [client001] stelnet 10.164.39.222 
    Please input the username:client001
    Trying 10.164.39.222 ...
    Press CTRL+K to abort
    Connected to 10.164.39.222 ...
    The server is not authenticated. Do you continue to access it?(Y/N):y
    Do you want to save the server's public key?(Y/N):y
    The server's public key will be saved with the name: 10.164.39.222. Please wait...
    Enter password:   

    输入密码Admin@123,显示登录成功信息如下:

    <USG>

    # STelnet客户端Clent002用RSA认证方式连接SSH服务器。

    <client002> system-view
    [client002] stelnet 10.164.39.223
    Please input the username: client002
    Trying 10.164.39.223 ...
    Press CTRL+K to abort
    Connected to 10.164.39.223...      
    The server is not authenticated. Do you continue to access it?(Y/N):y
    Do you want to save the server's public key?(Y/N):y
    The server's public key will be saved with the name: 10.164.39.223. Please wait...    
    Note: The max number of VTY users is 10, and the current number
          of VTY users on line is 5.       
    <USG>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了安卓应用、小程序、Python应用和Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值