各个厂家SSH远程登录

来自AI助手的总结
汇总华三、华为、思科、博达设备SSH/Stelnet配置方法。
各个厂家SSH远程登录

一、华三

1.1 V7版本(S7506E)

服务端

1、开启Stelent服务器功能,并调用ACL2500限制登录。


[Router] ssh server enable

[Router] ssh server acl  2500

2、创建设备管理类本地用户client001,并设置密码为明文aabbcc,服务类型为SSH,用户优先级设为0。

[Router] local-user client001 class manage
[Router-luser-manage-client001] password simple aabbcc
[Router-luser-manage-client001] service-type ssh
[Router-luser-manage-client001] authorization-attribute user-role level-0
[Router-luser-manage-client001] quit

3、设置Stelnet客户端登录用户线的认证方式为AAA认证。


[Router] line vty 0 4

[Router-line-vty0-4] authentication-mode scheme

[Router-line-vty0-4] quit

4、设置Super密码


[Router]super password role level-15 simple aabbcc

说明:如果密码长度太短可以password-control super length 9设置密码长度!!!

5、创建ACL2500,匹配允许登录的流量。


[Router]acl basic 2500

[Router-acl-ipv4-basic-2500]rule 5 deny source 1.1.1.1 0

[Router-acl-ipv4-basic-2500]rule 10 permit source any

客户端


<Router> ssh2 + 服务器IP

1.2 V7版本(S5130-HI)

服务端

为了使Stelnet用户登录设备后能正常使用所有命令,将用户角色设置为network-admin,缺省情况下本地用户的用户角色为network-operator。

1、生成RSA密钥对

<Device> system-view
[Device] public-key local create rsa
The range of public key modulus is (512 ~ 4096).
If the key modulus is greater than 512, it will take a few minutes.
Press CTRL+C to abort.
Input the modulus length [default = 1024]:
Generating Keys...
..
Create the key pair successfully.

2、生成DSA密钥对

[Device] public-key local create dsa
The range of public key modulus is (512 ~ 2048).
If the key modulus is greater than 512, it will take a few minutes.
Press CTRL+C to abort.
Input the modulus length [default = 1024]:
Generating Keys...
......
Create the key pair successfully.

3、生成ECDSA密钥对

[Device] public-key local create ecdsa secp256r1
Generating Keys...
.
Create the key pair successfully.

4、使能SSH服务器功能


[Device] ssh server 

5、设置Stelnet客户端登录用户界面的认证方式为scheme。


[Device] line vty 0 4

[Device-line-vty0-4] authentication-mode scheme

[Device-line-vty0-4] quit

6、创建本地用户client001,并设置用户密码、服务类型和用户角色。

[Device] local-user client001 class manage
[Device-luser-manage-client001] password simple hello12345
[Device-luser-manage-client001] service-type ssh
[Device-luser-manage-client001] authorization-attribute user-role network-admin
[Device-luser-manage-client001] quit

二、华为

2.1 V5版本

服务端

1、开启SSH服务(默认关闭)


[SW4]stelnet server enable

2、配置用户验证方式为aaa及认证协议


[SW4]user-interface vty 0 4

[SW4-ui-vty0-4]authentication-mode aaa

[SW4-ui-vty0-4]protocol inbound ssh

3、创建用户名、密码、用户权限以及服务类型

(1)型号为普通系列


[SW4]aaa

[SW4-aaa]local-user python password cipher 123 privilege

[SW4-aaa]local-user python service-type ssh 

(2)型号为高端系列


[SW4]aaa

[SW4-aaa]local-user python password irreversible-cipher 123 privilege 15

[SW4-aaa]local-user python service-type ssh

4、创建ssh用户认证方式以及服务类型

(1)创建单个ssh用户


[SW4]ssh user python authentication-type password

[SW4]ssh user python service-type stelnet

(2)创建多个ssh用户


[SW4]ssh authentication-type default password 

[SW4]ssh user python service-type stelnet

(3)配置SSH服务器的源接口为设备上所有配置了IPv4地址的接口


[SW4]ssh server-source all-interface

5、AAA视图下关闭远程登录需要修改密码


[SW4]aaa

[SW4-aaa] local-aaa-user password policy administrator

[SW4-aaa-admin]  undo password alert original

6、使用命令display ssh user-information来查看ssh用户信息。

客户端

1、设置SSH客户端属性


[SW2]ssh client first-time enable

2、远程登录测试


[SW4]stelnet 192.168.100.12

三、思科

1、配置思科设备的SSH服务

(1)配置主机名


Server(config)#hostname <hostname>

(2)设置域名


Server(config)#ip domain-name cisco.com

(3)设置用户名以及密码


Server(config)#user <user-name> secret <password>

(4)生成密钥

Server(config)#crypto key generate rsa 
The name for the keys will be: Server.cisco.com
Choose the size of the key modulus in the range of 360 to 2048 for your
  General Purpose Keys. Choosing a key modulus greater than 512 may take
  a few minutes.
How many bits in the modulus [512]: 1024
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]

(5)设置虚拟终端线路号并进入虚拟线路终端配置模式(全局配置模式下)


Server(config)#line vty 0 4

(6)配置认证方式为密码认证(虚拟线路终端配置模式下)


Server(config-line)#login local

(7)配置认证服务类型为SSH(虚拟线路终端配置模式下)


Server(config-line)#transport input ssh 

(8)配置SSH版本为2


Server(config)#ip ssh version 2

2、思科设备客户端连接SSH服务器


Client#ssh -l <用户名> -v 2 <目的主机ip>

四、博达

4.1 S3956、S3448

1、首先关闭telnet服务(必选)


S3956(config)#no ip telnet enable

2、使能SSH服务(默认不使能)


S3956(config)#ip sshd enable

3、指定SSH版本为2


S3956(config)#ip sshd version 2

4、配置认证超时长(可选)


S3956(config)#ip sshd timeout <60-65535>

5、配置认证重试次数(可选)

当用户认证失败超过最大次数后,将暂时关闭ssh server 服务,进入登录静默期。缺省

情况下允许重试6 次。


S3956(config)#ip sshd auth-retries <0-65535>

6、配置登录静默期时长(可选)

当累计登录认证失败次数超过设置阀值时,将进入登录静默期,缺省情况下,静默期时

长为60s。


S3956(config)#ip sshd silence-period <0-3600>

7、使用AAA配置登录认证(必选)

(1)创建全局认证列表。定义login 认证的默认方法列表,该方法列表自动运用于所有登陆认证服务.


S3956(config)#aaa authentication login default local

(2)定义了exec 授权的默认方法列表,该方法列表自动运用于所有需要进入EXEC shell 的用户


S3956(config)#aaa authorization exec default local

(3)定义了一个名为a1 的本地授权策略。exec privilege default 15表示默认授予exec 登陆用户优先级为15。


S3956(config)#localauthor a1

 exec privilege default 15

(4)定义了一个全局配置下的账号exec2,密码为abc,该账号使用本地授权策略a1。


S3956(config)#username exex2 password abc author-group ndxx

8、设置名为ssh-acl的访问控制列表(可选)

(1)设置名为ssh-acl的访问控制列表


S3956(config)#ip access-list standard ssh-acl

 permit 192.168.20.40

(2)套用ssh-acl的访问控制列表


S3956(config)#ip sshd access-class ssh-acl

© 版权声明
THE END
喜欢就支持一下吧
点赞9 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容