配置SSH远程登陆:
<H3C>system-view
# 生成RSA密钥对,在提示“Y/N”的时候选择“Y”。
[H3C]public-key local create rsa
The local key pair already exists.
Confirm to replace it? [Y/N]:y
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.
# 生成DSA密钥对
[H3C]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.
# 开启SSH服务器功能
[H3C]ssh server enable
# 配置接口GigabitEthernet1/0/4的IP地址,客户端将通过该地址连接SSH服务器。
[H3C]interface GigabitEthernet1/0/4
[H3C-GigabitEthernet1/0/4]ip address 192.168.10.1 255.255.255.0
[H3C-GigabitEthernet1/0/4]quit
# 设置SSH客户端登录用户线的认证方式为AAA认证。
[H3C]line vty 0 63
[H3C-line-vty0-63]authentication-mode scheme
[H3C-line-vty0-63]quit
# 创建设备管理类本地用户为admin,密码为admin;并设置服务类型为SSH,用户角色为network-admin。
[H3C]local-user admin
[H3C-luser-manage-admin]service-type ssh
[H3C-luser-manage-admin]authorization-attribute user-role network-admin
[H3C-luser-manage-admin]password simple admin
[H3C-luser-manage-admin]quit
限制用户SSH登录设备
#只允许内网192.168.10.0/24网段用户登录设备
#配置ACL:
[H3C]acl basic 2999
[H3C-acl-ipv4-basic-2999]rule permit source 192.168.10.0 0.0.0.255
[H3C-acl-ipv4-basic-2999]quit
#在SSH服务中调用
[H3C]SSH server acl 2999
#测试无问题后,再保存配置
[H3C]save force