1、telnet:telnet客户端和服务器基于TCP连接来传输命令,服务器默认通过端口23与客户端建立telnet连接
22端口通常是远程登录服务器用的
telnet以客户端/服务器模式运行
① AAA认证:
aaa//进入用户视图
local-user user-name password cipher password//配置本地用户名和密码
local-user user-name service-type telnet//配置本地用户的接入类型为telnet
local-user user-name privilege level level//配置用户级别
quit//退出aaa视图
user-interface vty 0 4 //进入vty用户界面视图
authentication-mode aaa//设置用户验证方式为AAA认证

② 密码认证:
进入接口,配ip地址
quit
user-interface vty 0 4
authentication-mode password
set authentication password cipher(密文传输) password
simple(明文)

2、FTP

ftp服务器需要开启TCP 21端口来建立控制连接及20端口来建立数据连接
如果用户无权访问任何工作目录,则需要定义一个默认的FTP目录
① 配置ftp本地用户
开启ftp,默认关闭:ftp server enable
aaa//进入aaa视图
local-user user-name password cipher password //设置用户和密码
local-user user-name privilege level level//设置用户级别,设置在3级或3级以上,否则ftp连接将无法成功
local-user user-name service-type ftp//缺省情况下本地用户可以使用所有的接入类型
local-user user-name ftp-directory directory//缺省情况下ftp目录为空
//当有多个用户且有相同的授权目录时,
可以执行set default ftp-directory directory命令
就不需要再为每个用户执行ocal-user user-name ftp-directory directory
binary命令用来在设备作为FTP客户端时设置文件传输方式为binary模式,又称二进制模式

3、SSH

TimesTen 远程登录 远程登录telnet_客户端

 

ssh:通过SFTP访问其他设备文件
SFTP时ssh协议的一部分,利用ssh协议提供的安全通道,为传输数据提供了更高的安全保障。
通过SFTP访问其他设备文件适用于网络安全性高的场景,可以用户日志上传下载。

开启sftp生成本地DSA密钥对
[SSH Server] dsa local-key-pair create   //生成本地DSA密钥对。
Info: The key name will be: SSH Server_Host_DSA.                                                                                   
Info: The key modulus can be any one of the following : 1024, 2048.                                                            
Info: If the key modulus is greater than 512, it may take a few minutes.                                                            
Please input the modulus [default=2048]:   //直接回车,使用缺省密钥对长度(2048位)。
Info: Generating keys........                                                                                                            
Info: Succeeded in creating the DSA host keys.
[SSH Server] sftp server enable   //使能SFTP服务器功能。
  1. 在服务器端创建SSH用户。 # 配置VTY用户界面。
[SSH Server] user-interface vty 0 4   //进入VTY 0~VTY 4用户界面视图。
[SSH Server-ui-vty0-4] authentication-mode aaa   //配置VTY 0~VTY 4的用户认证方式为AAA认证。
[SSH Server-ui-vty0-4] protocol inbound ssh   //配置VTY 0~VTY 4的用户界面支持SSH协议。
[SSH Server-ui-vty0-4] user privilege level 3   //配置用户级别为3级。
[SSH Server-ui-vty0-4] quit
[SSH Server] ssh user client01   //创建SSH用户。
[SSH Server] ssh user client01 authentication-type password   //配置SSH用户的认证方式为password。
[SSH Server] ssh user client01 service-type sftp   //配置SSH用户的服务方式为SFTP。
[SSH Server] ssh user client01 sftp-directory flash:   //配置SFTP服务授权目录为flash:。
[SSH Server] aaa
[SSH Server-aaa] local-user client01 password irreversible-cipher Helloworld@6789   //配置client001的登录密码为Helloworld@6789。
[SSH Server-aaa] local-user client01 service-type ssh   //配置client01的服务方式为SSH。
[SSH Server-aaa] local-user client01 privilege level 3   //配置client01用户级别为3级。
[SSH Server-aaa] quit
# 新建用户名为client02的SSH用户,且认证方式为DSA。
[SSH Server] ssh user client02   //创建SSH用户。
[SSH Server] ssh user client02 authentication-type dsa   //配置SSH用户的认证方式为DSA。
[SSH Server] ssh user client02 service-type sftp   //配置SSH用户的服务方式为SFTP。
[SSH Server] ssh user client02 sftp-directory flash:   //配置SFTP服务授权目录为flash:。
[client002] dsa local-key-pair create   //生成本地DSA密钥对。
[client002] display dsa local-key-pair public
[SSH Server] dsa peer-public-key dsakey001 encoding-type der
[SSH Server-dsa-public-key] public-key-code begin
插入客户端的dsa公钥
[client01] ssh client first-time enable   //使能客户端client01首次认证功能。
[client02] ssh client first-time enable   //使能客户端client02首次认证功能。
[client01] sftp 10.1.1.1 
Please input the username:client01                                                                                                 
Trying 10.1.1.1 ...                                                                                                           
Press CTRL+K to abort                                                                                                               
Connected to 10.1.1.1 ...                                                                                                     
password:SSH_SERVER_CODE                                                                                                                 
                                                                                                                                    
Please select public key type for user authentication [R for RSA; D for DSA; Enter for Skip publickey authentication; Ctrl_C for Cancel], Please select [R, D, Enter or Ctrl_C]:D                                                                                       
Enter password:                                                                                                                     
                                                                                                                                    
sftp-client>
[client02] sftp 10.1.2.1
Please input the username:client02                                                                                                 
Trying 10.1.2.1 ...                                                                                                           
Press CTRL+K to abort                                                                                                               
Connected to 10.1.2.1 ...                                                                                                     
password:SSH_SERVER_CODE                                                                                                                 
                                                                                                                                    
Please select public key type for user authentication [R for RSA; D for DSA; Enter for Skip publickey authentication; Ctrl_C for Cancel], Please select [R, D, Enter or Ctrl_C]:D                                                                                       
                                                                                                                                    
sftp-client>