举例:配置设备作为SCP客户端
组网需求
与使用SFTP协议传输文件相比,SCP协议可以简化用户传输文件的操作,将用户身份认证、文件传输等步骤合并,提高配置效率。
如图1所示,作为SCP客户端的设备和服务器路由可达,并从SSH服务器中下载文件至客户端。
本例中interface1代表10GE1/0/1。
操作步骤
- 在服务器端生成本地密钥对。
<HUAWEI> system-view [HUAWEI] sysname SSH Server [SSH Server] rsa local-key-pair create The key name will be:Host The range of public key size is (2048, 4096). NOTE: Key pair generation will take a short while. Please input the modulus [default = 3072]:
- 在服务器端创建SSH用户。
# 配置VTY用户界面。
[SSH Server] user-interface vty 0 4 [SSH Server-ui-vty0-4] authentication-mode aaa [SSH Server-ui-vty0-4] protocol inbound ssh [SSH Server-ui-vty0-4] quit
# 新建用户名为Client的SSH用户,且认证方式为password,服务方式为all。
[SSH Server] ssh user Client [SSH Server] ssh user Client authentication-type password [SSH Server] ssh user Client service-type all
# 为SSH用户Client配置密码。
[SSH Server] aaa [SSH Server-aaa] local-user Client password Please configure the login password (8-128) It is recommended that the password consist of at least 2 types of characters, including lowercase letters, uppercase letters, numerals and special characters. Please enter password: Please confirm password: Info: Add a new user. [SSH Server-aaa] local-user Client service-type ssh [SSH Server-aaa] local-user Client privilege level 3 [SSH Server-aaa] quit
- 在服务器端使能SCP服务。
[SSH Server] scp server enable [SSH Server] ssh server-source all-interface
- 在SSH服务器端配置公钥算法、加密算法、密钥交换算法列表、HMAC认证算法和最小密钥长度。
[SSH Server] ssh server cipher aes128_ctr aes256_ctr aes192_ctr aes128_gcm aes256_gcm [SSH Server] ssh server hmac sha2_256 sha2_512 [SSH Server] ssh server key-exchange dh_group_exchange_sha256 dh_group16_sha512 [SSH Server] ssh server publickey rsa_sha2_256 rsa_sha2_512 [SSH Server] ssh server dh-exchange min-len 3072
- 在客户端配置加密算法、HMAC认证算法、密钥交换算法列表、公钥算法。
<HUAWEI> system-view [HUAWEI] sysname SCP Client [SCP Client] ssh client cipher aes128_ctr aes256_ctr aes192_ctr aes128_gcm aes256_gcm [SCP Client] ssh client hmac sha2_256 sha2_512 [SCP Client] ssh client key-exchange dh_group_exchange_sha256 dh_group16_sha512 [SCP Client] ssh client publickey rsa_sha2_256 rsa_sha2_512
检查配置结果
从SCP客户端下载服务器上的文件。
# 第一次登录,使能SSH客户端首次登录功能。
<HUAWEI> system-view [HUAWEI] sysname SCP Client [SCP Client] ssh client first-time enable
# 使用aes256_ctr加密算法将文件backup.cfg从IP地址为10.1.1.1的远端SSH服务器下载至本地用户目录下。
[SCP Client] scp -cipher aes256_ctr Client@10.1.1.1:backup.cfg backup.cfg Trying 10.1.1.1 ... Press CTRL+K to abort Connected to 10.1.1.1 ... Continue to access it? [Y/N]:y [Y/N]:y The server's public key will be saved with the name 10.1.1.1. Please wait... Enter password: backup.cfg 100% 19174Bytes 7Kb/s
配置脚本
-
# sysname SSH Server # aaa local-user Client password irreversible-cipher $#z$!9S<a#>H7{7dI>%0S{AcKGC=t:zjv14LlQqHO\\P.*=<x1]u;y*P`'GR3[m}$ local-user Client service-type terminal ssh local-user Client privilege level 3 # scp server enable ssh user Client ssh user Client authentication-type password ssh user Client service-type all ssh server-source all-interface # user-interface vty 0 4 authentication-mode aaa protocol inbound ssh # ssh server cipher aes128_ctr aes256_ctr aes192_ctr aes128_gcm aes256_gcm ssh server hmac sha2_256 sha2_512 ssh server key-exchange dh_group_exchange_sha256 dh_group16_sha512 ssh server publickey rsa_sha2_256 rsa_sha2_512 ssh server dh-exchange min-len 3072 # return
-
# sysname SCP Client # ssh client first-time enable # ssh client cipher aes128_ctr aes256_ctr aes192_ctr aes128_gcm aes256_gcm ssh client hmac sha2_256 sha2_512 ssh client key-exchange dh_group_exchange_sha256 dh_group16_sha512 ssh client publickey rsa_sha2_256 rsa_sha2_512 # return
版权声明:
作者:SE_YT
链接:https://www.cnesa.cn/2818.html
来源:CNESA
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
打赏
海报
举例:配置设备作为SCP客户端
组网图形
图1 配置通过SCP访问其他设备文件配置示例组网图
组网需求
配置思路
操作步骤
检查配置结果
配置脚本
组网需求
与使用SFTP协议传输文件相比,SCP协议可以简化用户传输文件的操作,将用户身份认证、文件传输等步骤合并,提高配置效率。
如图1所示,作为SCP客户端的设备和服务器路由可达,并从SSH服务器中下载文件至客户端。
本例中interface1代表10GE1/0/1。
配置思路
采用如下的思路配置通过SCP访问其他设备文件:
在SSH服务器端生成本地密钥对。
在SSH服务器端创建SSH用户。
在SSH服务器端使能SCP功能。
从SSH服务器下载文件至本地。
操作步骤
在服务器端生成本地密钥对。
<HUAWEI> system-view
[HUAWEI] sysname SSH Server
[SSH Server] rsa local-key-pair create
The key name will be:Host
The range of public key size is (2048, 4096).
NOTE: Key pair generation will take a short while.
Please input the modulus [default = 3072]:
在服务器端创建SSH用户。
# 配置VTY用户界面。
[SSH Server] user-interface vty 0 4
[SSH Server-ui-vty0-4] authentication-mode aaa
[SSH Server-ui-vty0-4] protocol inbound ssh
[SSH Server-ui-vty0-4] quit
# 新建用户名为Client的SSH用户,且认证方式为password,服务方式为all。
[SSH Server] ssh user Client
[SSH Server] ssh user Client authentication-type password
[SSH Server] ssh user Client service-type all
# 为SSH用户Client配置密码。
[SSH Server] aaa
[SSH Server-aaa] local-user Client password
Please configure the login password (8-128)
It is recommended that the password consist of at least 2 types of characters, including lowercase letters, u……
共有 0 条评论